:root {
  --lime: #c6ff33;
  --lime-soft: #e8ff9f;
  --salmon: #ff8e8e;
  --salmon-soft: #ffc4c4;
  --black: #050505;
  --white: #f7f7f7;
  --gray: #a0a0a0;
  --green-trend: #2ecc71;
  --neon-yellow: #FFFF00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
  background: var(--lime);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text',
    sans-serif;
  color: var(--black);
  transition: background 0.3s ease;
}

body.multiplayer-theme {
  --lime: #ff8e8e;       
  --lime-soft: #ffc4c4;  
  background: var(--lime);
}

.hidden { display: none !important; }

/* FX CONTAINERS */
.fx-container {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none; z-index: 9999; overflow: hidden;
}

/* PARTICLES */
.fire-particle {
  position: absolute; user-select: none;
  filter: drop-shadow(3px 3px 0 var(--black));
  animation: firePulse 0.8s infinite alternate ease-in-out;
  line-height: 1;
}
@keyframes firePulse {
  0% { transform: scale(1) rotate(-5deg); }
  100% { transform: scale(1.2) rotate(5deg); }
}
.sad-particle {
  position: absolute; user-select: none; font-size: 2.5rem;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.2));
  animation: sadFall 0.75s forwards ease-in; opacity: 1;
}
@keyframes sadFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100px) rotate(20deg); opacity: 0; }
}
.happy-particle {
  position: absolute; user-select: none; font-size: 2.5rem;
  filter: drop-shadow(2px 2px 0 rgba(255,255,255,0.5));
  animation: happyRise 1.2s forwards ease-out; opacity: 1; z-index: 10000;
}
@keyframes happyRise {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  50% { transform: translateY(-80px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-150px) scale(1); opacity: 0; }
}
.star-particle {
  position: absolute; user-select: none; font-size: 2rem;
  animation: starExplode 2s forwards ease-out; z-index: 10002;
  text-shadow: 2px 2px 0 var(--black);
}
@keyframes starExplode {
  0% { transform: translate(-50%, -50%) scale(0.5) rotate(0deg); opacity: 0; }
  20% { opacity: 1; transform: translate(var(--tx), var(--ty)) scale(1.2) rotate(180deg); }
  100% { opacity: 0; transform: translate(var(--tx-end), var(--ty-end)) scale(0.8) rotate(360deg); }
}

/* TOASTS */
.milestone-toast {
  position: fixed; top: 30%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: var(--neon-yellow); color: var(--black);
  padding: 24px 32px; border-radius: 20px;
  border: 4px solid var(--black); font-weight: 900;
  font-size: 1.2rem; text-transform: uppercase;
  box-shadow: 12px 12px 0 var(--black); z-index: 10001;
  text-align: center; transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none; max-width: 90%; line-height: 1.3;
}
.milestone-toast.visible { transform: translate(-50%, -50%) scale(1); }
.milestone-toast span { display: block; font-size: 2rem; margin-top: 8px; color: var(--black); }
.milestone-toast::after {
  content: ''; position: absolute; bottom: -14px; left: 50%;
  transform: translateX(-50%); border-width: 14px 14px 0 14px;
  border-style: solid; border-color: var(--black) transparent transparent transparent;
}
.milestone-toast::before {
  content: ''; position: absolute; bottom: -8px; left: 50%;
  transform: translateX(-50%); border-width: 10px 10px 0 10px;
  border-style: solid; border-color: var(--neon-yellow) transparent transparent transparent;
  z-index: 1;
}

/* APP LAYOUT */
.app {
  width: min(960px, 100%); background: var(--white);
  border: 4px solid var(--black); box-shadow: 12px 12px 0 var(--black);
  display: flex; flex-direction: column; overflow: hidden;
  position: relative; z-index: 1;
}
.app.menu-layout { width: min(480px, 100%); align-self: center; }

.menu-content {
  display: flex; flex-direction: column; gap: 16px;
  align-items: center; width: 100%; max-width: 400px; margin: 0 auto;
}

