    :root {
      --bg-primary: #12141A;
      --bg-secondary: #1D2027;
      --text-primary: #FFFFFF;
      --text-secondary: #A7AAB4;
      --accent-1: #FFCC35;
      --accent-2: #29A8FF;

        --success-color: #2ecc71;
  --danger-color: #e74c3c;
  --warning-color: #f39c12;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: "Google Sans", sans-serif;      
      -webkit-tap-highlight-color: transparent;
    }

    html {
      height: 100%;
      min-height: 100%;
      overflow: hidden;
      width: 100%;
      position: fixed; /* Prevent scrolling in standalone mode */
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      -webkit-text-size-adjust: 100%; /* Prevent text zoom on iOS */
      background: #12141A; /* Solid fallback */
    }

    body {
      font-family: "Google Sans", sans-serif;      
      background: transparent; /* Let html background show through */
      color: var(--text-primary);
      height: 100%;
      min-height: 100%;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      width: 100%;
      -webkit-text-size-adjust: 100%; /* Prevent text zoom on iOS */
      touch-action: manipulation; /* Improve touch handling */
      position: fixed; /* Prevent any scrolling */
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
    }

    /* iOS Safari background fix */
    body::before {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100vw;
      height: 100vh;
      min-height: 100%;
      background: linear-gradient(145deg, #0F1116, #1B1E25 60%, #101218);
      background-size: 200% 200%;
      animation: bg-pan 12s ease-in-out infinite alternate;
      z-index: -1;
    }

    @keyframes bg-pan {
      0% { background-position: 0% 0%; }
      100% { background-position: 100% 100%; }
    }

    .app {
      height: 100%;
      width: 100%;
      padding: 16px;
      padding-top: max(16px, env(safe-area-inset-top)); /* Safe area for notch */
      padding-bottom: max(16px, env(safe-area-inset-bottom)); /* Safe area for home indicator */
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
      opacity: 0;
      animation: fadeIn 0.6s ease forwards;
      position: relative;
      z-index: 1;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .lobby {
      height: 100%;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .menu-section {
      height: 100%;      
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      overflow: hidden;
    }

    @keyframes fadeIn {
      to { opacity: 1; }
    }

    .active {
      display: block;
    }

    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain; /* Prevent overscroll bounce affecting parent */
      min-height: 0;
    }

    .logo-wrapper {
      max-width: 320px;
      width: 100%;
      animation: float 3.5s ease-in-out infinite;
      transform-origin: center;
      will-change: transform;
    }

    @keyframes float {
      0%   { transform: translateY(0px); }
      50%  { transform: translateY(-6px); }
      100% { transform: translateY(0px); }
    }

    .logo-wrapper img {
      width: 100%;
      height: auto;
      filter: drop-shadow(0 12px 40px rgba(0,0,0,0.55));
      transition: filter .25s;
    }

    .title {
      margin:0;
      margin-top:-10px;
      font-size: 2.8rem;
      animation: float 3.5s ease-in-out infinite;

    }

    .subtitle {
      color: var(--accent-1);
      font-size: 2rem;
    }

    .footer {
      padding-top: 12px;
      padding-bottom: 20px;
      flex-shrink: 0;
    }

    .footer-inner {
      max-width: 520px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 16px 8px 24px;
    }

    .btn {
      border: none;
      border-radius: 20px;
      padding: 14px 18px;
      font-size: 1.5rem;
      font-weight: 700;
      cursor: pointer;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: 0.18s ease;
      -webkit-appearance: none; /* Remove iOS default styling */
      appearance: none;
      touch-action: manipulation; /* Prevent double-tap zoom */
      -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
      user-select: none;
    }

    .btn-secondary {
      background: var(--accent-1);
      color: var(--bg-primary);
    }

    .btn-primary {
      background-color: transparent;
      border: 1px solid var(--accent-1);
      color: var(--accent-1);
    }

    .btn:active {
      transform: translateY(1px) scale(0.98);
      opacity: 0.95;
    }

    @media (min-width: 768px) {
      .logo-wrapper { max-width: 520px; }
      .btn { font-size: 1.15rem; padding: 16px 20px; }
    }
    .snow-container {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 0;
      overflow: hidden;
    }

    .snowflake {
      position: absolute;
      top: -10px;
      background: rgba(255, 255, 255, 0.6);
      border-radius: 50%;
      animation: fall linear infinite;
    }

    @keyframes fall {
      to {
        transform: translateY(100vh) translateX(var(--drift));
        opacity: 0;
      }
    }

    .hidden {
      display: none !important;
    }

    /* Slide Animations */
    .slide-out-left {
      animation: slideOutLeft 0.2s ease-in-out forwards;
    }

    .slide-in-right {
      animation: slideInRight 0.2s ease-in-out forwards;
    }

    /* Reverse animations for back navigation */
    .slide-out-right {
      animation: slideOutRight 0.2s ease-in-out forwards;
    }

    .slide-in-left {
      animation: slideInLeft 0.2s ease-in-out forwards;
    }

    @keyframes slideOutLeft {
      from {
        transform: translateX(0);
        opacity: 1;
      }
      to {
        transform: translateX(-100%);
        opacity: 0;
      }
    }

    @keyframes slideInRight {
      from {
        transform: translateX(100%);
        opacity: 0;
      }
      to {
        transform: translateX(0);
        opacity: 1;
      }
    }

    @keyframes slideOutRight {
      from {
        transform: translateX(0);
        opacity: 1;
      }
      to {
        transform: translateX(100%);
        opacity: 0;
      }
    }

    @keyframes slideInLeft {
      from {
        transform: translateX(-100%);
        opacity: 0;
      }
      to {
        transform: translateX(0);
        opacity: 1;
      }
    }

    .menu-section, #game-screen {
      position: relative;
    }

    .settings-form {
      max-width: 520px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      gap: 24px;
      padding: 20px;
    }

    .form-group {
      background: var(--bg-secondary);
      padding: 20px;
      border-radius: 16px;
      border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .form-group label:not(.checkbox-label):not(.radio-label) {
      display: block;
      font-size: 1.1rem;
      font-weight: 600;
      margin-bottom: 12px;
      color: var(--text-primary);
    }

    .radio-group {
      display: flex;
      gap: 12px;
      margin-top: 12px;
    }

    .radio-label {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 12px;
      background: var(--bg-primary);
      border: 2px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      cursor: pointer;
      transition: all 0.2s ease;
      font-size: 1.2rem;
      font-weight: 600;
      -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
      touch-action: manipulation; /* Prevent double-tap zoom */
    }

    .radio-label:hover {
      border-color: var(--accent-1);
      background: rgba(255, 204, 53, 0.05);
    }

    .radio-label input[type="radio"] {
      display: none;
    }

    .radio-label input[type="radio"]:checked + span {
      color: var(--bg-primary);
    }

    .radio-label:has(input[type="radio"]:checked) {
      background: var(--accent-1);
      border-color: var(--accent-1);
      color: var(--bg-primary);
    }

    .checkbox-label {
      display: flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      font-size: 1rem;
      color: var(--text-primary);
      user-select: none;
      -webkit-user-select: none; /* iOS specific */
      -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
      touch-action: manipulation; /* Prevent double-tap zoom */
    }

    .checkbox-label input[type="checkbox"] {
      width: 24px;
      height: 24px;
      cursor: pointer;
      accent-color: var(--accent-1);
      appearance: none;
      -webkit-appearance: none;
      background: var(--bg-primary);
      border: 2px solid rgba(255, 255, 255, 0.2);
      border-radius: 4px;
      position: relative;
      transition: all 0.2s ease;
    }

    .checkbox-label input[type="checkbox"]:checked {
      background: var(--accent-1);
      border-color: var(--accent-1);
    }

    .checkbox-label input[type="checkbox"]:checked::after {
      content: '✓';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      color: var(--bg-primary);
      font-size: 16px;
      font-weight: bold;
    }

    .create-section-title {
      text-align: center;
      font-size: 2rem;
      margin-bottom: 20px;
      color: var(--accent-1);
    }

    .create-header {
      position: relative;
      text-align: center;
      margin-bottom: 20px;
      padding: 16px 20px;
      width: 100%;
      flex-shrink: 0;
    }

    .create-header .back-arrow-icon {
      position: absolute;
      top: 20px;
      left: 0;
      width: 28px;
      height: 28px;
      color: #888;
      cursor: pointer;
      transition: all 0.2s ease;
      z-index: 10;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    .create-header .back-arrow-icon:hover {
      color: #aaa;
      transform: translateX(-3px);
    }

    .create-header .back-arrow-icon:active {
      transform: translateX(-5px);
    }

    .create-header .create-section-title {
      font-size: 2rem;
      margin-bottom: 0;
      color: var(--accent-1);
    }

    .btn-text {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      padding: 12px;
      font-size: 1.1rem;
      cursor: pointer;
      transition: 0.2s ease;
    }

    .btn-text:hover {
      color: var(--text-primary);
    }

    .settings-form {
      padding: 0 20px;
      width: 100%;
    }

    .create-buttons {
      max-width: 520px;
      margin: 20px auto;
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 0 20px;
    }

    .name-input {
      width: 100%;
      padding: 16px 20px;
      font-size: 1.3rem;
      font-weight: 600;
      background: var(--bg-secondary);
      border: 2px solid rgba(255, 255, 255, 0.1);
      border-radius: 16px;
      color: var(--text-primary);
      text-align: center;
      outline: none;
      transition: all 0.2s ease;
      font-family: "Google Sans", sans-serif;
      margin-top:20px;
      -webkit-appearance: none; /* Remove iOS default styling */
      appearance: none;
      touch-action: manipulation; /* Prevent double-tap zoom */
    }

    .name-input::placeholder {
      color: var(--text-secondary);
    }

    .name-input:focus {
      border-color: var(--accent-1);
      background: rgba(255, 204, 53, 0.05);
    }

    .waiting-room-header {
      position: relative;
      text-align: center;
      padding: 16px 20px;
      width: 100%;
      flex-shrink: 0;
    }

    .waiting-room-header .back-arrow-icon {
      position: absolute;
      top: 20px;
      left: 0;
      width: 28px;
      height: 28px;
      color: #888;
      cursor: pointer;
      transition: all 0.2s ease;
      z-index: 10;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    .waiting-room-header .back-arrow-icon:hover {
      color: #aaa;
      transform: translateX(-3px);
    }

    .waiting-room-header .back-arrow-icon:active {
      transform: translateX(-5px);
    }

    .waiting-room-header .room-code {
      margin-bottom: 0;
    }

    .waiting-room-content {
      width:100%;
      margin: 0 auto;
      padding: 0 20px 20px;
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
    }

    .room-code {
      text-align: center;
      flex-shrink: 0;
    }

    .room-code-label {
      font-size: 1rem;
      color: var(--text-secondary);
      margin-bottom: 8px;
    }

    .room-code-value {
      font-size: 2rem;
      font-weight: 700;
      color: var(--accent-1);
      letter-spacing: 0.03em;
      text-shadow: 0 0 20px rgba(255, 204, 53, 0.3);
    }

    .players-section {
      margin-bottom: 30px;
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .players-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
      padding: 0 8px;
      flex-shrink: 0;
    }

    .players-title {
      font-size: 1.3rem;
      font-weight: 600;
      color: var(--text-primary);
    }

    .players-count {
      font-size: 1.1rem;
      color: var(--text-secondary);
      background: var(--bg-secondary);
      padding: 6px 14px;
      border-radius: 20px;
    }

    .players-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      list-style: none;
      padding: 0;
      margin: 0;
      overflow-y: auto;
      overflow-x: hidden;
      flex: 1;
      min-height: 0;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain; /* Prevent overscroll bounce affecting parent */
      padding-top:10px;
      padding-bottom:10px;
    }

    .players-list li {
      background: var(--bg-secondary);
      padding: 16px 20px;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      transition: all 0.2s ease;
    }

    .players-list li.isPlayer {
      border-color: var(--accent-1);
      background: rgba(255, 204, 53, 0.05);
    }

    .players-list li .player-info {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1;
    }

    .players-list li .player-icon {
      font-size: 1.5rem;
    }

    .players-list li .player-name {
      font-size: 1.1rem;
      font-weight: 600;
      color: var(--text-primary);
    }

    .players-list li .player-stats {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .players-list li .player-score {
      color: var(--accent-1);
      font-weight: bold;
      font-size: 1rem;
    }

    .players-list li .host-badge {
      background: var(--accent-1);
      color: var(--bg-primary);
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: 700;
      text-transform: uppercase;
    }

    .player-item {
      background: var(--bg-secondary);
      padding: 16px 20px;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      display: flex;
      align-items: center;
      gap: 12px;
      transition: all 0.2s ease;
    }

    .player-item.isPlayer {
      border-color: var(--accent-1);
      background: rgba(255, 204, 53, 0.05);
    }

    .player-icon {
      font-size: 1.5rem;
    }

    .host-badge {
      background: var(--accent-1);
      color: var(--bg-primary);
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 0.8rem;
      font-weight: 700;
      text-transform: uppercase;
    }

    .game-info {
      background: var(--bg-secondary);
      padding: 16px;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      margin-top: 20px;
      margin-bottom: 20px;
      flex-shrink: 0;
    }

    .game-info-item {
      display: flex;
      justify-content: space-between;
      padding: 8px 0;
      color: var(--text-primary);
    }

    .game-info-item:not(:last-child) {
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .game-info-label {
      color: var(--text-secondary);
    }

    .game-info-value {
      font-weight: 600;
      color: var(--accent-1);
    }

    /* Game Screen Styles */
    .game-header {
      margin-bottom: 20px;
      text-align: center;
      width: 100%;
      max-width: 340px;
    }

    .game-title {
      font-size: 1.6rem;
      color: var(--text-primary);
      margin-bottom: 16px;
    }

    .btn-game  {
      max-width:340px;
      width:100%;
      box-sizing: border-box;
      margin: auto;
    }

    .current-player {
      margin-top: 12px;
      padding: 16px;
      background: var(--bg-secondary);
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      display: flex;
      flex-direction: column;
      gap: 8px;
      align-items: center;
    }

    .current-player span:first-child {
      color: var(--text-secondary);
      font-size: 0.85rem;
    }

    .highlight {
      color: var(--accent-1);
      font-weight: 700;
      font-size: 1.3rem;
    }

    .game-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 15px;
      margin-bottom: 30px;
      width: 100%;
      max-width: 500px;
    }

    .game-info p {
      margin: 0;
      line-height: 1.6;
      color: var(--text-secondary);
      font-size: 0.95rem;
    }

    .games-list {
      display: flex;
      flex-direction: column;
      gap: 12px;
      width:100%;
      margin: 0 auto;
      padding: 20px;
      overflow-y: auto;
      overflow-x: hidden;
      max-height: calc(100vh - 280px);
      max-height: calc(100dvh - 280px); /* iOS Safari dynamic viewport */
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain; /* Prevent overscroll bounce affecting parent */
    }

    .game-item {
      background: var(--bg-secondary);
      padding: 16px;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      cursor: pointer;
      transition: all 0.2s ease;
      -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
      touch-action: manipulation; /* Prevent double-tap zoom */
    }

    .game-item:hover {
      border-color: var(--accent-1);
      background: rgba(255, 204, 53, 0.05);
      transform: translateY(-2px);
    }

    .game-item:active {
      transform: translateY(0);
    }

    .game-item-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }

    .game-code-badge {
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--accent-1);
      letter-spacing: 0.1em;
    }

    .game-players-count {
      font-size: 1rem;
      color: var(--text-secondary);
      background: var(--bg-primary);
      padding: 6px 12px;
      border-radius: 20px;
    }

    .game-item-details {
      display: flex;
      flex-direction: column;
      gap: 8px;
      font-size: 0.95rem;
      color: var(--text-secondary);
    }

    .game-item-details strong {
      color: var(--text-primary);
    }

    .game-setting-tag {
      display: inline-block;
      background: rgba(255, 204, 53, 0.15);
      color: var(--accent-1);
      padding: 4px 10px;
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 600;
      margin-right: 6px;
    }

    .game {
      display:flex;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
    }

    .game .main {
      padding-top: 20px;
      padding-bottom: 20px;
    }

    .no-games-text {
      text-align: center;
      color: var(--text-secondary);
      padding: 40px 20px;
      font-size: 1.1rem;
    }

    .join-header {
      position: relative;
      text-align: center;
      margin-bottom: 20px;
      padding: 16px 20px;
      width: 100%;
    }

    .join-header .back-arrow-icon {
      position: absolute;
      top: 20px;
      left: 0;
      width: 28px;
      height: 28px;
      color: #888;
      cursor: pointer;
      transition: all 0.2s ease;
      z-index: 10;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    .join-header .back-arrow-icon:hover {
      color: #aaa;
      transform: translateX(-3px);
    }

    .join-header .back-arrow-icon:active {
      transform: translateX(-5px);
    }

    .join-section-title {
      text-align: center;
      font-size: 2rem;
      margin-bottom: 10px;
      color: var(--accent-1);
    }

    .join-section-subtitle {
      text-align: center;
      color: var(--text-secondary);
      margin-bottom: 20px;
      font-size: 1rem;
    }

    .countdown-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.95);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      backdrop-filter: blur(8px);
    }

    .countdown-number {
      font-size: 15rem;
      font-weight: 700;
      color: var(--accent-1);
      text-shadow: 0 0 60px rgba(255, 204, 53, 0.5),
                   0 0 120px rgba(255, 204, 53, 0.3);
      animation: countdownPulse 1s ease-in-out;
    }

    @keyframes countdownPulse {
      0% {
        transform: scale(0.5);
        opacity: 0;
      }
      50% {
        transform: scale(1.2);
        opacity: 1;
      }
      100% {
        transform: scale(1);
        opacity: 1;
      }
    }

    @media (max-width: 768px) {
      .countdown-number {
        font-size: 10rem;
      }
    }

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 15px 30px;
  border-radius: 12px;
  box-shadow:  0 4px 6px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  transition: transform 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--danger-color);
}

