@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

    :root {
      --primary-color: #4a90e2;
      --secondary-color: #f5a623;
      --background-color: #e0eaf4;
      --text-color: #333;
      --light-text-color: #fff;
      --border-radius: 12px;
      --box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
      --input-border-color: #ddd;
      --footer-border-color: #ddd;
      --footer-text-color: #777;
      --action-button-hover: #357abd;
    }

    /* Dark Mode Overrides */
    @media (prefers-color-scheme: dark) {
      :root {
        --primary-color: #6aa6ff;
        --secondary-color: #ffa94d;
        --background-color: #1e1e2f;
        --text-color: #eee;
        --light-text-color: #111;
        --box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
        --input-border-color: #555;
        --footer-border-color: #444;
        --footer-text-color: #aaa;
        --action-button-hover: #5589cc;
      }

      body {
        background-color: var(--background-color);
        color: var(--text-color);
      }



      .result-container {
        background-color: #2a2a3d;
      }

      .action-button.active {
        background-color: var(--secondary-color);
      }

      .input-section input,
      .input-section textarea {
        border: 2px solid var(--input-border-color);
        background-color: #333;
        color: var(--text-color);
      }

      footer {
        border-top: 1px solid var(--footer-border-color);
        color: var(--footer-text-color);
      }

      footer a {
        color: var(--primary-color);
      }

      .face {
        background: #333;
        border: 2px solid #eee;
        color: var(--text-color);
      }

      .coin-face {
        border-color: #bfa43a;
        color: var(--text-color);
        text-shadow: 1px 1px 2px #bfa43a;
      }

      .red-card,
      .black-card {
        background: white;
        width: 5.8rem;
        /* fixed card width */
        height: 7rem;
        /* fixed card height */
        line-height: 6rem;
        /* vertical centering */
        border-radius: 6px;
        display: inline-block;
        text-align: center;
      }
    }

    * {
      -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }

    html,
    body {
      touch-action: manipulation;
    }

    body {
      font-family: 'Poppins', sans-serif;
      background-color: var(--background-color);
      color: var(--text-color);
      margin: 0;
      padding: 20px;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
      text-align: center;
    }

    .container {
      width: 100%;
      max-width: 900px;
      background: #ffffff;
      /* light mode container */
      border-radius: var(--border-radius);
      box-shadow: var(--box-shadow);
      padding: 30px;
      box-sizing: border-box;
    }

    @media (prefers-color-scheme: dark) {
      .container {
        background-color: #2a2a3d;
        /* dark mode container */
        box-shadow: var(--box-shadow);
        /* you can keep the same or adjust if you want softer shadow */
      }
    }

    header {
      margin-bottom: 30px;
    }

    h1 {
      color: var(--primary-color);
      margin: 0;
      font-size: 2.5rem;
      font-weight: 700;
    }

    #current-selection {
      font-size: 1.8rem;
      color: var(--secondary-color);
      margin-top: 10px;
      font-weight: 600;
      min-height: 32px;
    }

    main {
      margin-bottom: 30px;
    }

    .result-container {
      background-color: var(--background-color);
      border-radius: var(--border-radius);
      padding: 30px;
      margin-bottom: 30px;
      min-height: 150px;
      display: flex;
      justify-content: center;
      align-items: center;
      transition: all 0.3s ease;
    }

    #result-display {
      font-size: 2rem;
      font-weight: 600;
      word-wrap: break-word;
    }

    #result-display.red-card,
    #result-display.black-card {
      font-size: 3rem;
      /* overrides the base 2rem */
    }

    #color-display {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      margin: 0 auto 10px;
      border: 5px solid #fff;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }

    #bottle-display {
      width: 51.5px;
      height: 150px;
      transition: transform 3s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .button-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 15px;
    }

    .action-button {
      background-color: var(--primary-color);
      color: var(--light-text-color);
      border: none;
      border-radius: var(--border-radius);
      padding: 15px;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: background-color 0.3s ease, transform 0.2s ease;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .action-button:hover {
      background-color: var(--action-button-hover);
      transform: translateY(-2px);
    }

    .action-button:active {
      transform: translateY(1px);
    }

    .action-button.active {
      background-color: var(--secondary-color);
    }

    .input-section {
      margin: 20px;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px;
      align-items: center;
    }

    .input-section input,
    .input-section textarea {
      padding: 10px;
      border: 2px solid #ddd;
      border-radius: 8px;
      font-family: 'Poppins', sans-serif;
      font-size: 1rem;
      width: 100%;
      max-width: 200px;
    }

    .input-section textarea {
      max-width: 420px;
      height: 100px;
    }

    .explanation {
      margin-top: 40px;
      text-align: left;
      line-height: 1.6;
    }

    .explanation h2 {
      text-align: center;
      color: var(--primary-color);
    }

    footer {
      margin-top: 30px;
      padding-top: 20px;
      border-top: 1px solid #ddd;
      font-size: 0.9rem;
      color: #777;
    }

    footer p {
      margin: 5px 0;
    }

    footer a {
      color: var(--primary-color);
      text-decoration: none;
    }

    footer a:hover {
      text-decoration: underline;
    }

    @media (max-width: 600px) {
      body {
        padding: 10px;
      }

      .container {
        padding: 20px;
      }

      h1 {
        font-size: 2rem;
      }

      #current-selection {
        font-size: 1.5rem;
      }

      .button-grid {
        grid-template-columns: repeat(2, 1fr);
      }

      .input-section {
        flex-direction: column;
      }
    }

    #resultDisplay {
      font-family: "Segoe UI Symbol", "DejaVu Sans", "Arial Unicode MS", sans-serif;
      font-size: 2rem;
    }

    .red-card {
      color: red;
      font-family: "Segoe UI Symbol", "DejaVu Sans", "Arial Unicode MS", sans-serif;
      font-size: 3rem;
    }

    .black-card {
      color: black;
      font-family: "Segoe UI Symbol", "DejaVu Sans", "Arial Unicode MS", sans-serif;
      font-size: 3rem;
    }


    .dice-container {
      perspective: 600px;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 120px;
    }

    .dice {
      width: 60px;
      height: 60px;
      position: relative;
      transform-style: preserve-3d;
      transition: transform 1s cubic-bezier(.36, 2, .57, .5);
    }

    .face {
      position: absolute;
      width: 60px;
      height: 60px;
      background: #fff;
      border: 2px solid #333;
      border-radius: 10px;
      font-size: 2rem;
      color: #222;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      backface-visibility: hidden;
    }

    .face.one {
      transform: rotateY(0deg) translateZ(30px);
    }

    .face.two {
      transform: rotateY(180deg) translateZ(30px);
    }

    .face.three {
      transform: rotateY(90deg) translateZ(30px);
    }

    .face.four {
      transform: rotateY(-90deg) translateZ(30px);
    }

    .face.five {
      transform: rotateX(90deg) translateZ(30px);
    }

    .face.six {
      transform: rotateX(-90deg) translateZ(30px);
    }

    .coin-container {
      perspective: 600px;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 120px;
      margin-bottom: 10px;
    }

    .coin {
      width: 90px;
      height: 90px;
      position: relative;
      transform-style: preserve-3d;
      transition: transform 1.2s cubic-bezier(.23, 1.5, .57, 1);
    }

    .coin-face {
      position: absolute;
      width: 90px;
      height: 90px;
      border-radius: 50%;
      background: gold;
      border: 3px solid #bfa43a;
      color: #fff;
      font-size: 1rem;
      font-weight: bold;
      display: flex;
      align-items: center;
      justify-content: center;
      backface-visibility: hidden;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      letter-spacing: 1px;
      text-shadow: 1px 1px 2px #bfa43a;
    }


    .coin-heads {
      background: radial-gradient(circle at 30% 30%, #ffe066 70%, #bfa43a 100%);
      color: #bfa43a;
      transform: rotateY(0deg) translateZ(1px);
    }

    .coin-tails {
      background: radial-gradient(circle at 70% 70%, #ffe066 70%, #bfa43a 100%);
      color: #bfa43a;
      transform: rotateY(180deg) translateZ(1px);
    }