/* Clash of Drinks — estilo "barra de bar": madera oscura, espuma y chapa dorada */
:root {
  --bg: #17110a;
  --surface: #211810;
  --surface-2: #2c2016;
  --border: #3d2e20;
  --text: #f6ead2;
  --muted: #b5a084;
  --faint: #7d6a52;
  --amber: #f5a524;
  --amber-deep: #c9700a;
  --on-amber: #241505;
  --danger: #ff7a59;
  --ok: #8fd18b;

  --font-display: "Cabinet Grotesk", "Arial Black", system-ui, sans-serif;
  --font-body: "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6eedf;
    --surface: #fffaf1;
    --surface-2: #efe3cf;
    --border: #e0cfb3;
    --text: #2a1c0e;
    --muted: #6f5a40;
    --faint: #9a8466;
    --amber: #e8960f;
    --amber-deep: #b45f05;
    --on-amber: #241505;
    --shadow: 0 10px 30px rgba(80, 50, 10, .15);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
img { display: block; max-width: 100%; }

.app {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 12px) 18px calc(var(--safe-bottom) + 24px);
  display: flex;
  flex-direction: column;
}

/* ---------- botones / formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 999px;
  background: var(--amber); color: var(--on-amber);
  font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  transition: transform .12s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid var(--border); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field input {
  height: 50px; padding: 0 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  outline: none;
}
.field input:focus { border-color: var(--amber); }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; text-align: center; }
.field-hint { font-size: 13px; color: var(--faint); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.list-item .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--amber); }
.list-item .li-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.list-item .li-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-txt span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 0; }

/* ---------- auth / onboarding ---------- */
.auth { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.brand h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(34px, 9vw, 44px); line-height: 1; margin: 0; letter-spacing: -.02em;
}
.brand p { margin: 0; color: var(--muted); max-width: 30ch; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 999px; padding: 4px; border: 1px solid var(--border); }
.tabs button { border: 0; background: transparent; min-height: 40px; border-radius: 999px; font-weight: 700; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.form { display: flex; flex-direction: column; gap: 14px; }
.group-forms { display: flex; flex-direction: column; gap: 18px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- barra superior ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.group-btn {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: transparent; border: 0; padding: 6px 4px; text-align: left;
}
.group-btn .name { font-family: var(--font-display); font-weight: 800; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-btn .chev { color: var(--muted); flex: none; }
.coin-chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 5px 14px 5px 5px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.coin-chip.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.15); } }