.toast.success {
  background: var(--success-color);
}

/* Modal */
.modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1500;
  justify-content: center;
  align-items: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.modal.hidden {
  display: none;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-title {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--accent-1);
  text-align: center;
}

.modal-message {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 25px;
  text-align: center;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

@media (min-width: 480px) {
  .modal-buttons {
    flex-direction: row;
    justify-content: center;
  }
}

/* Card Flip Animation */
.card-container {
  perspective: 1000px;
  margin: 30px auto;
  max-width: 400px;
  width: 100%;
}

.card-container.small {
  max-width: 340px;
  margin: 24px auto;
}

.card {
  width: 100%;
  height: 280px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none; /* iOS specific */
  touch-action: manipulation; /* Prevent double-tap zoom */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

.card.flipped {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-front {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(10px);
}

#reminder-card {
  background-color: var(--bg-secondary);
  border-radius:12px;
}

.card-back {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  transform: rotateY(180deg);
}

.card-back.impostor {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

.card-content {
  text-align: center;
  width: 100%;
}

/* Vote Screen */
.vote-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vote-header {
  position: relative;
  text-align: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  flex-shrink: 0;
  width:100%;
}

.vote-header .back-arrow-icon {
  position: absolute;
  top: 20px;
  left: 0;
  width: 28px;
  height: 28px;
  color: #888;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.vote-header .back-arrow-icon:hover {
  color: #aaa;
  transform: translateX(-3px);
}

.vote-header .back-arrow-icon:active {
  transform: translateX(-5px);
}

.vote-title {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: var(--accent-1);
}

.vote-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

#votes-remaining {
  color: var(--accent-2);
  font-weight: bold;
}

.vote-players-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width:100%;
  max-height: calc(100vh - 280px);
  max-height: calc(100dvh - 280px); /* iOS Safari dynamic viewport */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* Prevent overscroll bounce affecting parent */
}

.vote-player-item {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  overflow: hidden;
  min-height: 70px;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
  touch-action: manipulation; /* Prevent double-tap zoom */
}

.vote-player-item:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.vote-player-item.voted {
  border-color: var(--accent-1);
  box-shadow: 0 0 20px rgba(255, 204, 53, 0.3);
}

.vote-player-item.disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.vote-player-bg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(41, 168, 255, 0.2), rgba(41, 168, 255, 0.05));
  transition: width 0.4s ease;
  border-radius: 12px;
}

