:root {
  --ink: #141827;
  --muted: #667085;
  --line: #e4e7ec;
  --paper: #ffffff;
  --soft: #f6f8fb;
  --blue: #2448ff;
  --blue-2: #3f7cff;
  --teal: #0f9f8f;
  --yellow: #f2c200;
  --rose: #e4486f;
  --green: #21a67a;
  --shadow: 0 18px 48px rgba(20, 24, 39, 0.12);
  --radius: 8px;
  font-family:
    Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.public-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(36, 72, 255, 0.08), transparent 32rem),
    var(--soft);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(228, 231, 236, 0.86);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand.compact {
  padding: 0 4px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--blue), #172ac7);
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-nav a {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: #344054;
  font-weight: 700;
}

.top-nav a:hover {
  background: #eef2ff;
  color: var(--blue);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #344054;
  background: white;
}

.icon-button:hover {
  border-color: #b7c0d1;
  background: #f8fafc;
}

#mobileMenuButton {
  display: none;
}

main {
  width: 100%;
}

.public-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(420px, 1fr);
  gap: 28px;
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 32px 0 48px;
  align-items: start;
}

.phone-shell {
  position: sticky;
  top: 96px;
  min-height: 584px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(180deg, rgba(23, 37, 180, 0.95), rgba(51, 127, 255, 0.94)),
    var(--blue);
  box-shadow: var(--shadow);
}

.phone-shell::before {
  content: "";
  position: absolute;
  inset: 80px 0 auto;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.phone-status {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  font-size: 12px;
  font-weight: 800;
}

.phone-status span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}

.ad-strip {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  margin: 8px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.ad-strip span {
  font-size: 12px;
  opacity: 0.86;
}

.ad-strip strong {
  max-width: 56%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-copy {
  position: relative;
  z-index: 1;
  min-height: 92px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.phone-shell .eyebrow {
  color: rgba(255, 255, 255, 0.74);
}

.game-copy h1 {
  min-height: 54px;
  margin: 0;
  font-size: 31px;
  line-height: 1.08;
}

.game-copy p:last-child {
  max-width: 34ch;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
}

.score-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.score-row div {
  min-height: 52px;
  padding: 11px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
}

.score-row span,
.score-row strong {
  display: block;
}

.score-row span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.score-row strong {
  margin-top: 5px;
  font-size: 18px;
}

.triangle-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(116px, 1fr));
  grid-template-areas:
    "paper paper"
    "rock scissors";
  gap: 10px;
  width: min(310px, 100%);
  min-height: 178px;
  margin: 0 auto;
  align-items: center;
}

.choice-paper {
  grid-area: paper;
  justify-self: center;
}

.choice-rock {
  grid-area: rock;
}

.choice-scissors {
  grid-area: scissors;
}

.choice-button {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  color: #172033;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.14);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.choice-button:hover:not(:disabled) {
  transform: translateY(-4px);
  background: white;
  box-shadow: 0 22px 36px rgba(0, 0, 0, 0.2);
}

.choice-button strong {
  font-size: 15px;
}

.choice-icon {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
}

.rock-shape {
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.7), transparent 25%),
    #cbd5e1;
}