/* ---------- banner de instalación ---------- */
.install-banner {
  display: grid; grid-template-columns: 40px 1fr auto 28px; align-items: center; gap: 10px;
  margin-top: 14px; padding: 10px 6px 10px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
}
.install-banner .txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.install-banner .txt b { font-size: 15px; }
.install-banner .txt span { font-size: 13px; color: var(--muted); }
.install-banner .x { background: none; border: 0; color: var(--faint); font-size: 22px; line-height: 1; padding: 4px; }
.steps { list-style: none; counter-reset: s; margin: 6px 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.steps .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--amber); }
.note { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* ---------- contador + botón ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 0 10px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.counter {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(88px, 30vw, 132px); line-height: .95; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; margin: 6px 0 4px;
  background: linear-gradient(180deg, var(--text) 0%, var(--text) 55%, var(--amber) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.counter.tick { animation: tick .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes tick { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 100% { transform: scale(1); } }
.sub { color: var(--muted); font-size: 15px; }
.sub b { color: var(--text); }

.plus-wrap { display: grid; place-items: center; padding: 26px 0 30px; position: relative; }
.plus {
  position: relative; width: 168px; height: 168px; border: 0; padding: 0; background: transparent;
  border-radius: 50%; transition: transform .15s ease;
}
.plus svg.cap { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 14px 28px rgba(201, 112, 10, .35)); transition: transform .5s cubic-bezier(.2, 1.4, .4, 1); }
.plus:hover svg.cap { transform: rotate(14deg); }
.plus:active { transform: scale(.94); }
.plus .plus-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--on-amber); }
.plus::after {
  content: ""; position: absolute; inset: -14px; border-radius: 50%;
  border: 2px solid var(--amber); opacity: 0; animation: ring 2.6s ease-out infinite;
}
@keyframes ring { 0% { transform: scale(.85); opacity: .55; } 100% { transform: scale(1.25); opacity: 0; } }
.plus[disabled] { opacity: .6; }
.plus[disabled]::after { animation: none; }
.hint { text-align: center; color: var(--faint); font-size: 14px; margin-top: -10px; }

/* ---------- paneles ---------- */
.panel { margin-top: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 6px; }
.panel .tabs { border: 0; background: transparent; }
.panel-body { padding: 8px 10px 12px; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rank li { display: grid; grid-template-columns: 28px 40px 1fr auto; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.rank li:last-child { border-bottom: 0; }
.rank .pos { font-family: var(--font-display); font-weight: 800; color: var(--faint); text-align: center; font-size: 18px; }
.rank li:nth-child(1) .pos { color: var(--amber); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: var(--on-amber);
}
.rank .who { min-width: 0; }
.rank .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .who span { font-size: 13px; color: var(--muted); }
.rank .score { display: flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.me-tag { font-size: 11px; font-weight: 700; color: var(--amber); margin-left: 6px; text-transform: uppercase; letter-spacing: .06em; }

.feed { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shot { position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 4; border: 0; padding: 0; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot .meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 10px 8px; text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75)); color: #fff; font-size: 13px;
}
.shot .meta b { display: block; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty svg { margin: 0 auto 10px; opacity: .8; }
.more { margin-top: 10px; }

/* ---------- skeleton ---------- */
.sk { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r-sm); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- hoja inferior ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; animation: fade .2s ease; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; max-height: 88dvh; overflow: auto;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; border: 1px solid var(--border);
  padding: 10px 18px calc(var(--safe-bottom) + 22px); z-index: 41; animation: up .28s cubic-bezier(.2, .9, .3, 1);
}
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--border); margin: 4px auto 14px; }
.sheet h2 { font-family: var(--font-display); font-weight: 800; font-size: 24px; margin: 0 0 12px; }
.sheet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 22px 0 10px; }
.group-list { display: flex; flex-direction: column; gap: 8px; }
.group-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px solid transparent; text-align: left;
}
.group-item[aria-current="true"] { border-color: var(--amber); }
.group-item small { color: var(--muted); letter-spacing: .12em; }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); }
.invite .code { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: .18em; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
@keyframes up { from { transform: translate(-50%, 100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- visor de foto ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; animation: fade .2s; }
.viewer img { max-height: 76dvh; border-radius: var(--r-md); }
.viewer .cap-line { color: #fff; margin-top: 14px; text-align: center; }
.viewer .actions { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- overlays de subida y moneda ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(10, 6, 2, .78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s; }
.uploading { display: flex; flex-direction: column; align-items: center; gap: 16px; color: #f6ead2; }
.uploading img { width: 160px; height: 200px; object-fit: cover; border-radius: var(--r-md); box-shadow: var(--shadow); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(245, 165, 36, .25); border-top-color: var(--amber); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.reward { display: flex; flex-direction: column; align-items: center; text-align: center; color: #f6ead2; perspective: 800px; }
.reward .coin { width: 190px; height: 190px; animation: drop .9s cubic-bezier(.25, 1.5, .5, 1) both, flip 1.4s .2s ease-out both; }
.reward h2 { font-family: var(--font-display); font-weight: 800; font-size: 40px; margin: 18px 0 2px; color: var(--amber); animation: rise .5s .55s both; }
.reward p { margin: 0; color: #d9c7a8; animation: rise .5s .7s both; }
@keyframes drop { from { transform: translateY(-60vh) scale(.6); } }
@keyframes flip { from { transform: rotateY(0); } to { transform: rotateY(1080deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 61; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 10px; border-radius: 50%; background: #fff7e0; opacity: .9; animation: bubble linear forwards; }
@keyframes bubble { to { transform: translateY(110vh); opacity: 0; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 20px); transform: translateX(-50%);
  z-index: 70; display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px); padding: 12px 14px 12px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-weight: 500; box-shadow: var(--shadow);
  animation: rise .25s;
  width: max-content; white-space: nowrap;
}
.toast[hidden] { display: none; }
.toast button { background: transparent; border: 0; color: var(--amber-deep); font-weight: 700; padding: 4px 6px; }
@media (prefers-color-scheme: dark) { .toast button { color: var(--amber-deep); } }

.footer-links { display: flex; justify-content: center; gap: 18px; margin-top: auto; padding-top: 26px; }
.link { background: none; border: 0; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------------------------------------------------------------- foto de perfil */
img.avatar { object-fit: cover; background: var(--surface-2); }
.shot .meta img.avatar { width: 22px; height: 22px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xs { width: 22px; height: 22px; font-size: 9px; flex: none; border: 1.5px solid rgba(255, 255, 255, .85); }
.shot .meta { display: flex; align-items: center; gap: 6px; }
.shot .meta > span { min-width: 0; }
.viewer .cap-line .avatar { display: inline-grid; vertical-align: middle; margin: -3px 8px 0 0; }
.viewer img.avatar { max-height: none; border-radius: 50%; }
.profile { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; }
.avatar-edit { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; }
.avatar-edit:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.avatar-badge { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--amber); color: var(--on-amber); border: 2px solid var(--surface); }
.profile-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-info > span { font-size: 13px; color: var(--muted); }
.link-btn { align-self: flex-start; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