.vote-player-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vote-player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vote-player-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.vote-player-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.vote-percentage {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--accent-2);
}

.vote-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.vote-footer {
  display: flex;
  gap: 12px;
}

.vote-footer .btn {
  flex: 1;
}

.reveal-section {
  padding: 20px;
  text-align: center;
  width:100%;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-1), #ffb700);
  color: #000;
  font-weight: bold;
  padding: 16px 32px;
  font-size: 1.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    /*transform: scale(1);*/
    box-shadow: 0 4px 20px rgba(255, 204, 53, 0.4);
  }
  50% {
    /*transform: scale(1.05);*/
    box-shadow: 0 6px 30px rgba(255, 204, 53, 0.6);
  }
}

/* Reveal Screen */
.reveal-screen {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch; 
}
.reveal-content {
  text-align: center;
  max-width: 600px;
  width: 100%;
}

.reveal-title {
  font-size: 2.5rem;
  color: var(--danger-color);
  margin-bottom: 40px;
  text-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
  animation: reveal-title-appear 0.6s ease;
}

@keyframes reveal-title-appear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.impostors-reveal {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 50px;
}

.impostor-name {
  font-size: 2rem;
  font-weight: bold;
  color: var(--danger-color);
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 12px;
  border: 2px solid var(--danger-color);
  animation: impostor-appear 0.5s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes impostor-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.word-reveal {
  margin-top: 40px;
  padding: 30px;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 2px solid var(--accent-1);
  animation: word-appear 0.8s ease 0.6s forwards;
  opacity: 0;
}

@keyframes word-appear {
  to {
    opacity: 1;
  }
}

.word-reveal-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.word-reveal-text {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--accent-1);
  text-transform: uppercase;
}

