/* Bottom sheets (dialogs), menu, forms and lists. */
/* Sheet shell. Two kinds (see sheet-host.js):
   - bottom sheet (default): rounded top, grab handle, dimmed overlay behind (round entry, round correction);
   - page (def.page): full-screen page with a back button, no overlay (new game, players, backup, ...). */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 50; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto;
  max-width: 560px; max-height: 92vh;
  background: var(--bg); color: var(--ink);
  border-radius: 30px 30px 0 0; z-index: 51;
  display: flex; flex-direction: column;
  box-shadow: 0 -8px 30px var(--shadow);
  outline: none;
}
.sheet::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 10px auto 0; flex-shrink: 0; }
@media (min-width: 640px) {
  .sheet { bottom: auto; top: 5vh; border-radius: 30px; max-height: 90vh; }
}
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 8px; }
.sheet-head h2 { flex: 1; margin: 0; text-align: left; font-family: var(--font-head); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; text-wrap: balance; }
.sheet-spacer { width: 0; flex-shrink: 0; }
.sheet-body { overflow-y: auto; padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 16px; -webkit-overflow-scrolling: touch; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.sheet.page { top: 0; bottom: 0; max-height: none; height: 100%; border-radius: 0; box-shadow: none; z-index: 45; padding: 0; gap: 0; } /* base.css also has a .page shell class: neutralise it here */
.sheet.page::before { display: none; }
.sheet.page .sheet-head { padding: calc(12px + env(safe-area-inset-top)) 18px 10px; }
.sheet.page .sheet-head h2 { font-size: 24px; }
.sheet.page .sheet-body { padding-top: 6px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.sheet-body > * { flex-shrink: 0; }
@media (prefers-reduced-motion: no-preference) {
  .sheet.anim { animation: sheetUp 0.22s ease-out; }
  .overlay.anim { animation: fadeIn 0.2s ease-out; }
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.icon-btn {
  width: 38px; height: 38px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px var(--shadow);
  font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: manipulation; flex-shrink: 0;
}
.icon-btn:active { background: var(--accent-soft); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }

.ico { display: block; flex-shrink: 0; }
.icon-btn, .stepper button, .menu-btn { line-height: 0; padding: 0; }

/* Page titles of the Menü / Beállítások tabs and small shared text */
.tab-title { font: 700 26px var(--font-head); letter-spacing: -0.025em; margin: 0 0 2px; }
.tab-sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin: 0 0 4px; }
.sec-title, .section-title { margin: 0; font: 700 11.5px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tab-section { margin: 12px 2px 0; }
.note { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin: 0; }
.note b { color: var(--ink); }
.help { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.45; }
.help b { color: var(--ink); }
.error { color: var(--bad); font-size: 13px; margin: 0; }
.empty-note { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 8px; margin: 0; line-height: 1.5; }
.mtag { padding: 3px 9px; border-radius: 999px; font: 600 11.5px var(--font-mono); background: var(--accent-soft); color: var(--accent); white-space: nowrap; flex-shrink: 0; }
.mtag.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.mtag.watch { background: var(--warn-soft); color: var(--warn); }

/* Menu items (.mi look of the prototype) */
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 14px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation;
  box-shadow: var(--shadow-card); font: inherit;
}
.menu-item:active { background: var(--surface-alt); }
.menu-item:disabled { opacity: 0.55; cursor: default; }
.mi-icon {
  width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mi-label { font-weight: 600; font-size: 15px; }
.mi-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-sub.wrap { white-space: normal; }
.mi-chev { color: var(--muted); display: flex; align-items: center; flex-shrink: 0; }
.menu-item.off { opacity: 0.55; }
.menu-item.static { cursor: default; }
.tab-form { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.block { display: flex; flex-direction: column; gap: 10px; }
.menu-item.static:active { background: var(--surface); }
.menu-item.is-disabled { opacity: 0.55; }
.menu-item.is-disabled .mi-label { text-decoration: line-through; color: var(--muted); }
.menu-item .chip { width: 38px; height: 38px; font-size: 14px; }
.mi-label small { font-weight: 400; color: var(--muted); }
button.small { padding: 8px 12px; font-size: 13px; border-radius: 12px; flex-shrink: 0; }

/* Account card and running games (Menü tab) */
.me-card { display: flex; align-items: center; gap: 14px; }
.me-card .grow { flex: 1; min-width: 0; }
.me-card b { font-size: 16px; display: block; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 19px var(--font-head); flex-shrink: 0; text-transform: uppercase; }
.run-list { display: flex; flex-direction: column; gap: 8px; }
.run-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-card); }
.run-item .grow { flex: 1; min-width: 0; }
.run-item b { font-size: 15px; }
.run-item small { color: var(--muted); font-size: 12px; }
.run-chips { display: flex; margin-top: 8px; }
.run-chips .chip { width: 24px; height: 24px; font-size: 10px; margin-left: -5px; box-shadow: 0 0 0 2px var(--surface); }
.run-chips .chip:first-child { margin-left: 0; }
button.sm { padding: 10px 14px; font-size: 13.5px; border-radius: 12px; border: none; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; flex-shrink: 0; touch-action: manipulation; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.field-label { font: 600 12.5px var(--font-body); color: var(--muted); }
.field-label small { font-weight: 400; }
.text-input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 13px 14px; font: 15px var(--font-body); outline: none;
}
.text-input:focus, .text-input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.text-input.mono { font-family: var(--font-mono); font-size: 12.5px; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 8px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--ink);
  font: 600 14px var(--font-body); cursor: pointer; touch-action: manipulation;
}
.pick .chip { width: 28px; height: 28px; font-size: 11px; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick .pick-check { color: var(--accent); font-weight: 700; }
.seats { display: flex; flex-direction: column; gap: 6px; }
.seat-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.seat-row .chip { width: 30px; height: 30px; }
.seat-row .player-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-no { width: 18px; font: 600 12px var(--font-mono); color: var(--muted); flex-shrink: 0; }
.dealer-btn {
  border: none; background: var(--surface-alt); color: var(--muted);
  border-radius: 999px; padding: 7px 11px; font: 600 12px var(--font-body); cursor: pointer; flex-shrink: 0; white-space: nowrap;
}
.dealer-btn.on { background: var(--accent); color: var(--accent-ink); }
.segmented { display: flex; gap: 4px; background: var(--surface-alt); padding: 4px; border-radius: 14px; }
.segmented button {
  flex: 1; border: none; background: transparent; color: var(--muted); border-radius: 10px;
  padding: 9px 4px; font: 600 13px var(--font-body); cursor: pointer; line-height: 1.2;
  display: flex; flex-direction: column; gap: 1px; align-items: center; text-align: center;
}
.segmented button small { font-weight: 500; font-size: 10.5px; opacity: 0.8; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }
.segmented button:disabled { opacity: 0.5; }
.field-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 16px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 8px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-row .field-label { font-size: 15px; font-weight: 700; color: var(--ink); display: block; }
.field-row .help { margin-top: 2px; }
.num-stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-alt); border-radius: 16px; padding: 4px; flex-shrink: 0; }
.num-stepper .icon-btn { width: 40px; height: 40px; border-radius: 12px; border: none; background: var(--surface); box-shadow: 0 1px 3px var(--shadow); }
.num-stepper output { min-width: 32px; text-align: center; font: 700 20px var(--font-mono); }
.inline-add { display: flex; gap: 8px; align-items: center; }
.inline-add .text-input { flex: 1; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg) inset; }
.swatch.auto { background: conic-gradient(var(--chip-1), var(--chip-2), var(--chip-4), var(--chip-3), var(--chip-5), var(--chip-1)); color: #fff; font: 700 10px var(--font-body); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row .field-label { font-size: 15px; font-weight: 700; color: var(--ink); display: block; }
.switch-row .help { margin-top: 2px; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--surface-alt); border: 1px solid var(--border); position: relative; cursor: pointer; flex-shrink: 0; transition: 0.2s; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: 0.2s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { left: 23px; background: #fff; }
.switch:disabled { opacity: 0.5; }
.notice { padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-size: 13.5px; line-height: 1.4; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice p { margin: 0; }
.danger-zone { border-top: 1px dashed var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.danger-zone .confirm-panel { margin-top: 0; }

/* Lists of games (archive, history) */
.list { display: flex; flex-direction: column; gap: 8px; }
.game-item {
  width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  border-radius: 18px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-card);
}
.game-item:active { background: var(--surface-alt); }
.gi-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.gi-date { font-weight: 600; }
.gi-meta { color: var(--muted); }
.gi-players { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.gi-players b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.gi-p.win { color: var(--ink); font-weight: 600; }

/* Backup / restore page */
.file-pick {
  position: relative; overflow: hidden; display: block; text-align: center;
  border: 1px dashed var(--border); border-radius: 14px; padding: 13px 14px; background: var(--surface);
  font-size: 14px; color: var(--ink); cursor: pointer;
  white-space: nowrap; text-overflow: ellipsis;
}
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.kv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 16px; box-shadow: var(--shadow-card); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

/* Login screens */
.card.auth { display: flex; flex-direction: column; gap: 14px; max-width: 420px; width: 100%; margin: 0 auto; background: transparent; border: none; box-shadow: none; padding: 30px 0 0; }
.auth-logo { font: 700 38px var(--font-head); letter-spacing: -0.03em; margin-bottom: 10px; }
.auth-logo b { color: var(--accent2); font-weight: inherit; }
.card.auth .auth-title { font: 700 26px var(--font-head); letter-spacing: -0.025em; margin: 0; }
.card.auth .auth-sub b { color: var(--ink); }
.card.auth .auth-sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin: -6px 0 0; }
.card.auth button.link { align-self: center; }
.link-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--surface-alt); }
.link-box .text-input { font-size: 12px; }
.link-box .actions button { flex: 1; }
