* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --ink: #000;
  --paper: #fff;
  --dim: #8c8c8c;
  --hairline: #dbdbdb;
}

html, body { height: 100%; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* Header */
.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 20px;
  font-weight: 800;
  font-size: 15px;
}
.header .left { justify-self: start; }
.header .center { justify-self: center; line-height: 0; }
.header .right { justify-self: end; color: var(--dim); }
.home-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
}
.home-btn svg { display: block; }
.home-btn:active { opacity: 0.5; }
.hairline { height: 1px; background: var(--hairline); }

/* Layout */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 14px;
  min-width: 0;
}
.spacer { flex: 1; }
.center { align-items: center; text-align: center; }
.scroll { flex: 1; overflow-y: auto; min-width: 0; }

/* Typography */
.display { font-weight: 900; font-size: 30px; line-height: 1.2; }
.display-lg { font-weight: 900; font-size: 40px; line-height: 1.15; }
.title { font-weight: 900; font-size: 24px; }
.heavy { font-weight: 800; }
.label { font-weight: 700; font-size: 14px; color: var(--dim); }
.tracking { letter-spacing: 3px; }
.mono { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  width: 100%;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.btn-primary { background: var(--ink); color: var(--paper); padding: 17px; }
.btn-primary:disabled { background: var(--dim); cursor: default; }
.btn-secondary {
  background: var(--paper); color: var(--ink);
  padding: 15px; border: 2.5px solid var(--ink);
}

/* Text input */
.field {
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  padding: 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
}
.field:focus { outline: none; }

/* Cards */
.card-black {
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 20px;
  font-weight: 800;
  font-size: 21px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.card-black .logo {
  margin-top: 18px;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.card-black .logo::before {
  content: ""; width: 11px; height: 11px; background: var(--paper); display: inline-block;
}

.prompt-strip {
  background: var(--ink);
  color: var(--paper);
  padding: 16px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* White card (hand) */
.hand-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.card-white {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 14px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.35;
  min-height: 96px;
  cursor: pointer;
  min-width: 0;
  overflow-wrap: anywhere;
}
.card-white.selected { background: var(--ink); color: var(--paper); }
.card-white .badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* Submission row (czar judging) */
.sub-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 16px;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
  min-width: 0;
}
.sub-row.selected { background: var(--ink); color: var(--paper); }
.sub-row .num { flex: none; }
.sub-row > span:last-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Player / score list */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
}
.row .idx { font-weight: 800; width: 22px; }
.row .name { font-weight: 700; font-size: 17px; flex: 1; }
.row .tag { font-weight: 700; font-size: 12px; color: var(--dim); }

.score-list { display: flex; flex-direction: column; }
.score-row {
  display: flex;
  align-items: center;
  padding: 11px 2px;
}
.score-row + .score-row { border-top: 1px solid var(--hairline); }
.score-row .name { font-weight: 700; font-size: 16px; flex: 1; }
.score-row .pts { font-weight: 800; font-size: 16px; }

.list-gap { display: flex; flex-direction: column; gap: 10px; }
.rule { width: 120px; height: 3px; background: var(--ink); }

.flash {
  position: fixed; inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
