:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --bg: #fff;
  --fg: #000;
  --muted: #666;
  --border: #ddd;
  --accent: #0074e4;
  --success: #4CAF50;
  --error: #ED254E;
  --highlight: #fff5ca;
  --highlight-text: #000;
  --navy: #101D42;
  --pink: #ff1493;
  --gold: #FFD700;
  
  --radius: 0.5rem;
  --max-width: 500px;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #121212;
    --fg: #fff;
    --muted: #999;
    --border: #444;
    
  }
}

:root.dark {
  --bg: #121212;
  --fg: #fff;
  --muted: #999;
  --border: #444;
}

:root.light {
  --bg: #fff;
  --fg: #000;
  --muted: #666;
  --border: #ddd;
}

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

body {
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  padding: 1.5rem 1rem;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.title {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
}

.theme-toggle {
  background: none;
  border: none;
  padding: 0.4rem;
  cursor: pointer;
  line-height: 0;
  color: var(--muted);
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--fg);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.theme-icon-dark { display: none; }
.theme-icon-light { display: inline; }

:root.dark .theme-icon-light { display: none; }
:root.dark .theme-icon-dark { display: inline; }

@media (prefers-color-scheme: dark) {
  :root:not(.light):not(.dark) .theme-icon-light { display: none; }
  :root:not(.light):not(.dark) .theme-icon-dark { display: inline; }
}

.streak-badge {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  background: #f7931e;
  color: #fff;
  border-radius: 1rem;
  font-weight: 600;
}

.puzzle-info {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  font-variant-numeric: tabular-nums;
}

.puzzle-info a {
  color: var(--accent);
  text-decoration: none;
}

.puzzle-info a:hover {
  text-decoration: underline;
}

.instructions {
  background: var(--highlight);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  color: #000;
}

.instructions p {
  margin: 0;
}

.upgrade-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
  text-align: center;
}

.upgrade-title {
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
}

.upgrade-features-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  color: var(--muted);
}

.feature-item {
  white-space: nowrap;
}

.btn-upgrade {
  background: var(--pink);
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 220px;
}

.btn-upgrade:hover {
  opacity: 0.9;
}

.upgrade-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.5rem 0 0 0;
}

.upgrade-note a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}

.upgrade-note a:hover {
  color: var(--pink);
}

.guess-section {
  margin: 1rem 0;
  text-align: center;
}

.section-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.guess-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.guess {
  font-size: 1.15rem;
  padding: 0.1rem 0;
  text-align: center;
}

.guesser {
  margin: 1.5rem 0;
  
  position: relative;
  z-index: 10;
}

.guesser input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-family: var(--sans);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  margin-bottom: 0.5rem;
  
  font-size: 16px;
}

.guesser input:focus {
  outline: none;
  border-color: var(--accent);
}

.guesser button {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.guesser button:focus {
  outline: none;
}

.error {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--error);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.win {
  background: var(--navy);
  color: #fff;
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  margin: 1.5rem 0;
}

.win h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.win > p {
  margin: 0.5rem 0;
}

.stats-basic {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-icon {
  font-size: 1.1rem;
}

.stat-value {
  font-weight: 600;
}

.premium-stats {
  margin: 1rem 0;
  background: var(--highlight);
  border-radius: var(--radius);
  color: #000;
  overflow: hidden;
}

.comparison-stats {
  padding: 1rem;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.comparison-grid.single-item {
  display: flex;
  justify-content: center;
}

.comparison-grid.single-item .comparison-item {
  min-width: 60%;
  padding: 1rem;
}

.comparison-item {
  text-align: center;
  padding: 0.5rem;
}

.comparison-item.highlight {
  font-weight: 700;
}

.comparison-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.comparison-label {
  display: block;
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.25rem;
}

.comparison-item.highlight .comparison-label {
  color: #666;
}

.comparison-diff {
  display: block;
  font-size: 0.65rem;
  margin-top: 0.2rem;
  font-weight: 600;
  white-space: nowrap;
}

.comparison-diff.better {
  color: #2d7a2f;
}

.comparison-diff.worse {
  color: #c41e3a;
}

.stats-divider {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.15);
  margin: 0;
}

.streak-stats {
  padding: 1rem;
}

.streak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.75rem;
}

.streak-item {
  text-align: center;
}

.streak-item.fire {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.streak-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #000;
}

.streak-label {
  display: block;
  font-size: 0.7rem;
  color: #666;
}

.streak-note {
  font-size: 0.75rem;
  text-align: center;
  margin: 0.75rem 0 0 0;
  color: #666;
}

.win-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  display: block;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover {
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--success);
  color: #fff;
}

.btn-primary.copied {
  background: #45a049;
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
}

.win .upgrade-box {
  margin-top: 1.5rem;
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.3);
}

.upgrade-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.preview-item.locked {
  opacity: 0.7;
}

.preview-icon {
  font-size: 1.1rem;
}

.win .upgrade-cta {
  font-weight: 600;
  text-align: center;
  margin: 1rem 0 0.75rem;
  font-size: 0.95rem;
}

.upgrade-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.win .btn-upgrade {
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  max-width: none;
  width: auto;
}

.win .btn-upgrade:hover {
  background: rgba(255,255,255,0.25);
}

.win .btn-upgrade.featured {
  background: var(--pink);
  border-color: var(--pink);
}

