/* 입장 화면과 공용 화면에 쓰는 색상과 간격 */
:root {
  color-scheme: dark;
  --party-ground: #10101a;
  --party-surface: #1c1b2a;
  --party-raised: #252337;
  --party-line: #413d55;
  --party-copy: #f8f4ff;
  --party-muted: #bcb6ce;
  --party-accent: #f9dc79;
  --party-select: #e0d4ff;
  --dim: var(--party-muted);
}

body {
  background: radial-gradient(ellipse at 50% 0%, #302441 0%, transparent 42rem), var(--party-ground);
  color: var(--party-copy);
}

:is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--party-accent);
  outline-offset: 3px;
}

button:disabled { cursor: default; }

.screen.entry-screen {
  max-width: 450px;
  min-height: 100dvh;
  gap: 16px;
  padding: max(22px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}

.entry-screen .logo { margin: 0; }
.entry-screen .brand-sticker {
  width: 68px;
  height: 68px;
  margin-bottom: 10px;
}
.entry-screen .logo h1 {
  font-size: clamp(1.8rem, 7vw, 2.45rem);
  line-height: 1.12;
}
.entry-screen .logo p {
  margin-top: 8px;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.entry-ticket {
  display: grid;
  gap: 13px;
  min-width: 0;
  padding: clamp(14px, 4vw, 22px);
  border: 1px solid var(--party-line);
  border-top: 2px solid var(--party-accent);
  border-radius: 20px;
  background: var(--party-surface);
  box-shadow: 0 20px 56px #08071160;
}

.entry-ticket .slot {
  background: #13121e;
  border: 1px solid var(--party-line);
  border-radius: 13px;
  padding: 10px 12px;
  text-align: center;
}

.entry-ticket .slot .lb,
.entry-ticket .field label,
.field-label {
  color: var(--party-muted);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0;
}

.entry-ticket .slot input {
  display: block;
  min-height: 48px;
  margin: 5px auto;
  padding: 4px 0 4px .45em;
  width: min(100%, 12rem);
  border: 1px solid #575170;
  border-radius: 9px;
  background: #211f30;
  font-size: 1.65rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .45em;
  text-align: center;
}

.entry-ticket input::placeholder { color: #a19ab5; opacity: 1; }
.entry-ticket input[aria-invalid="true"] { border-color: #f68da3; }
.entry-ticket .slot p {
  margin: 0;
  color: var(--party-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}
.entry-ticket .pad { gap: 6px; }
.entry-ticket .pad button {
  min-height: clamp(44px, 7dvh, 54px);
  background: var(--party-raised);
  border-color: #524b66;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.entry-ticket .pad button.fn { font-size: 0.8125rem; }
.entry-ticket .pad button:hover { background: #332b45; }
.entry-ticket .pad button:active { background: #4a3a60; }
.entry-ticket .emos {
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
}
.entry-ticket .emos button { min-height: 44px; padding: 4px 0; }
.entry-ticket .emos button[aria-pressed="true"] {
  background: #45365d;
  border-color: var(--party-select);
  transform: none;
}
.entry-screen .primary {
  background: var(--party-accent);
  border-color: var(--party-accent);
  font-size: 1rem;
}
.entry-screen .primary:disabled {
  opacity: 1;
  background: #353142;
  border-color: #49445b;
  color: #bdb6cc;
}
.entry-screen .err,
.sheet .err { margin: 0; color: #ffaac0; line-height: 1.5; }
.entry-alternate { margin: 0; text-align: center; font-size: 0.9375rem; }
.entry-alternate a { display: inline-grid; align-items: center; min-height: 44px; }

/* 모바일 게임 메뉴와 데스크톱 탐색 영역 */
.player-page {
  --dock-space: calc(67px + env(safe-area-inset-bottom, 0px));
}
html:has(.player-page #app:not(.hidden)) {
  scroll-padding-block: calc(80px + env(safe-area-inset-top, 0px)) calc(67px + env(safe-area-inset-bottom, 0px));
}
.player-page .wrap { max-width: 580px; padding: 0 14px var(--dock-space); }
.player-page .top {
  gap: 12px;
  min-height: 66px;
  margin: 0 -14px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: #141320f5;
  border-color: var(--party-line);
}
.player-brand { display: flex; align-items: center; gap: 8px; font-weight: 850; }
.player-page .player-brand .brand-inline { width: 34px; height: 34px; transform: none; }
.player-page .top .me { padding-left: 0; border: 0; gap: 6px; }
.player-page .me .av { font-size: 1.3rem; }
.player-page .me .nm { font-size: .875rem; max-width: min(22vw, 11rem); }
.player-page .chips {
  display: grid;
  gap: 2px;
  padding: 5px 10px;
  border: 1px solid var(--party-line);
  border-radius: 11px;
  background: #211d2d;
}
.player-page .chips b { color: var(--party-accent); font-size: 1.18rem; }
.player-page .chips span { font-size: .75rem; }
.player-main { min-width: 0; padding-top: 19px; }
.player-main > h1 {
  display: inline-block;
  margin: 0 0 14px;
  font-size: clamp(1.4rem, 5vw, 1.95rem);
  letter-spacing: -.045em;
  line-height: 1.16;
}
.player-main > h1:focus { outline: none; }
.player-page .tabs {
  position: fixed;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  z-index: 40;
  gap: 2px;
  margin: 0;
  padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  background: #181624;
  border: 0;
  border-top: 1px solid var(--party-line);
  border-radius: 0;
}
.player-page .tabs button[data-tab] {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  grid-column: auto;
  gap: 3px;
  min-height: 52px;
  padding: 4px 0;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--party-muted);
  font-size: .75rem;
  line-height: 1.2;
}
.player-page .tabs button:hover { background: #28243a; }
.player-page .tabs button[aria-pressed="true"] {
  color: var(--party-select);
  background: #3a304e;
  border-color: #796695;
}
.player-page .tabs button:focus-visible { outline-offset: -2px; }
.player-page .tabs .ui-icon { width: 20px; height: 20px; }
.player-page .tabs .nav-full { display: none; }
.player-page .tabs .cnt {
  position: absolute;
  top: 2px;
  right: 1px;
  margin: 0;
  padding: 1px 5px;
  background: #74426f;
  border: 1px solid #bb82b4;
}
.player-main :is(.tmore, .tamt button, .tmine .c, #btnClear) { min-height: 44px; }
.player-page .banner {
  border-radius: 15px;
  border-color: var(--party-line);
  background: var(--party-surface);
}
.round-banner { align-items: center; gap: 12px; }
.round-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  height: 42px;
  border: 1px solid #62537d;
  border-radius: 11px;
  background: #332743;
  color: var(--party-select);
}
.round-copy { flex: 1; min-width: 0; }
.round-copy .s { margin-top: 3px; font-size: .875rem; line-height: 1.45; }
.round-copy .s:empty { display: none; }
.player-main #bBar { margin: -4px 0 12px; }
#manitoNotice { flex-wrap: wrap; }
#manitoOpen { min-height: 44px; }
.totogate .field-label { display: block; margin: 0 0 8px; text-align: left; }
.player-page .toast {
  bottom: calc(var(--dock-space) + 8px);
  width: max-content;
  max-width: calc(100vw - 24px);
  text-align: center;
  animation: none;
}
.player-page:has(#app:not(.hidden)) #networkStatus {
  bottom: calc(var(--dock-space) + 10px) !important;
}

.sheet:not([open]) { display: none; }
.sheet[open] {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--party-copy);
}
.sheet::backdrop { background: #08061175; }
.sheet .in {
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--party-surface);
  border-color: #615578;
}
.sheet .pick { margin-top: 3px; }
.sheet .err:empty { display: none; }
.sheet .err:not(:empty) { margin-bottom: 12px; }
.sheet .primary:not(:disabled) { background: var(--party-accent); box-shadow: none; }
.sheet .qgrid button { min-height: 44px; }
.sheet .sheet-payout b { overflow-wrap: anywhere; }

@media (min-width: 780px) {
  .player-page { --dock-space: 24px; }
  html:has(.player-page #app:not(.hidden)) { scroll-padding-bottom: 24px; }
  .player-page .wrap { max-width: 875px; padding-inline: 22px; }
  .player-page .top { margin: 0 -22px; padding-inline: 22px; }
  .player-page .top .me { margin-left: auto; }
  .player-page .chips { margin-left: 0; min-width: 94px; }
  .player-layout { display: grid; grid-template-columns: 185px minmax(0, 1fr); gap: 20px; align-items: start; }
  .player-page .tabs {
    position: sticky;
    inset: 85px auto auto;
    grid-template-columns: 1fr;
    margin-top: 19px;
    padding: 6px;
    border: 1px solid var(--party-line);
    border-radius: 14px;
  }
  .player-page .tabs button[data-tab] {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    min-height: 45px;
    padding: 7px 10px;
    font-size: .875rem;
  }
  .player-page .tabs .nav-label { display: none; }
  .player-page .tabs .nav-full { display: inline; }
  .player-page .tabs .cnt { position: static; margin-left: auto; }
}
@media (max-width: 479px) { .player-brand span { display: none; } }
@media (max-width: 299px), (max-height: 320px) {
  .player-page { --dock-space: 20px; }
  html:has(.player-page #app:not(.hidden)) { scroll-padding-bottom: 20px; }
  .player-page .tabs {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 8px;
    border: 1px solid var(--party-line);
    border-radius: 10px;
  }
}

/* 진행자 화면에서는 주소와 라운드 상태를 멀리서도 읽을 수 있게 한다. */
.host-screen { background: var(--party-ground); }
.host-screen .host-header,
.host-screen .main > .panel,
.host-screen .side > .panel,
.host-screen .host-tools {
  border-color: var(--party-line);
  background: var(--party-surface);
}
.host-screen .host-header h1 { background: none; color: var(--party-copy); }
.host-screen .joinbox .url { overflow-wrap: anywhere; color: var(--party-accent); }
.host-screen .host-join-label { font-size: .8125rem; line-height: 1.4; }
.host-screen .host-tools-toggle, .host-screen .host-nav button { min-height: 44px; }
.host-screen .host-nav button[aria-pressed="true"] { background: var(--party-select); }
.host-screen .host-status { gap: 10px; }
.host-screen .host-status .phase { color: var(--party-copy); }
.host-screen .host-tools .ctrl button { min-height: 44px; }
@media (max-width: 720px) {
  .host-screen .host-header .joinbox {
    max-width: 100%;
    width: 100%;
    justify-content: space-between;
  }
  .host-screen .host-nav button { padding-inline: 9px; }
}

/* 관리자 메뉴와 표의 스캔, 좁은 화면의 폼 사용성을 높인다. */
.admin-workspace { --admin-surface: var(--party-surface); --admin-divider: var(--party-line); }
.admin-workspace .admin-tabs [role="tab"] { min-height: 44px; font-size: .875rem; }
.admin-workspace .admin-tabs [aria-selected="true"] {
  background: #3c3050;
  border-color: #77648f;
  color: var(--party-select);
}
.admin-workspace .admin-header .sp .btn, .admin-workspace .btn.go { min-height: 44px; }
.admin-workspace .btn.go { background: var(--party-accent); }
.admin-workspace .stat2 u,
.admin-workspace .tbl th { font-size: .8125rem; }
.admin-workspace form label { line-height: 1.4; }
.admin-workspace .admin-table-wrap {
  border: 1px solid var(--party-line);
  border-radius: 12px;
  scrollbar-color: #77648f #181624;
}
.admin-workspace .tbl tbody tr:nth-child(even) td { background: #ffffff05; }
@media (max-width: 480px) {
  .admin-workspace .admin-header .sp { flex-wrap: wrap; }
  .admin-workspace :is(input, select, textarea) { font-size: 1rem; min-width: 0; }
  .admin-workspace .tbl td input { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .entry-screen .shake, .sheet .in, .timer.hot, .clock .num.hot,
  .lookup .e, .host-screen .rnum .disc::after { animation: none; }
}
