@layer base, components, utilities;

@layer base {
  :root {
    --bg-color: oklch(0.98 0.01 250);
    --text-color: oklch(0.2 0.02 250);
    --primary-color: oklch(0.6 0.18 250);
    --primary-hover: oklch(0.55 0.2 250);
    --surface-color: oklch(1 0 0 / 0.8);
    --shadow-color: oklch(0 0 0 / 0.1);
    
    --font-family: system-ui, -apple-system, sans-serif;
    --border-radius: 12px;
    --spacing: 1rem;
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: grid;
    place-items: center;
    line-height: 1.5;
    background-image: 
      radial-gradient(at 0% 0%, oklch(0.9 0.05 200 / 0.3) 0px, transparent 50%),
      radial-gradient(at 100% 100%, oklch(0.9 0.05 300 / 0.3) 0px, transparent 50%);
  }

  body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    z-index: 100;
  }
}

@layer components {
  .card-container {
    container-type: inline-size;
    width: 100%;
    max-width: 440px;
    padding: 20px;
  }

  .card {
    background: var(--surface-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid oklch(1 0 0 / 0.3);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing) * 2);
    box-shadow: 
      0 10px 30px var(--shadow-color),
      0 1px 1px oklch(1 0 0 / 0.1) inset;
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.4s cubic-bezier(0.2, 0, 0, 1);
  }

  @container (max-width: 350px) {
    .card {
      padding: var(--spacing);
    }
    h1 {
      font-size: 1.5rem;
    }
  }

  .card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 
      0 20px 50px oklch(0 0 0 / 0.2),
      0 0 20px oklch(0.6 0.18 250 / 0.1);
  }

  h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: calc(var(--spacing) * 1.5);
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color), oklch(0.6 0.18 300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
  }

  button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: calc(var(--border-radius) / 2);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px oklch(0.6 0.18 250 / 0.3);
  }

  button:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 20px oklch(0.6 0.18 250 / 0.5);
    transform: scale(1.02);
  }

  button:active {
    transform: scale(0.98);
  }

  /* Lotto Styles */
  .lotto-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    width: 100%;
  }

  .lotto-balls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    min-height: 3.5rem;
  }

  .lotto-ball {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: white;
    text-shadow: 0 1px 2px oklch(0 0 0 / 0.2);
    box-shadow: 
      0 4px 10px oklch(0 0 0 / 0.15),
      0 2px 4px oklch(1 0 0 / 0.2) inset;
    animation: ball-reveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }

  @keyframes ball-reveal {
    to {
      opacity: 1;
      transform: scale(1) rotate(0);
    }
  }

  /* Ball Colors */
  .ball-1-10 { background-color: oklch(0.8 0.15 90); }
  .ball-11-20 { background-color: oklch(0.65 0.15 240); }
  .ball-21-30 { background-color: oklch(0.65 0.2 30); }
  .ball-31-40 { background-color: oklch(0.65 0.05 250); }
  .ball-41-45 { background-color: oklch(0.7 0.15 150); }
}