.save-badge {
  display: inline-block;
  font-size: 0.65rem;
  background: rgba(255,255,255,0.25);
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.upgrade-note {
  font-size: 0.75rem;
  text-align: center;
  opacity: 0.7;
  margin-top: 0.75rem;
}

.bottom-upgrade {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
}

.bottom-upgrade .upgrade-preview {
  margin-bottom: 1rem;
}

.bottom-upgrade .preview-item {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
}

.bottom-upgrade .upgrade-cta {
  font-weight: 600;
  text-align: center;
  margin: 1rem 0 0.75rem;
  font-size: 0.95rem;
}

.bottom-upgrade .btn-upgrade {
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.9rem;
  max-width: none;
  width: auto;
}

.bottom-upgrade .btn-upgrade:hover {
  background: rgba(255,255,255,0.25);
}

.bottom-upgrade .btn-upgrade.featured {
  background: var(--pink);
  border-color: var(--pink);
}

.bottom-upgrade .upgrade-note {
  color: rgba(255,255,255,0.6);
}

.bottom-upgrade .upgrade-note a {
  color: #fff;
  text-decoration: underline;
  font-weight: 600;
}

.bottom-upgrade .upgrade-note a:hover {
  color: var(--pink);
}

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-icons {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.footer-account-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.5rem;
  text-align: center;
  transition: color 0.15s;
}

.footer-account-btn:hover {
  color: var(--fg);
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.icon-btn:hover {
  opacity: 1;
}

.footer-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.footer-centered {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.footer a,
.footer span:not(.sep) {
  padding: 0 0.5rem;
}

.footer-row + .footer-row {
  margin-top: 0.5rem;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer a:hover {
  color: var(--fg);
}

.settings-modal-content {
  text-align: left;
}

.settings-modal-content h2 {
  margin-bottom: 1.5rem;
}

.settings-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.subscription-info {
  margin-bottom: 1rem;
}

.subscription-info p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.settings-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.settings-danger {
  background: rgba(220, 38, 38, 0.05);
  margin-top: 0.5rem;
  padding: 1.5rem;
  padding-bottom: 2rem;
  border-radius: 12px;
}

.logout-message {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.75rem;
}

.settings-warning {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.btn-outline {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--border);
}

.btn-full {
  width: 100%;
}

.btn-danger {
  background: #dc2626;
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  .settings-danger {
    background: rgba(220, 38, 38, 0.1);
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}

.modal h2 {
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--muted);
  margin-bottom: 1rem;
}

.modal input[type="email"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--bg);
  color: var(--fg);
}

.modal hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.login-message {
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-top: 0.75rem;
  font-size: 0.9rem;
  text-align: center;
  background: var(--highlight);
  color: #000;
}

.login-message.success {
  background: #d4edda;
  color: #155724;
}

.login-message.error {
  background: #f8d7da;
  color: #721c24;
}

.subscribe-benefits h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.benefit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.benefit-icon {
  font-size: 1.1rem;
}

.subscribe-cta {
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  text-align: center;
  font-size: 0.9rem;
}

.modal-upgrade-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.modal-upgrade-buttons .btn-upgrade {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
}

.subscribe-price {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
    padding: 1rem;
  }
  
  .comparison-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }
  
  .comparison-grid.single-item .comparison-item {
    padding: 0.75rem;
  }
  
  .comparison-item {
    padding: 0.35rem;
  }
  
  .comparison-value {
    font-size: 1rem;
  }
  
  .comparison-label {
    font-size: 0.65rem;
  }
  
  .streak-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .upgrade-buttons {
    grid-template-columns: 1fr;
  }
}

/* Very small screens - hide theme toggle to prevent header wrapping */
@media (max-width: 360px) {
  .theme-toggle {
    display: none;
  }
  
  .header-right {
    gap: 0;
  }
}

.page-content {
  padding: 1rem 0;
}

.page-content h1 {
  margin-bottom: 1.5rem;
}

.page-content h2 {
  font-size: 1.1rem;
  margin: 2rem 0 1rem;
}

.page-content p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.thankyou-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-emoji {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

.thankyou-hero h1 {
  font-size: 2rem;
  margin: 0;
}

.thankyou-message {
  margin-bottom: 2rem;
}

.thankyou-features {
  background: var(--highlight);
  color: #000;
  padding: 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.thankyou-features h2 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.feature-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.feature-icon {
  font-size: 1.1rem;
}

.btn-large {
  display: block;
  text-align: center;
  padding: 1rem 1.5rem;
  font-size: 1rem;
}

.account-info {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 1.5rem;
}

.login-prompt {
  background: var(--highlight);
  color: var(--highlight-text, #000);
  padding: 1.5rem;
  border-radius: var(--radius);
  margin: 2rem 0;
  text-align: center;
}

.login-prompt h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
}

.login-prompt p {
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
}

.login-prompt .btn {
  margin: 0;
}

.login-note {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  opacity: 0.8;
}

.login-note a {
  color: inherit;
  text-decoration: underline;
}

.faq-item {
  margin-bottom: 1.5rem;
}

.faq-item h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.faq-item p {
  margin: 0;
  color: var(--muted);
}

.changelog-entry {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.changelog-entry:last-child {
  border-bottom: none;
}

.changelog-date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.changelog-entry h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.changelog-entry ul {
  margin: 0;
  padding-left: 1.25rem;
}

.changelog-entry li {
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.badge-new {
  display: inline-block;
  font-size: 0.65rem;
  background: var(--success);
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  text-transform: uppercase;
  font-weight: 600;
}