:root {
    --bg-color: #f5f5f5;
    --card-bg: white;
    --text-color: #333;
    --dropdown-bg: white;
    --dropdown-border: #ccc;
    --glow-box-bg: #2e2e2e;
    --glow-box-text: #fff;
    --history-text: #ff8c00;
    --digit-container-bg: #f2f3f4;
    --digit-circle-bg: #2c2c2c;
    --digit-circle-text: white;
    --digit-percent: orange;
    --outer-border: darkgray;
    --switch-bg: #ccc;
    --switch-knob: white;
  }

  .dark-mode {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --dropdown-bg: #2d2d2d;
    --dropdown-border: #444;
    --glow-box-bg: #333;
    --glow-box-text: #fff;
    --history-text: #ffaa44;
    --digit-container-bg: #1a1a1a;
    --digit-circle-bg: #333;
    --digit-circle-text: white;
    --digit-percent: #ffaa44;
    --outer-border: #555;
    --switch-bg: #444;
    --switch-knob: #aaa;
  }

  body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 30px;
    font-family: 'Segoe UI', sans-serif;
    transition: background-color 0.3s, color 0.3s;
  }

  .dropdown-container {
    margin-bottom: 20px;
  }

  .dropdown-label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
  }

  .dropdown {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--dropdown-border);
    background-color: var(--dropdown-bg);
    color: var(--text-color);
  }

  .tick-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(200, 200, 200, 0.5);
    max-width: 500px;
    margin: auto;
    transition: background-color 0.3s;
  }

  .glow-box {
    background: var(--glow-box-bg);
    color: var(--glow-box-text);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
    box-shadow: 0 0 10px rgba(128, 128, 128, 0.8),
                0 0 30px rgba(128, 128, 128, 0.6);
    transition: background-color 0.3s;
  }

  #digit-history {
    text-align: center;
    font-size: 1.1rem;
    color: var(--history-text);
    margin-top: 10px;
    font-weight: 500;
    transition: color 0.3s;
  }

  /* Theme switch styles */
  .theme-switch-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 20px;
  }

  .theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
  }

  .theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg);
    transition: .4s;
    border-radius: 34px;
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--switch-knob);
    transition: .4s;
    border-radius: 50%;
  }

  input:checked + .slider {
    background-color: #2196F3;
  }

  input:checked + .slider:before {
    transform: translateX(26px);
  }

  .theme-label {
    margin-right: 10px;
    font-weight: bold;
  }

  @media (max-width: 576px) {
    .glow-box {
      font-size: 1rem;
    }

    .tick-card {
      padding: 15px;
    }
  }

  .digit-container {
    background-color: var(--digit-container-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    transition: background-color 0.3s;
  }

  .digit-wrapper {
    position: relative;
    margin: 10px;
  }

  .digit-circle {
    width: 70px;
    height: 70px;
    background-color: var(--digit-circle-bg);
    color: var(--digit-circle-text);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    z-index: 2;
    transition: background-color 0.3s;
  }

  .digit-percent {
    font-size: 0.75rem;
    color: var(--digit-percent);
    position: absolute;
    bottom: 8px;
    transition: color 0.3s;
  }

  .digit-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 12px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid red;
    z-index: 2;
  }

  .outer-border {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 6px solid var(--outer-border);
    z-index: 1;
    pointer-events: none;
    transition: border-color 0.3s;
  }

  .outer-border::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 6px solid transparent;
    border-bottom-color: red;
    z-index: 2;
  }

  /* Per-digit color overrides */
  .digit-wrapper[data-color="gray"] .outer-border::after {
    border-bottom-color: gray;
  }

  .digit-wrapper[data-color="gold"] .outer-border::after {
    border-bottom-color: gold;
  }

  .digit-wrapper[data-color="turquoise"] .outer-border::after {
    border-bottom-color: turquoise;
  }

  .digit-wrapper[data-color="blue"] .outer-border::after {
    border-bottom-color: blue;
  }

  .digit-wrapper[data-color="red"] .outer-border::after {
    border-bottom-color: red;
  }

  .digit-wrapper[data-color="orange"] .outer-border::after {
    border-bottom-color: orange;
  }

  @media (max-width: 768px) {
    .digit-circle {
      width: 60px;
      height: 60px;
    }

    .outer-border {
      width: 70px;
      height: 70px;
      top: -5px;
      left: -5px;
    }

    .outer-border::after {
      width: 70px;
      height: 70px;
      top: -6px;
      left: -6px;
    }
  }

  @media (max-width: 576px) {
    .digit-circle {
      width: 50px;
      height: 50px;
    }

    .digit-percent {
      font-size: 0.65rem;
    }

    .outer-border {
      width: 60px;
      height: 60px;
      top: -5px;
      left: -5px;
    }

    .outer-border::after {
      width: 60px;
      height: 60px;
      top: -6px;
      left: -6px;
    }
  }