.menu-btn {
  width: 100%; padding: 16px; font-weight: 800; text-transform: uppercase;
  border: 4px solid var(--black); background: var(--lime); color: var(--black);
  cursor: pointer; font-size: 1.1rem; box-shadow: 6px 6px 0 var(--black);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
  letter-spacing: 0.08em; text-align: center; font-family: inherit;
}
.menu-btn:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--black); }
.menu-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: 6px 6px 0 var(--black) !important; }
.menu-btn.salmon { background: var(--salmon); }
.menu-btn.secondary { background: var(--white); }
.menu-btn.join-btn { background: var(--black); color: var(--lime); border-color: var(--black); }
body.multiplayer-theme .menu-btn.join-btn { color: var(--salmon); }
.menu-btn.back-btn { width: auto; padding: 8px 16px; font-size: 0.8rem; margin-bottom: 4px; }
.back-btn-container { width: 100%; display: flex; justify-content: flex-start; }

.menu-input {
  width: 100%; padding: 16px; border: 4px solid var(--black);
  background: var(--white); font-size: 1.1rem; font-weight: 700;
  color: var(--black); box-shadow: 4px 4px 0 var(--black);
  text-transform: uppercase; text-align: center; letter-spacing: 0.1em;
  font-family: inherit; transition: transform 0.1s, box-shadow 0.1s;
}
.menu-input:focus { outline: none; transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--black); background: var(--lime-soft); }

.menu-separator { width: 100%; height: 4px; background: var(--black); margin: 10px 0; opacity: 0.1; }
.menu-or-text { text-transform: uppercase; font-weight: 800; font-size: 0.9rem; margin: -8px 0; opacity: 0.6; }
.menu-row { display: flex; gap: 12px; width: 100%; }

/* ROOM LIST */
.room-list {
  width: 100%; display: flex; flex-direction: column; gap: 8px;
  margin-top: 20px; max-height: none; overflow-y: visible;
}
.room-row-wrapper { display: flex; width: 100%; gap: 8px; align-items: stretch; }
.room-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border: 2px solid var(--black); background: var(--white);
  box-shadow: 3px 3px 0 var(--black); cursor: pointer; transition: transform 0.1s;
  user-select: none; flex: 1; min-width: 0;
}
.room-item:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--black); }
.room-delete-btn {
  display: flex; align-items: center; justify-content: center; width: 44px;
  background: #ff8e8e; border: 2px solid var(--black);
  box-shadow: 3px 3px 0 var(--black); cursor: pointer; font-weight: 800;
  font-size: 1.1rem; transition: transform 0.1s, box-shadow 0.1s; color: var(--black);
}
.room-delete-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--black); }
.room-item-name {
  font-weight: 700; font-size: 0.9rem; display: flex; align-items: center;
  gap: 8px; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-right: 8px;
}
.room-item-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.room-item-code {
  font-family: monospace; background: var(--black); color: var(--white);
  padding: 2px 6px; font-size: 0.8rem; border-radius: 4px;
}
.star-icon { font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--gray); transition: color 0.2s, transform 0.1s; }
.star-icon:hover { transform: scale(1.1); }
.star-icon.active { color: #ffcc00; text-shadow: 1px 1px 0 var(--black); }
.edit-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; width: 24px; height: 24px; border-radius: 50%;
  cursor: pointer; opacity: 0.4; transition: opacity 0.2s, background 0.2s;
  z-index: 2; flex-shrink: 0;
}
.edit-icon-btn:hover { opacity: 1; background: rgba(0,0,0,0.1); }

/* HEADER */
.header {
  border-bottom: 4px solid var(--black); background: var(--lime-soft);
  padding: 24px 20px 32px; display: flex; flex-direction: column;
  align-items: center; gap: 16px; position: relative; transition: background 0.3s ease;
}
.header-title {
  width: 100%; display: flex; justify-content: space-between;
  align-items: center; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 0.9rem;
}
.header-left-col { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.header-badge {
  padding: 4px 10px; border-radius: 999px; border: 2px solid var(--black);
  background: var(--white); text-align: center;
}
.exit-btn-inline {
  background: var(--black); color: var(--white); border: none;
  padding: 4px 10px; font-weight: 800; font-size: 0.7rem; cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2); margin-top: 6px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.exit-btn-inline:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,0.2); }
