/* CodeOmaha - Lotería · player phone page */
:root {
  --bg: #09090b;
  --panel: #18181b;
  --panel-2: #27272a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --purple: #8b5cf6;
  --purple-light: #c4b5fd;
  --grad: linear-gradient(135deg, #a78bfa, #7c3aed);
  --line: rgba(255, 255, 255, .1);
  --bad: #f87171;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: 'Outfit', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 26px; }
.logo.small { font-size: 19px; gap: 8px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.logo-text small { font-size: .45em; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.logo-text b { font-family: 'Rye', serif; font-weight: 400; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-mark { width: 1.1em; height: 1.5em; flex: none; border-radius: .14em; background: #f6eedb; border: .1em solid #1c1917; box-shadow: inset 0 0 0 .07em #f6eedb, inset 0 0 0 .13em #7c3aed; position: relative; transform: rotate(-8deg); }
.logo-mark::after { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; color: #7c3aed; font-size: .7em; }

.btn { font: inherit; font-weight: 700; font-size: 16px; color: var(--text); background: var(--panel-2); border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer; }
.btn.primary { background: var(--grad); }
.btn.big { width: 100%; padding: 16px; font-size: 18px; }
.btn:disabled { opacity: .5; }

/* ---------- join ---------- */
.screen#join { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(80% 50% at 20% 0%, #2e1065, transparent), var(--bg); }
.join-card { width: 100%; max-width: 400px; }
.join-card h1 { font-family: 'Rye', serif; font-weight: 400; font-size: 32px; margin: 28px 0 6px; }
.field { display: block; margin-top: 18px; }
.field span { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: var(--muted); }
.field input { width: 100%; font: inherit; font-size: 18px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; outline: none; }
.field input:focus { border-color: var(--purple); }
#codeInput { font-size: 28px; font-weight: 800; letter-spacing: .3em; text-align: center; }
.error { color: var(--bad); margin: 14px 0 0; }
#joinBtn { margin-top: 22px; }

/* ---------- game ---------- */
#app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.chip { font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 8px 14px; cursor: pointer; max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip b { color: var(--purple-light); }

.called { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(9, 9, 11, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.called-now { width: 62px; flex: none; }
.called-now .lcard { font-size: 1.4px; }
.called-now .lcard.flip { animation: flipIn .6s cubic-bezier(.2, .9, .3, 1.15); }
.called-now:empty { height: 87px; border-radius: 6px; border: 2px dashed var(--line); }
@keyframes flipIn { from { transform: rotateY(-95deg) scale(.85); opacity: .3; } }
.called-text { flex: 1; min-width: 0; }
.status { font-size: 13px; font-weight: 600; color: var(--purple-light); }
.status.bad { color: var(--bad); }
.called-name { font-family: 'Rye', serif; font-size: 22px; line-height: 1.15; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.called-sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.called-prev { display: flex; gap: 4px; flex: none; }
.called-prev .lcard { width: 30px; font-size: .7px; opacity: .7; }

.pattern-bar { display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.pattern-bar .picon { width: 26px; height: 26px; }
.pattern-bar b { font-size: 15px; }

.board-tools { display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; font-size: 14px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; font-weight: 700; font-size: 14px; color: var(--muted); background: none; border: 0; border-radius: 8px; padding: 6px 14px; cursor: pointer; }
.seg button.on { background: var(--grad); color: #fff; }

.boards { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; padding: 14px 16px 0; }
.board { width: 100%; max-width: 460px; }
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.board-head h3 { margin: 0; font-family: 'Rye', serif; font-weight: 400; font-size: 18px; }
.board-head button { font: inherit; font-size: 13px; font-weight: 600; color: var(--text); background: var(--panel-2); border: 0; border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; background: #1c1917; border-radius: 12px; padding: 6px; border: 1px solid #3f3f46; }
.cell { position: relative; padding: 0; border: 0; background: none; cursor: pointer; container-type: inline-size; touch-action: manipulation; }
.cell .lcard { font-size: 2px; border-width: .25em; }
.cell:disabled { cursor: default; }
.bean { position: absolute; left: 50%; top: 46%; width: 44%; aspect-ratio: 1.35; transform: translate(-50%, -50%) rotate(-18deg); border-radius: 50%; pointer-events: none;
  background: radial-gradient(60% 50% at 35% 30%, #a16207, #78350f 60%, #451a03); box-shadow: 0 2px 4px rgba(0, 0, 0, .55); animation: drop .22s ease-out; }
.bean::after { content: ''; position: absolute; left: 30%; top: 45%; width: 40%; height: 10%; border-radius: 50%; background: rgba(254, 243, 199, .55); }
@keyframes drop { from { transform: translate(-50%, -90%) rotate(-40deg) scale(1.3); opacity: 0; } }
.cell.hit .lcard { box-shadow: inset 0 0 0 .18em #f6eedb, inset 0 0 0 .32em #7c3aed, 0 0 0 3px #a78bfa, 0 0 12px #a78bfa; }

.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(9, 9, 11, .95) 35%); }
.loteria-btn { display: block; width: 100%; max-width: 460px; margin: 0 auto; font-family: 'Rye', serif; font-size: 30px; color: #fff; background: var(--grad); border: 3px solid #1c1917; border-radius: 16px; padding: 12px; cursor: pointer; box-shadow: 0 6px 0 #4c1d95, 0 10px 24px rgba(124, 58, 237, .35); transition: transform .08s; }
.loteria-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #4c1d95; }
.loteria-btn:disabled { background: var(--panel-2); color: var(--muted); box-shadow: none; font-size: 18px; font-family: 'Outfit', sans-serif; font-weight: 700; }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .6); }
.sheet { width: 100%; max-width: 480px; max-height: 85vh; overflow: auto; background: var(--panel); border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { font-family: 'Rye', serif; font-weight: 400; margin: 0 0 12px; }
.scores { list-style: none; margin: 0; padding: 0; }
.scores li { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.scores li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores li b { color: var(--purple-light); }
.scores li.me span { font-weight: 800; }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.result { text-align: center; }
.result-word { font-family: 'Rye', serif; font-size: 40px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result p { font-size: 17px; }
.result .btn { width: 100%; }

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; font-size: 15px; font-weight: 600; width: max-content; max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }

/* ---------- profile photo ---------- */
.photo-pick { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.photo-btn { position: relative; flex: none; width: 72px; height: 72px; padding: 0; border: 2px dashed #52525b; border-radius: 50%; background: var(--panel); cursor: pointer; font-size: 34px; }
.photo-btn .avatar { width: 100%; height: 100%; }
.photo-btn i { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 15px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--purple); }
.photo-btn:has(.avatar) { border-style: solid; border-color: var(--purple); }
.photo-btn #photoPreview:empty::before { content: '🙂'; opacity: .55; }
.photo-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; align-items: flex-start; }
.photo-text b { font-size: 15px; }
.link { font: inherit; font-size: 13px; font-weight: 600; color: var(--purple-light); background: none; border: 0; padding: 4px 0 0; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.chip .avatar { font-size: 12px; margin: -4px 2px -4px -6px; }
.scores li { align-items: center; }
.scores .avatar { font-size: 15px; flex: none; }
.sheet-actions { flex-wrap: wrap; }
.sheet-actions #scoresClose { margin-left: auto; }