/* Result Stamp Animation */
.result-stamp {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
}

.result-stamp.show {
  animation: stamp-appear 0.8s cubic-bezier(0.36, 0, 0.66, -0.56) forwards;
}

@keyframes stamp-appear {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(-10deg);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2) rotate(5deg);
  }
  70% {
    transform: translate(-50%, -50%) scale(0.9) rotate(-3deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

.stamp-content {
  background-color: var(--bg-secondary);
  border: 8px solid;
  border-radius: 20px;
  padding: 30px 50px;
  transform: rotate(-15deg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.result-stamp.victory .stamp-content {
  border-color: var(--success-color);
  box-shadow: 0 10px 40px rgba(46, 204, 113, 0.6), 
              inset 0 0 20px rgba(46, 204, 113, 0.2);
}

.result-stamp.defeat .stamp-content {
  border-color: var(--danger-color);
  box-shadow: 0 10px 40px rgba(231, 76, 60, 0.6), 
              inset 0 0 20px rgba(231, 76, 60, 0.2);
}

.result-stamp #result-text {
  font-size: 4rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  opacity: 0.8;
}

.result-stamp.victory #result-text {
  color: var(--success-color);
  text-shadow: 0 0 30px rgba(46, 204, 113, 0.8);
}

.result-stamp.defeat #result-text {
  color: var(--danger-color);
  text-shadow: 0 0 30px rgba(231, 76, 60, 0.8);
}

@media (max-width: 768px) {
  .stamp-content {
    padding: 20px 40px;
    border-width: 6px;
  }
  
  .result-stamp #result-text {
    font-size: 3rem;
  }
}

.card-prompt {
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
  color: var(--text-primary);
}

.card-content h3 {
  font-size: 2.2rem;
  margin-bottom: 12px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  letter-spacing: -0.5px;
}

.card-content p {
  font-size: 1.1rem;
  opacity: 0.95;
  line-height: 1.5;
  margin-bottom: 8px;
}

.card-content .hint {
  font-size: 0.95rem;
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 16px;
  border-radius: 8px;
  margin-top: 12px;
  line-height: 1.4;
}
