:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #f59e0b;
    --dark: #1f2937;
    --light: #f3f4f6;
    --success: #10b981;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    min-height: 100vh;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--accent);
    color: #111;
    padding: 0.5rem 1rem;
    z-index: 2000;
    font-weight: 700;
}

.skip-link:focus { left: 1rem; top: 1rem; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.95rem;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus { color: var(--accent); }

.breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem 0;
    font-size: 0.85rem;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    opacity: 0.8;
}

.breadcrumb li:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    opacity: 0.6;
}

.breadcrumb a { color: #c7d2fe; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coins {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.coin-icon { font-size: 1.2rem; }

.btn-premium {
    background: linear-gradient(135deg, var(--accent), #d97706);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-premium:hover,
.btn-premium:focus-visible {
    transform: scale(1.05);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.hero {
    text-align: center;
    padding: 3rem 1.5rem 2.5rem;
    max-width: 820px;
    margin: 0 auto;
}

.hero-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.hero h1 { font-size: 2.75rem; line-height: 1.15; margin-bottom: 1rem; }

.hero-lead {
    opacity: 0.9;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.hero-lead a { color: #c7d2fe; }

.hero-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.hero-cta {
    width: auto;
    min-width: 180px;
    text-decoration: none;
    display: inline-block;
}

.hero-secondary { color: #e0e7ff; font-weight: 600; }

.value-pills {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 0 1.5rem;
}

.value-pills li {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 1rem;
}

.stats span { display: block; font-size: 1.5rem; font-weight: 700; color: var(--accent); }

.ad-banner {
    max-width: 728px;
    margin: 1rem auto;
    min-height: 0;
}
.ad-banner:empty { display: none; }

.games-section,
.content-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
    scroll-margin-top: 5.5rem;
}

.games-section h2,
.content-section h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.section-intro {
    opacity: 0.8;
    margin-bottom: 1.5rem;
    max-width: 70ch;
    line-height: 1.6;
}

.section-intro a,
.content-section a,
.site-footer a { color: #c7d2fe; }

.games-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.games-toolbar input[type="search"],
.games-toolbar select {
    flex: 1;
    min-width: 160px;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.35);
    color: #fff;
    font-size: 1rem;
    min-height: 44px;
}

.games-toolbar select {
    flex: 0 1 180px;
    cursor: pointer;
}

.games-toolbar input:focus,
.games-toolbar select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}

.games-toolbar select option {
    background: #1f2937;
    color: #fff;
}

.games-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1rem;
}

.chip {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    color: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    min-height: 36px;
    cursor: pointer;
    font-weight: 600;
}

.chip:hover,
.chip:focus-visible {
    background: rgba(99, 102, 241, 0.45);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.recent-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin: 0 0 0.75rem;
}

.recent-label {
    opacity: 0.7;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.games-empty {
    text-align: center;
    padding: 2rem;
    opacity: 0.8;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px dashed rgba(255,255,255,0.2);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
}

.game-card {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    border: 2px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}

.game-card:hover,
.game-card:focus-within {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.game-card.premium { border-color: var(--accent); }

.game-preview {
    font-size: 5rem;
    margin-bottom: 1rem;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: linear-gradient(135deg, var(--accent), #d97706);
    padding: 0.25rem 0.75rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.new-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: #10b981;
    color: #042f1c;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
}

.fav-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(0,0,0,0.45);
    border: none;
    color: #fbbf24;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    font-size: 1.05rem;
}

.fav-btn:hover,
.fav-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.game-card h3 { margin-bottom: 0.5rem; font-size: 1.25rem; }

.game-card p {
    opacity: 0.8;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.45;
    min-height: 3.6em;
}

.game-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.difficulty { color: var(--success); }
.difficulty.medium { color: var(--accent); }
.difficulty.hard { color: #ef4444; }
.reward { color: #fbbf24; }

.btn-play {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.btn-play:hover,
.btn-play:focus-visible {
    background: var(--primary-dark);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.btn-play.locked {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--dark);
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    position: relative;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.modal-content.game-frame { max-width: 640px; }

.game-modal-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 0.35rem;
}

.close {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 2rem;
    cursor: pointer;
    color: white;
    background: none;
    border: none;
    line-height: 1;
    padding: 0 0.25rem;
    z-index: 2;
}

.close:hover,
.close:focus-visible { color: var(--accent); outline: none; }

#game-container {
    background: #000;
    border-radius: 8px;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 320px;
    overflow: auto;
}

#game-container:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.game-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.game-controls button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    min-height: 44px;
}

.game-controls button:hover,
.game-controls button:focus-visible {
    background: var(--primary-dark);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.coin-packages {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.package {
    background: rgba(255,255,255,0.1);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.package:hover, .package.selected {
    background: var(--primary);
    transform: scale(1.05);
}

.package.popular { border: 2px solid var(--accent); }

.package .badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

.package .amount { font-weight: 700; margin-bottom: 0.5rem; }
.package .price { color: var(--accent); font-size: 1.25rem; font-weight: 700; }

#paypal-button-container { margin-top: 1rem; }

.howto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.howto-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1.25rem;
}

.howto-card h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.howto-card p { opacity: 0.8; font-size: 0.95rem; line-height: 1.5; margin-bottom: 0.75rem; }

.btn-inline {
    background: transparent;
    color: #c7d2fe;
    border: 1px solid rgba(199, 210, 254, 0.4);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    font-weight: 600;
    min-height: 44px;
}

.btn-inline:hover,
.btn-inline:focus-visible {
    background: rgba(99, 102, 241, 0.25);
    outline: 2px solid var(--primary);
}

.faq-list details {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}

.faq-list summary { cursor: pointer; font-weight: 600; }
.faq-list details p { margin-top: 0.75rem; opacity: 0.85; line-height: 1.55; }

.disclaimer-block {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    line-height: 1.55;
}

.payment-lead { opacity: 0.7; text-align: center; margin-bottom: 0.5rem; }
.payment-disclaimer {
    opacity: 0.7;
    text-align: center;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.45;
}

.site-footer {
    text-align: center;
    padding: 2.5rem 1.5rem;
    opacity: 0.85;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.footer-brand { font-weight: 700; margin-bottom: 0.75rem; }

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.site-footer .disclaimer {
    font-size: 0.8rem;
    margin-top: 0.75rem;
    opacity: 0.65;
    max-width: 70ch;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.package.selected {
    background: var(--primary);
    border: 2px solid white;
}

@media (max-width: 768px) {
    .hero h1 { font-size: 1.85rem; }
    .stats { flex-direction: column; gap: 1rem; }
    .games-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .games-section,
    .content-section { padding: 0 1rem 2rem; }
    .coin-packages { grid-template-columns: 1fr; }
    .navbar { padding: 0.75rem 1rem; }
    .nav-links { font-size: 0.85rem; }
    .modal-content { padding: 1.25rem; width: 96%; }
    .game-preview { font-size: 3.5rem; height: 90px; }
    .btn-premium { padding: 0.55rem 1rem; font-size: 0.9rem; }
}

canvas {
    border-radius: 8px;
    display: block;
    max-width: 100%;
    height: auto;
}

.game-ui {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    font-family: monospace;
    z-index: 1;
    pointer-events: none;
}

@keyframes slideIn {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .game-card, .btn-play, .btn-premium, .package, .modal {
    transition: none !important;
  }
  .game-card:hover, .game-card:focus-within {
    transform: none;
  }
  @keyframes slideIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

.btn-premium, .nav-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.hs-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.65);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
}

.btn-random {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
  transition: background 0.2s;
}
.btn-random:hover,
.btn-random:focus-visible {
  background: var(--primary);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .btn-random {
    width: 100%;
  }
  .games-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