.header-btns { display: flex; gap: 6px; align-items: center; }
#btnSound { min-width: 34px; }
.coin-panel { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; width: 100%; align-items: center; }

@media (max-width: 720px) {
  .header { padding-top: 16px; gap: 16px; padding-bottom: 20px; }
  .header-title { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-left-col { width: 100%; align-items: center; text-align: center; } 
  .coin-panel { grid-template-columns: 1fr; margin-top: 8px; gap: 16px; }
  .header-badge { font-size: 0.6rem; padding: 3px 6px; letter-spacing: 0.03em; text-align: center; }
  .coin-wrapper { margin-top: 12px; transform: translateY(21px); }
  .coin-info { text-align: left; font-size: 0.85rem; transform: translateY(11px); }
  .result-pill { transform: translateY(-3px); }
  .claim-button { transform: translateY(-3px); }
  .coin-info p { margin: 0 0 12px 0; }
}

.coin-wrapper { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.coin {
  position: relative; width: 200px; height: 200px; padding: 0;
  border: none; background: none; cursor: pointer; outline: none;
  perspective: 900px; -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease-out;
}
.coin:active:not(.flipping) { transform: translate(4px, 4px); }
.coin:focus-visible .coin-front { outline: 4px dashed var(--black); outline-offset: 6px; }
.coin.flipping { cursor: default; }
/* Hard neobrutalist shadow that stays on the "table" while the coin is in the air */
.coin-shadow {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--black); transform: translate(8px, 8px);
}
.coin-body {
  position: absolute; inset: 0; display: block;
  transform-style: preserve-3d; transform: rotateX(0deg);
}
.coin-face, .coin-edge {
  position: absolute; inset: 0; border-radius: 50%; display: block;
}
.coin-edge { background: #e0a800; border: 4px solid var(--black); }
.coin-face {
  display: flex; align-items: center; justify-content: center;
  border: 4px solid var(--black);
  background: #ffd23f;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
/* Reeded rim like a real coin */
.coin-face::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(var(--black) 0 2deg, transparent 2deg 6deg);
  -webkit-mask: radial-gradient(circle, transparent 0 85%, #000 86%);
  mask: radial-gradient(circle, transparent 0 85%, #000 86%);
}
/* Raised inner ring */
.coin-face::after {
  content: ''; position: absolute; inset: 22px; border-radius: 50%;
  border: 3px solid var(--black);
}
.coin-back { background: #d9d9d9; }
.coin-emblem {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center;
  font-size: 3.6rem; line-height: 1;
}
.coin-emblem span { filter: drop-shadow(3px 3px 0 var(--black)); }
.coin-emblem small {
  margin-top: 8px; font-size: 0.7rem; font-weight: 900; letter-spacing: 0.18em;
  color: var(--black);
}
.coin-face-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.coin-face-label.cta { animation: ctaPulse 1s ease-in-out infinite; }
@keyframes ctaPulse { 0%, 100% { opacity: 0.5; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.speech-bubble {
  position: absolute; top: -52px; left: 50%; transform: translateX(-50%);
  padding: 6px 14px; background: var(--black); color: var(--lime);
  border-radius: 999px; font-weight: 800; font-size: 1.1rem;
  box-shadow: 4px 4px 0 var(--black); border: 2px solid var(--white); white-space: nowrap;
}
.speech-bubble::after {
  content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  border-width: 6px 6px 0 6px; border-style: solid;
  border-color: var(--black) transparent transparent transparent;
}
.coin-info { font-size: 0.9rem; line-height: 1.4; }
.coin-info p { margin: 4px 0; }
.coin-info strong { text-transform: uppercase; }
.claim-button {
  margin-top: 12px; padding: 10px 24px; border-radius: 999px;
  border: 4px solid var(--black); background: var(--lime); color: var(--black);
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.8rem; cursor: pointer; box-shadow: 6px 6px 0 var(--black);
  transition: transform 120ms ease-out, box-shadow 120ms ease-out, background 120ms ease-out, opacity 120ms ease-out;
}
.claim-button:disabled { opacity: 0.4; cursor: default; box-shadow: 0 0 0 var(--black); transform: none; }
.claim-button:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--black); background: var(--white); }

.result-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  margin-top: 8px; border-radius: 999px; border: 2px solid var(--black);
  background: var(--white); font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.08em; transition: background-color 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.result-pill.highlight {
  background-color: var(--lime) !important; color: var(--white) !important;
  text-shadow: 1px 1px 0 var(--black), -1px -1px 0 var(--black), 1px -1px 0 var(--black), -1px 1px 0 var(--black);
  transform: scale(1.1); box-shadow: 4px 4px 0 var(--black); border-color: var(--black);
}
.app.multiplayer-theme .result-pill.highlight { background-color: var(--salmon) !important; }
.result-pill span { font-weight: 700; }

.main { padding: 24px 20px 28px; background: var(--white); }
.leaderboard-section {
  border-radius: 18px 18px 0 0; border: 3px solid var(--black);
  padding: 18px 16px 20px; background: #ffffff; box-shadow: 8px 8px 0 var(--black);
}

.leaderboard-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.leaderboard-header h1 { margin: 0; font-size: 1.4rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* ACTIONS CONTAINER FOR LEADERBOARD HEADER */
/* FIXED: Added height to ensure alignment */
.room-actions { display: flex; align-items: center; gap: 8px; height: 32px; }

.room-code-display {
  font-size: 0.9rem; font-weight: 800; background: var(--black); color: var(--white);
  padding: 0 12px; cursor: pointer; display: none; border: 2px solid var(--black);
  transition: transform 0.1s;
  /* FIXED: Set explicit height to match button */
  height: 32px;
  display: flex; align-items: center;
  border-radius: 4px;
  line-height: 1;
}
.room-code-display:active { transform: scale(0.95); }

/* SHARE BUTTON - FIXED: Adjusted height and flex centering */
.share-btn {
  background: #f7f7f7; color: var(--black); border: 2px solid var(--black);
  width: 32px; height: 32px; /* Increased to 32px to match text */
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 3px 3px 0 var(--black); transition: transform 0.1s, box-shadow 0.1s;
  display: none; /* Hidden by default */
  padding: 0; margin: 0;
  border-radius: 4px;
}
.share-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--black); }
.share-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* CLOSE X BUTTON FOR MODAL */
.modal-close-x {
  position: absolute; top: 12px; right: 12px;
  background: transparent; border: none; font-size: 1.5rem;
  font-weight: 800; cursor: pointer; color: var(--black);
  line-height: 1; padding: 4px; z-index: 5;
}
.modal-close-x:hover { color: #555; }

/* MODIFIED: overflow:visible to allow popovers */
.leaderboard { 
    border-radius: 12px; 
    border: 2px solid var(--black); 
    background: var(--black); /* Background for border gaps */
}
.leaderboard-row {
  display: grid; grid-template-columns: 56px minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center; padding: 8px 12px; border-bottom: 2px solid var(--black);
  font-size: 0.9rem; background: var(--white);
  position: relative; /* Context for absolute positioning if needed inside */
}
/* Ensure radius on first and last rows manually since overflow is visible */
.leaderboard-row:first-child { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.leaderboard-row:last-child { border-bottom: none; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }

.leaderboard-row:nth-child(odd) { background: #f1f1f1; }
.leaderboard-row.is-user { background: var(--lime-soft); }
.leaderboard-pos { font-weight: 800; }
.leaderboard-name { display: flex; flex-direction: row; align-items: center; gap: 6px; overflow: visible; width: 100%; }
.leaderboard-name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; flex: 0 1 auto; min-width: 0; }
.leaderboard-stats-tags { display: flex; flex-direction: row; gap: 4px; font-size: 0.65rem; flex-shrink: 0; opacity: 0.9; }
.stat-tag {
  background: var(--white); border: 1px solid var(--black); padding: 1px 5px;
  border-radius: 999px; display: flex; align-items: center; gap: 2px;
  white-space: nowrap; font-weight: 700; line-height: 1;
}
.leaderboard-score { text-align: right; font-family: 'JetBrains Mono', monospace; }
.leaderboard-tag {
  display: inline-block; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--black); font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.06em; white-space: nowrap; flex-shrink: 0;
}
.trend-icon { font-weight: 800; font-size: 0.8rem; line-height: 1; display: inline-block; opacity: 0; transition: opacity 200ms ease; flex-shrink: 0; }
.trend-icon.visible { opacity: 1; }
.trend-up { color: var(--green-trend); }
.trend-down { color: var(--black); }

/* NEW REACTION SYSTEM STYLES */
.reaction-trigger-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 18px; 
    background: #ffffff; border: 1px solid var(--black);
    cursor: pointer; font-weight: 800; font-size: 10px; line-height: 0;
    margin-left: 4px; flex-shrink: 0;
    transition: transform 0.1s, background 0.1s;
    position: relative;
}
.reaction-trigger-btn:hover { background: #f0f0f0; }
.reaction-trigger-btn:active { transform: scale(0.95); }

.reaction-popover {
    position: absolute;
    bottom: 100%; left: 50%; transform: translateX(-50%);
    margin-bottom: 8px;
    background: var(--white); border: 2px solid var(--black);
    padding: 6px; display: flex; gap: 6px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
    z-index: 9999;
    opacity: 0; pointer-events: none; transition: opacity 0.1s, transform 0.1s;
}
.reaction-popover.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
/* Arrow for popover */
.reaction-popover::after {
    content: ''; position: absolute; top: 100%; left: 50%;
    margin-left: -6px; border-width: 6px 6px 0 6px;
    border-style: solid; border-color: var(--black) transparent transparent transparent;
}

.emoji-option {
    width: 28px; height: 28px;
    background: #ffffff; border: 1px solid var(--black);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; cursor: pointer;
    transition: transform 0.1s;
}
.emoji-option:hover { transform: scale(1.1); background: var(--lime-soft); }
.emoji-option:active { transform: scale(0.95); }

@media (max-width: 600px) {
    .leaderboard-header h1 { font-size: 1.1rem; }
    .room-code-display { font-size: 0.8rem; padding: 0 8px; }
    .leaderboard-row { font-size: 0.8rem; grid-template-columns: 40px minmax(0, 1.8fr) minmax(0, 0.8fr); padding: 8px 8px; }
    .leaderboard-name-text { font-size: 0.85rem; }
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: 8px 14px; background: var(--black); color: var(--lime);
  border-radius: 999px; border: 2px solid var(--white);
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; box-shadow: 4px 4px 0 var(--black);
  opacity: 0; pointer-events: none; transition: opacity 160ms ease-out, transform 160ms ease-out;
  z-index: 10000;
}
.toast.visible { opacity: 1; transform: translate(-50%, -4px); }
.header-author { font-size: 0.65rem; font-weight: 400; text-transform: none; letter-spacing: 0; margin-top: 4px; color: var(--black); }
.social-links { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 24px; }
.social-link {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  border: 2px solid var(--black); background: #e0e0e0; color: var(--black);
  text-decoration: none; font-size: 0.65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  box-shadow: 4px 4px 0 var(--black); transition: transform 120ms ease-out, box-shadow 120ms ease-out, background 120ms ease-out;
}
.social-link:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--black); background: #d0d0d0; }
.social-link:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--black); }

/* COOKIE & MODAL */
.cookie-banner { 
    position: fixed; bottom: 10px; left: 10px; right: 10px; 
    z-index: 20000; display: flex; justify-content: center; pointer-events: none; 
}
.cookie-content { 
    pointer-events: auto; background: var(--white); 
    border: 3px solid var(--black); box-shadow: 4px 4px 0 var(--black); 
    padding: 8px 12px; max-width: 500px; width: 100%; 
    display: flex; flex-direction: row; gap: 12px; 
    align-items: center; justify-content: space-between;
}
.cookie-text { flex: 1; margin: 0; font-size: 0.75rem; line-height: 1.2; font-weight: 600; }
.cookie-buttons { display: flex; gap: 8px; }
.cookie-btn { 
    padding: 4px 10px; font-weight: 800; text-transform: uppercase; 
    border: 2px solid var(--black); cursor: pointer; font-size: 0.7rem; 
    box-shadow: 2px 2px 0 var(--black); transition: transform 0.1s, box-shadow 0.1s; 
    white-space: nowrap;
}
.cookie-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--black); }
.cookie-btn.accept { background: var(--lime); color: var(--black); }
.cookie-btn.reject { background: #ff5e5e; color: var(--black); }

.name-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(5, 5, 5, 0.6); z-index: 30000; display: flex; justify-content: center; align-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.name-modal-overlay.visible { opacity: 1; pointer-events: auto; }
.name-modal { background: var(--white); border: 4px solid var(--black); box-shadow: 12px 12px 0 var(--black); padding: 24px; max-width: 400px; width: 100%; display: flex; flex-direction: column; gap: 16px; transform: scale(0.9); transition: transform 0.2s ease; position: relative; }
.name-modal-overlay.visible .name-modal { transform: scale(1); }
.name-modal h3 { margin: 0; text-transform: uppercase; font-size: 1.2rem; font-weight: 800; letter-spacing: 0.06em; margin-right: 20px; }
.name-modal p { margin: 0; font-size: 1rem; line-height: 1.4; font-weight: 600; }
.name-modal input, .name-modal textarea { padding: 12px 16px; border: 3px solid var(--black); background: var(--white); font-size: 1rem; font-weight: 600; font-family: inherit; color: var(--black); box-shadow: 4px 4px 0 var(--black); transition: transform 0.1s, box-shadow 0.1s; letter-spacing: 0.05em; }

/* Updated textarea style: no scroll, no resize */
.name-modal textarea { resize: none; overflow: hidden; min-height: 80px; height: auto; }

.name-modal input:focus, .name-modal textarea:focus { outline: none; transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--black); background: var(--lime-soft); }
.name-modal-buttons { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* CENTERED BUTTONS CLASS */
.name-modal-buttons.centered { justify-content: center; }

.name-modal-btn { padding: 10px 20px; font-weight: 800; text-transform: uppercase; border: 3px solid var(--black); cursor: pointer; font-size: 0.85rem; box-shadow: 4px 4px 0 var(--black); transition: transform 0.1s, box-shadow 0.1s; font-family: inherit; }
.name-modal-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--black); }
.name-modal-btn.cancel { background: #e0e0e0; color: var(--black); }
.name-modal-btn.save { background: var(--lime); color: var(--black); }
.name-modal-btn.delete { background: #ff5e5e; color: var(--black); }
.name-modal-btn.share-x { background: #000000; color: #ffffff; border-color: #000000; }

@media (max-width: 600px) {
  .cookie-banner { bottom: 10px; padding: 0; max-width: 95%; left: 2.5%; right: 2.5%; }
  .menu-row { }
}

/* SEO ACCORDION */
.seo-section { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; width: 100%; }
.accordion-item { border: 3px solid var(--black); background: var(--white); box-shadow: 6px 6px 0 var(--black); transition: transform 0.1s; }
.accordion-header {
  width: 100%; padding: 16px; display: flex; justify-content: space-between;
  align-items: center; background: transparent; border: none; cursor: pointer; text-align: left; color: var(--black);
}
.accordion-header:hover { background: rgba(0,0,0,0.03); }
.accordion-title { font-family: inherit; font-weight: 800; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.05em; margin: 0; }
.accordion-icon { font-weight: 800; font-size: 1.2rem; transition: transform 0.3s ease; }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; border-top: 0px solid var(--black); }
.accordion-content-inner { padding: 0 16px 20px; font-size: 0.9rem; line-height: 1.6; color: var(--black); opacity: 0.9; }
.accordion-content-inner p, .accordion-content-inner ul { margin: 10px 0 0 0; }
.accordion-content-inner ul { padding-left: 20px; }
.accordion-content-inner li { margin-bottom: 6px; }
.accordion-item.active .accordion-icon { transform: rotate(180deg); }
.accordion-item.active .accordion-content { max-height: 500px; border-top: 3px solid var(--black); }

/* AUTH LOADING STATUS (NEW) */
.auth-status {
  position: fixed; top: 10px; right: 10px; background: var(--black);
  color: var(--neon-yellow); padding: 4px 8px; font-size: 0.7rem;
  border-radius: 4px; z-index: 20000; font-weight: bold; pointer-events: none;
  opacity: 0; transition: opacity 0.3s;
}
.auth-status.visible { opacity: 1; }
.auth-status.error { background: #ff5e5e; color: var(--black); }

/* RISK PREVIEW (what the next flip can do to the streak) */
.risk-line {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  transition: opacity 120ms ease-out;
}
.risk-line.idle { visibility: hidden; }
.risk-chip {
  padding: 4px 10px; border: 2px solid var(--black); border-radius: 999px;
  box-shadow: 2px 2px 0 var(--black); white-space: nowrap;
}
.risk-chip.heads { background: #ffd23f; }
.risk-chip.tails { background: #d9d9d9; }
.risk-line.danger .risk-chip.tails { background: var(--salmon); animation: riskShake 0.5s ease-in-out infinite; }
@keyframes riskShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }

.key-hint { display: none; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }
.key-hint kbd {
  font-family: inherit; font-weight: 800; padding: 1px 6px; background: var(--white);
  border: 2px solid var(--black); box-shadow: 2px 2px 0 var(--black);
}
@media (hover: hover) and (pointer: fine) { .key-hint { display: block; } }

/* FLIP HISTORY */
.flip-history { margin: 10px 0 12px; }
.flip-history-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; margin-bottom: 6px;
}
.flip-history-totals { font-weight: 700; letter-spacing: 0.02em; }
.flip-history-row { display: flex; gap: 5px; min-height: 30px; flex-wrap: nowrap; overflow: hidden; }
.flip-chip {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--black); box-shadow: 2px 2px 0 var(--black);
  display: flex; align-items: center; justify-content: center; font-size: 0.85rem; line-height: 1;
}
.flip-chip.cara { background: #ffd23f; }
.flip-chip.cruz { background: #d9d9d9; }
.flip-chip.canto { background: var(--neon-yellow); }
.flip-chip.new { animation: chipPop 0.3s cubic-bezier(0.3, 1.6, 0.6, 1); }
.flip-chip:nth-child(n+8) { opacity: 0.6; }
@keyframes chipPop { from { transform: scale(0); } to { transform: scale(1); } }

/* EDGE CELEBRATION */
.edge-overlay {
  position: fixed; inset: 0; z-index: 10001; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: var(--neon-yellow); overflow: hidden;
}
.edge-overlay.visible { display: flex; }
.edge-rays {
  position: absolute; left: 50%; top: 50%; width: 260vmax; height: 260vmax;
  margin: -130vmax 0 0 -130vmax; border-radius: 50%;
  background: repeating-conic-gradient(var(--black) 0 6deg, transparent 6deg 18deg);
  opacity: 0.12; animation: raysSpin 12s linear infinite;
}
@keyframes raysSpin { to { transform: rotate(360deg); } }
.edge-card {
  position: relative; background: var(--white); border: 4px solid var(--black);
  box-shadow: 12px 12px 0 var(--black); padding: 24px 28px; max-width: 380px; width: 100%;
  text-align: center; animation: edgeSlam 0.5s cubic-bezier(0.3, 1.5, 0.6, 1);
}
@keyframes edgeSlam { from { transform: scale(2.4) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
body.edge-shake .app { animation: screenShake 0.45s ease-in-out; }
@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-8px, 4px); }
  40% { transform: translate(7px, -6px); } 60% { transform: translate(-5px, -3px); } 80% { transform: translate(4px, 5px); }
}
.edge-star { font-size: 4rem; line-height: 1; filter: drop-shadow(4px 4px 0 var(--black)); animation: starBob 1s ease-in-out infinite; }
@keyframes starBob { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-8px) rotate(8deg); } }
.edge-title { font-size: 3rem; font-weight: 900; letter-spacing: 0.06em; margin-top: 8px; }
.edge-points {
  display: inline-block; margin: 8px 0; padding: 4px 16px; font-size: 2rem; font-weight: 900;
  background: var(--black); color: var(--neon-yellow); box-shadow: 4px 4px 0 var(--salmon);
}
.edge-odds { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
.edge-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  .edge-rays, .edge-star, .risk-line.danger .risk-chip.tails { animation: none; }
  body.edge-shake .app { animation: none; }
}