.paper-shape {
  border: 4px solid #cbd5e1;
  border-radius: 8px;
  background:
    linear-gradient(#d9e3f1 0 0) 50% 34% / 58% 4px no-repeat,
    linear-gradient(#d9e3f1 0 0) 50% 54% / 58% 4px no-repeat,
    white;
}

.scissors-shape::before,
.scissors-shape::after {
  content: "";
  position: absolute;
  width: 42px;
  height: 8px;
  top: 19px;
  left: 2px;
  border-radius: 99px;
  background: #cbd5e1;
  transform: rotate(35deg);
}

.scissors-shape::after {
  transform: rotate(-35deg);
}

.round-result {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 8px 0;
  padding: 11px 12px;
  border-radius: 8px;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.92);
  line-height: 1.5;
}

.round-result.success {
  background: #dcfce7;
  color: #166534;
}

.round-result.danger {
  background: #ffe4e6;
  color: #9f1239;
}

.round-result.neutral {
  background: #eef2ff;
  color: #273a9f;
}

.phone-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.phone-actions .primary-button {
  grid-column: 1 / -1;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.primary-button {
  color: white;
  background: var(--blue);
}

.primary-button:hover:not(:disabled) {
  background: #1737df;
}

.secondary-button {
  border: 1px solid var(--line);
  color: #243046;
  background: white;
}

.secondary-button:hover:not(:disabled) {
  border-color: #c2cad8;
  background: #f8fafc;
}

.danger-button {
  border: 1px solid #fecdd3;
  color: #be123c;
  background: #fff1f2;
}

.danger-button:hover:not(:disabled) {
  background: #ffe4e6;
}

.text-button {
  min-height: 34px;
  padding: 6px 8px;
  color: var(--muted);
  background: transparent;
}

.text-button:hover {
  color: var(--blue);
}

.full {
  width: 100%;
}

.side-column {
  display: grid;
  gap: 16px;
}

.panel,
.admin-login-card,
.metric-card,
.ad-admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 10px 28px rgba(20, 24, 39, 0.06);
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.panel p {
  color: var(--muted);
  line-height: 1.6;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.quick-stats span {
  min-height: 64px;
  padding: 11px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}

.quick-stats b {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 22px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  color: #344054;
  background: #eef2f6;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.live {
  color: #067647;
  background: #dcfae6;
}

.status-pill.admin {
  color: #273a9f;
  background: #eef2ff;
}

.ranking-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ranking-list li.me {
  border-color: rgba(36, 72, 255, 0.42);
  background: #eef2ff;
}

.rank-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  font-weight: 900;
}

.ranking-list strong,
.ranking-list small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-list small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.reward-panel {
  border-top: 4px solid var(--yellow);
}

.inline-link {
  display: inline-flex;
  margin-top: 4px;
  color: var(--blue);
  font-weight: 900;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.switch-row span,
.search-field span {
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.field input,
.field select,
.search-field input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

.field input:focus,
.field select:focus,
.search-field input:focus,
select:focus {
  outline: 3px solid rgba(36, 72, 255, 0.16);
  border-color: var(--blue);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
}

.switch-row input {
  width: 42px;
  height: 24px;
  accent-color: var(--blue);
}

.profile-panel {
  display: grid;
  gap: 14px;
}

.modal {
  width: min(440px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.modal.wide {
  width: min(760px, calc(100% - 28px));
}

.modal::backdrop {
  background: rgba(20, 24, 39, 0.54);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.front-ad,
.result-summary {
  margin: 20px;
  padding: 20px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(36, 72, 255, 0.08), rgba(15, 159, 143, 0.08)),
    var(--soft);
}

.front-ad h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.front-ad p {
  color: var(--muted);
  line-height: 1.6;
}

.modal > .primary-button.full,
.modal > .secondary-button.full {
  width: calc(100% - 40px);
  margin: 0 20px 20px;
}

.progress-track {
  height: 8px;
  margin: 0 20px 20px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 250ms ease;
}

.result-summary {
  display: grid;
  gap: 8px;
  text-align: center;
}

.result-summary strong {
  font-size: 44px;
}

.result-summary span {
  color: var(--muted);
  font-weight: 800;
}

.admin-body {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  background: #f5f7fb;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: white;
}

.admin-nav {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #475467;
  background: transparent;
  font-weight: 900;
}

.nav-button:hover,
.nav-button.active {
  color: var(--blue);
  background: #eef2ff;
}

.admin-sidebar .secondary-button {
  margin-top: auto;
}

.admin-main {
  min-width: 0;
  padding: 24px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.admin-header-actions,
.toolbar,
.admin-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-login-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 22px;
}

.admin-login-card h2 {
  margin: 0 0 8px;
}

.admin-login-card p {
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.6;
}

.admin-content.locked {
  pointer-events: none;
  opacity: 0.42;
  filter: grayscale(0.3);
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: grid;
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 142px;
  padding: 18px;
}

.metric-card i,
.metric-card svg {
  color: var(--blue);
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card span {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.metric-card strong {
  min-height: 34px;
  margin: 6px 0;
  overflow: hidden;
  font-size: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  color: var(--muted);
  line-height: 1.4;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 12px;
  height: 260px;
  padding: 16px 8px 0;
  border-top: 1px solid var(--line);
}

.bar-item {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 10px;
  width: 100%;
  min-width: 34px;
  height: 100%;
}

.bar {
  display: block;
  min-height: 12px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--blue-2), var(--teal));
}

.bar-item small {
  overflow: hidden;
  color: var(--muted);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: center;
  min-height: 260px;
}

.donut {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 38px white;
}

.legend-list {
  display: grid;
  gap: 12px;
}

.legend-list span {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #344054;
  font-weight: 800;
}

.legend-list i {
  width: 12px;
  height: 12px;
  border-radius: 99px;
}

.toolbar {
  justify-content: space-between;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.toolbar-note {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.search-field input {
  min-height: 38px;
  padding: 0;
  border: 0;
}

.search-field input:focus {
  outline: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #475467;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: #344054;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

tr:last-child td {
  border-bottom: 0;
}

.action-cell {
  display: flex;
  gap: 6px;
}

.empty-cell,
.empty-line {
  color: var(--muted);
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.wide-row {
  grid-column: 1 / -1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 20px;
}

.detail-grid div {
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-grid strong {
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.compact-table table {
  min-width: 620px;
}

.ad-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
}

.ad-admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.ad-admin-card p {
  min-height: 50px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.ad-stake-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 12px;
  align-items: end;
}

.ad-stake-row label {
  display: grid;
  gap: 8px;
}

.ad-stake-row span {
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.ad-stake-row input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ad-stake-row strong {
  display: grid;
  min-height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #067647;
  background: #dcfae6;
}

@media (max-width: 900px) {
  .public-grid {
    grid-template-columns: 1fr;
  }

  .phone-shell {
    position: relative;
    top: auto;
    width: min(430px, 100%);
    margin: 0 auto;
  }

  .metric-grid,
  .analytics-grid,
  .ad-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 780px) {
  .topbar {
    min-height: 64px;
    padding: 0 16px;
  }

  #mobileMenuButton {
    display: inline-flex;
  }

  .top-nav {
    position: absolute;
    top: 64px;
    right: 16px;
    display: none;
    width: min(240px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
  }

  .top-nav.show {
    display: grid;
  }

  .public-grid {
    width: min(100% - 24px, 520px);
    padding-top: 18px;
  }

  .phone-shell {
    min-height: 650px;
    padding: 14px;
  }

  .choice-button {
    width: 108px;
    height: 108px;
  }

  .quick-stats,
  .score-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-body {
    display: block;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
  }

  .admin-sidebar .secondary-button {
    margin-top: 4px;
  }

  .admin-main {
    padding: 16px;
  }

  .admin-header,
  .admin-login-card {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .analytics-grid,
  .ad-admin-grid,
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .wide-row {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .brand small {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .game-copy h1 {
    min-height: 64px;
    font-size: 30px;
  }

  .triangle-board {
    grid-template-columns: repeat(2, minmax(96px, 1fr));
    gap: 12px;
    min-height: 226px;
  }

  .choice-button {
    width: 98px;
    height: 98px;
  }

  .choice-icon {
    width: 38px;
    height: 38px;
  }

  .phone-actions {
    grid-template-columns: 1fr;
  }

  .phone-actions .primary-button {
    grid-column: auto;
  }

  .quick-stats {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Public flow rewrite */
.flow-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(36, 72, 255, 0.08), transparent 360px),
    linear-gradient(90deg, rgba(15, 159, 143, 0.06), transparent 42%),
    #f5f7fb;
}

.flow-topbar {
  min-height: 72px;
  padding: 0 28px;
}

.top-nav .top-link {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #344054;
  background: transparent;
  font-weight: 700;
}

.top-nav .top-link:hover {
  background: #eef2ff;
  color: var(--blue);
}

.flow-main {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 28px 0 44px;
}

.flow-screen {
  display: none;
  min-height: calc(100vh - 144px);
  align-items: center;
}

.flow-screen.active {
  display: grid;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) 360px;
  grid-template-areas:
    "copy preview"
    "ranking preview";
  gap: 18px;
  width: 100%;
  align-items: stretch;
}

.home-copy,
.home-preview,
.flow-card,
.game-panel,
.result-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 16px 40px rgba(20, 24, 39, 0.08);
}

.home-copy {
  grid-area: copy;
  min-height: 330px;
  padding: 34px;
}

.home-copy h1,
.flow-card h1,
.game-title-row h1,
.result-hero h1 {
  margin: 0;
  max-width: 760px;
  color: var(--ink);
  font-size: 46px;
  line-height: 1.12;
}

.home-copy p,
.flow-card p,
.result-hero p {
  max-width: 68ch;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.season-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  margin-top: 26px;
  padding: 14px 16px;
  border: 1px solid #d9e1ff;
  border-radius: 8px;
  background: #eef2ff;
}

.season-strip span {
  color: var(--blue);
  font-weight: 900;
}

.season-strip strong {
  color: #344054;
  text-align: right;
}

.home-preview {
  grid-area: preview;
  display: grid;
  min-height: 560px;
  padding: 20px;
  place-items: center;
  background:
    linear-gradient(180deg, #1833d6, #2f79f4),
    var(--blue);
}

.preview-phone {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(290px, 100%);
  min-height: 510px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.preview-top,
.preview-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}

.preview-top span,
.preview-score span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 900;
}

.preview-triangle {
  position: relative;
  display: grid;
  min-height: 340px;
  place-items: center;
}

.preview-token {
  position: absolute;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 999px;
  color: #172033;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(8, 18, 76, 0.24);
}

.token-paper {
  top: 42px;
}

.token-rock {
  bottom: 50px;
  left: 26px;
}

.token-scissors {
  bottom: 50px;
  right: 26px;
}

.home-ranking {
  grid-area: ranking;
  min-height: 210px;
}

.ranking-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ranking-list.compact li {
  min-height: 54px;
}

.flow-card {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 34px;
}

.flow-card.narrow {
  width: min(520px, 100%);
  text-align: center;
}

.flow-card.narrow h1,
.flow-card.narrow p {
  margin-left: auto;
  margin-right: auto;
}

.kakao-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #1f2937;
  background: #fee500;
  font-weight: 900;
}

.centered {
  margin: 12px auto 0;
}

.ad-stage {
  display: grid;
  gap: 18px;
  width: min(820px, 100%);
}

.lose-stage {
  display: grid;
  gap: 18px;
  width: min(620px, 100%);
  text-align: center;
}

.lose-stage h1,
.lose-stage p {
  margin-left: auto;
  margin-right: auto;
}

.lose-mark {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 4px;
  place-items: center;
  border-radius: 999px;
  color: #be123c;
  background: #ffe4e6;
}

.lose-mark svg {
  width: 34px;
  height: 34px;
  stroke-width: 3;
}

.lose-score {
  display: grid;
  gap: 8px;
  min-height: 136px;
  padding: 24px;
  align-content: center;
  border-radius: 8px;
  color: white;
  background: #101828;
}

.lose-score span {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 900;
}

.lose-score strong {
  font-size: 56px;
  line-height: 1;
}

.loss-countdown {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  color: #344054;
  font-weight: 900;
}

.loss-countdown strong {
  color: var(--rose);
  font-size: 46px;
  line-height: 1;
}

.loss-track {
  width: 100%;
  height: 10px;
  margin: 0;
}

.loss-track span {
  background: var(--rose);
}

.ad-stage-copy {
  display: grid;
  gap: 4px;
}

.ad-display {
  display: grid;
  gap: 8px;
  min-height: 190px;
  padding: 24px;
  align-content: center;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(135deg, rgba(36, 72, 255, 0.94), rgba(15, 159, 143, 0.9)),
    var(--blue);
}

.ad-display span {
  width: max-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 900;
}

.ad-display strong {
  font-size: 34px;
  line-height: 1.18;
}

.ad-display p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.countdown-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-height: 82px;
}

.countdown-row strong {
  color: var(--blue);
  font-size: 68px;
  line-height: 1;
}

.countdown-row span {
  color: var(--muted);
  font-weight: 900;
}

.progress-track.large {
  height: 12px;
  margin: 0;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 360px;
  gap: 18px;
  width: 100%;
  align-items: start;
}

.game-panel {
  display: grid;
  gap: 16px;
  min-height: 650px;
  padding: 22px;
  color: white;
  background:
    linear-gradient(180deg, #1831d5, #2e7bf6),
    var(--blue);
}

.game-panel .eyebrow {
  color: rgba(255, 255, 255, 0.75);
}

.game-panel-top,
.banner-ad {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}

.game-panel-top span,
.banner-ad span {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 900;
}

.game-title-row h1 {
  color: white;
  font-size: 40px;
}

.game-title-row p:last-child {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.score-row.aligned {
  margin: 0;
}

.score-row.aligned div {
  min-height: 70px;
  background: rgba(255, 255, 255, 0.14);
}

.score-row.aligned span {
  color: rgba(255, 255, 255, 0.75);
}

.large-board {
  width: min(430px, 100%);
  min-height: 270px;
  margin: 0 auto;
}

.large-board .choice-button {
  width: 126px;
  height: 126px;
}

.large-board .choice-icon {
  width: 48px;
  height: 48px;
}

.game-side {
  display: grid;
  gap: 14px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  width: 100%;
  align-items: stretch;
}

.result-hero {
  display: grid;
  gap: 18px;
  padding: 34px;
  align-content: center;
  background:
    linear-gradient(180deg, rgba(36, 72, 255, 0.08), transparent 48%),
    white;
}

.result-score {
  display: grid;
  gap: 6px;
  min-height: 150px;
  padding: 22px;
  align-content: center;
  border-radius: 8px;
  background: #101828;
  color: white;
}

.result-score strong {
  font-size: 58px;
  line-height: 1;
}

.result-score span {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 900;
}

.result-entry-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  min-height: 82px;
  padding: 16px 18px;
  align-items: center;
  border: 1px solid #d9e1ff;
  border-radius: 8px;
  background: #eef2ff;
}

.result-entry-panel span {
  color: #344054;
  font-weight: 900;
}

.result-entry-panel strong {
  color: var(--blue);
  font-size: 30px;
  line-height: 1;
}

.result-entry-panel small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

.result-ranking {
  min-height: 560px;
}

@media (max-width: 900px) {
  .home-layout,
  .game-layout,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .home-layout {
    grid-template-areas:
      "copy"
      "preview"
      "ranking";
  }

  .home-preview {
    min-height: 480px;
  }

  .preview-phone {
    min-height: 440px;
  }
}

@media (max-width: 780px) {
  .flow-topbar {
    min-height: 64px;
    padding: 0 16px;
  }

  .top-nav .top-link {
    justify-content: flex-start;
    width: 100%;
    text-align: left;
  }

  .flow-main {
    width: min(100% - 24px, 560px);
    min-height: calc(100vh - 64px);
    padding: 18px 0 36px;
  }

  .flow-screen {
    min-height: auto;
  }

  .home-copy,
  .flow-card,
  .result-hero {
    padding: 22px;
  }

  .home-copy h1,
  .flow-card h1,
  .game-title-row h1,
  .result-hero h1 {
    font-size: 32px;
  }

  .home-copy p,
  .flow-card p,
  .result-hero p {
    font-size: 15px;
  }

  .season-strip,
  .home-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .season-strip strong {
    text-align: left;
  }

  .ranking-list.compact {
    grid-template-columns: 1fr;
  }

  .game-panel {
    min-height: auto;
    padding: 16px;
  }

  .large-board {
    min-height: 236px;
  }

  .large-board .choice-button {
    width: 108px;
    height: 108px;
  }

  .result-score strong {
    font-size: 46px;
  }
}

@media (max-width: 480px) {
  .home-copy h1,
  .flow-card h1,
  .game-title-row h1,
  .result-hero h1 {
    font-size: 28px;
  }

  .home-preview {
    min-height: 410px;
    padding: 14px;
  }

  .preview-phone {
    min-height: 380px;
  }

  .preview-triangle {
    min-height: 250px;
  }

  .preview-token {
    width: 76px;
    height: 76px;
  }

  .token-rock {
    left: 22px;
  }

  .token-scissors {
    right: 22px;
  }

  .ad-display strong {
    font-size: 26px;
  }

  .countdown-row strong {
    font-size: 54px;
  }

  .large-board {
    min-height: 216px;
  }

  .large-board .choice-button {
    width: 96px;
    height: 96px;
  }

  .score-row.aligned {
    grid-template-columns: 1fr;
  }
}

.play-phone-card {
  display: grid;
  gap: 16px;
  width: min(540px, 100%);
  min-height: 760px;
  margin: 0 auto;
  padding: 44px;
  align-content: center;
  border: 1px solid rgba(36, 72, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #2336d9 0%, #2f7df6 100%),
    var(--blue);
  box-shadow: 0 22px 54px rgba(20, 24, 39, 0.16);
}

.play-frame {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  min-height: 560px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.play-topline,
.play-best-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 78px;
  padding: 18px;
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.14);
}

.play-topline span,
.play-best-row span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  font-weight: 900;
}

.play-topline strong,
.play-best-row strong {
  color: white;
  font-size: 24px;
  font-weight: 900;
  white-space: nowrap;
}

.play-board {
  width: min(380px, 100%);
  min-height: 350px;
  margin: 0 auto;
  grid-template-columns: repeat(2, minmax(136px, 1fr));
  gap: 34px 24px;
}

.play-board .choice-button {
  width: 138px;
  height: 138px;
  color: #111827;
  background: #eef3ff;
  border: 0;
  box-shadow: 0 18px 36px rgba(13, 27, 92, 0.2);
}

.play-board .choice-button strong {
  font-size: 24px;
}

.play-board .choice-button:hover:not(:disabled) {
  transform: translateY(-5px);
  background: white;
  box-shadow: 0 24px 42px rgba(13, 27, 92, 0.26);
}

.play-board .choice-button:active:not(:disabled) {
  transform: translateY(-2px) scale(0.98);
}

.play-message {
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: 18px 20px;
  border-radius: 8px;
  color: #1d3f9f;
  background: #f1f5ff;
  font-size: 18px;
  line-height: 1.5;
}

.play-message.success {
  color: #166534;
  background: #dcfce7;
}

.play-message.danger {
  color: #9f1239;
  background: #ffe4e6;
}

.play-message.neutral {
  color: #1d3f9f;
  background: #f1f5ff;
}

@media (max-width: 780px) {
  .play-phone-card {
    width: min(100%, 420px);
    min-height: 700px;
    padding: 28px;
  }

  .play-frame {
    min-height: 540px;
    padding: 22px;
    gap: 20px;
  }

  .play-topline,
  .play-best-row {
    min-height: 66px;
    padding: 14px 16px;
  }

  .play-topline span,
  .play-best-row span {
    font-size: 16px;
  }

  .play-topline strong,
  .play-best-row strong {
    font-size: 22px;
  }

  .play-board {
    min-height: 344px;
    grid-template-columns: repeat(2, minmax(112px, 1fr));
    gap: 24px 18px;
  }

  .play-board .choice-button {
    width: 116px;
    height: 116px;
  }

  .play-board .choice-button strong {
    font-size: 21px;
  }

  .play-message {
    min-height: 60px;
    padding: 15px 16px;
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .play-phone-card {
    min-height: 650px;
    padding: 18px;
  }

  .play-frame {
    min-height: 500px;
    padding: 18px;
  }

  .play-board {
    min-height: 312px;
  }

  .play-board .choice-button {
    width: 102px;
    height: 102px;
  }
}

/* Ratio-aware game board alignment */
#gameScreen.active {
  place-items: center;
  min-height: calc(100svh - 128px);
}

.play-phone-card {
  --play-card-w: min(calc(100vw - 48px), max(370px, calc((100svh - 132px) * 0.604)), 720px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: calc(var(--play-card-w) * 0.028);
  width: var(--play-card-w);
  height: auto;
  min-height: 0;
  aspect-ratio: 9 / 14.9;
  padding: calc(var(--play-card-w) * 0.072);
  align-content: stretch;
}

.play-frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: calc(var(--play-card-w) * 0.038);
  min-height: 0;
  height: 100%;
  padding: calc(var(--play-card-w) * 0.052);
}

.play-topline,
.play-best-row {
  min-height: 0;
  height: calc(var(--play-card-w) * 0.142);
  padding: 0 calc(var(--play-card-w) * 0.04);
}

.play-board {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  height: 100%;
  margin: 0;
}

.play-board .choice-button {
  position: absolute;
  width: max(104px, calc(var(--play-card-w) * 0.22));
  max-width: 176px;
  height: max(104px, calc(var(--play-card-w) * 0.22));
  max-height: 176px;
}

.play-board .choice-paper {
  top: 11%;
  left: 50%;
  transform: translateX(-50%);
}

.play-board .choice-rock {
  bottom: 12%;
  left: 23%;
  transform: translateX(-50%);
}

.play-board .choice-scissors {
  right: 23%;
  bottom: 12%;
  transform: translateX(50%);
}

.play-board .choice-button:hover:not(:disabled) {
  transform: translateY(-5px);
}

.play-board .choice-paper:hover:not(:disabled) {
  transform: translateX(-50%) translateY(-5px);
}

.play-board .choice-rock:hover:not(:disabled) {
  transform: translateX(-50%) translateY(-5px);
}

.play-board .choice-scissors:hover:not(:disabled) {
  transform: translateX(50%) translateY(-5px);
}

.play-message {
  min-height: 0;
  height: calc(var(--play-card-w) * 0.126);
  padding: 0 calc(var(--play-card-w) * 0.038);
}

@media (max-width: 780px) {
  #gameScreen.active {
    min-height: calc(100svh - 82px);
    align-items: start;
  }

  .play-phone-card {
    --play-card-w: min(calc(100vw - 24px), calc((100svh - 92px) * 0.604), 460px);
    gap: calc(var(--play-card-w) * 0.026);
    padding: calc(var(--play-card-w) * 0.052);
  }

  .play-frame {
    padding: calc(var(--play-card-w) * 0.046);
  }

  .play-board .choice-button {
    width: max(86px, calc(var(--play-card-w) * 0.23));
    height: max(86px, calc(var(--play-card-w) * 0.23));
  }

  .play-board .choice-rock {
    left: 22%;
  }

  .play-board .choice-scissors {
    right: 22%;
  }

  .play-message {
    height: calc(var(--play-card-w) * 0.16);
  }
}
