/* 판 화면 (web/one.js): the same things in the same places, a game being played or over.
   A phone held upright: one fixed column — who / the board / what the AI is doing / the three moves / ⏮ ◀ ▶ ⏭ and
   깊게 보기 / the menu line. Every row has its height, so nothing moves when the AI answers.
   Wider: the board with its two lines on the left, everything else in a column the board's height on the right. */
body.onepage .foot { display: none; }
body.onepage main { max-width: none; padding-top: 10px; padding-bottom: 10px; }
.one { --ob: min(calc(100dvh - var(--hdr) - 172px), 58vw); display: grid; grid-template-columns: var(--ob) minmax(300px, 520px); gap: 0 16px; justify-content: center; align-items: start; }
.ohead { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; height: 36px; margin-bottom: 4px; white-space: nowrap; color: var(--mute); font-size: 14px; }
.obk { flex: none; width: 44px; height: 36px; padding: 0; }
.owhere { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.oleft { min-width: 0; }
.obd svg.board { border-radius: 10px; }
.ostat { display: flex; align-items: center; gap: 8px; height: 32px; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ostat #oAi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ostat #oMove { flex: none; color: var(--mute); }
.ostat .rd { color: var(--bad); } .ostat .vr { color: var(--ours); }
.ostat .oask { border: 0; background: none; padding: 0; font: inherit; color: var(--ours); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ostat .omis { flex: none; width: 56px; height: 28px; padding: 0; font-size: 12px; white-space: nowrap; position: relative; }
.ostat .omis::after { content: ""; position: absolute; inset: -8px -2px; }      /* a finger's height around a low button */
.ostat .omis[hidden] { display: none; } .ostat .omis:disabled { opacity: .4; }
.onm b[data-side] { cursor: pointer; }
.omh { margin: 12px 0 0; font-size: 12px; color: var(--mute); }
.onav { display: flex; align-items: center; gap: 6px; height: 48px; }
.onav .btn { flex: none; width: 46px; height: 44px; padding: 0; font-size: 16px; }
.onav .btn.wide { width: 76px; font-size: 14px; }
.onav #oEnd.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.oturn { flex: 1; min-width: 0; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.oturn b { font-size: 18px; } .oturn small { color: var(--mute); margin-left: 3px; }
.onav .odeep { width: 112px; font-size: 15px; font-weight: 700; margin-left: 2px; }
.onav .odeep.stop { background: var(--bad); border-color: var(--bad); }
.onav .odeep:disabled { opacity: .55; }

.oside { display: flex; flex-direction: column; gap: 8px; min-width: 0; height: calc(var(--ob) + 80px); }
.owr { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.onm { display: flex; align-items: center; min-width: 0; height: 24px; font-size: 15px; white-space: nowrap; }
.onm b { overflow: hidden; text-overflow: ellipsis; font-weight: 600; } .onm b.me { color: var(--ours); font-weight: 800; }
.onm i { font-style: normal; font-weight: 800; margin-left: 8px; font-variant-numeric: tabular-nums; }
.onm.r { justify-content: flex-end; } .onm.r i { margin: 0 8px 0 0; } .onm.r .stone { margin: 0 0 0 6px; }
.obar { grid-column: 1 / -1; position: relative; height: 22px; background: #fff; border: 1px solid #334155; border-radius: 6px; overflow: hidden; }
.obar i { position: absolute; left: 0; top: 0; bottom: 0; background: #0f172a; transition: width .3s; }
.obar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; mix-blend-mode: difference; }
.ocands { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; }
.och { height: 26px; line-height: 26px; font-size: 13px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocand { display: grid; grid-template-columns: 28px 52px 1fr auto; gap: 8px; align-items: center; height: 38px; font-size: 16px; border-top: 1px solid var(--line); white-space: nowrap; cursor: pointer; font-variant-numeric: tabular-nums; }
.ocand.none { display: block; line-height: 38px; font-size: 13px; color: var(--mute); cursor: default; overflow: hidden; text-overflow: ellipsis; }
.ocand.sel { background: var(--ours-soft); }
.ocands.stale .ocand { opacity: .35; pointer-events: none; }      /* the move before's, until this move's are read */
.ocand.chg { animation: orowchg .7s ease-out; }
@keyframes orowchg { 0% { background: #dbeafe; } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .ocand.chg { animation: none; } }
.ocand .rk { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 13px; background: #64748b; }
.ocand .rk.r0 { background: #2563eb; }
.opane { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; min-height: 0; }
.oph { display: flex; align-items: center; gap: 8px; height: 26px; font-size: 13px; }
.oph .btn { margin-left: auto; display: none; }
#oGraphP { flex: none; } #oGraphP .graph { display: block; width: 100%; height: 96px; border-radius: 6px; cursor: pointer; touch-action: pan-y; }
#oMistP { flex: 1 1 0; display: flex; flex-direction: column; }
.omist { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.omrow { display: grid; grid-template-columns: 18px 52px auto 1fr auto; gap: 8px; align-items: center; width: 100%; height: 40px; padding: 0 4px; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; font-size: 14px; text-align: left; white-space: nowrap; cursor: pointer; color: var(--ink); }
.omrow.on { background: var(--ours-soft); } .omrow:hover { background: var(--hover); }
.omrow .stone { margin: 0; }
.omnone { padding: 10px 0; }
.omenu { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.omenu .btn { height: 44px; padding: 0 4px; font-size: 14px; white-space: nowrap; }
.omenu .btn b { color: var(--bad); }
.omenu .btn.on { border-color: var(--ours); color: var(--ours); }
.omenu .btn.going { color: var(--ours); }
/* wide screens show the graph and the mistakes all the time: their two menu buttons are not needed */
.omenu [data-m="mist"], .omenu [data-m="graph"] { display: none; }
.omenu { grid-template-columns: repeat(2, 1fr); }
.omore .btn { display: flex; width: 100%; margin-top: 8px; height: 44px; justify-content: flex-start; }

@media (max-width: 720px) and (orientation: portrait) {
  body.onepage .top > :not(.tabbar) { display: none; }
  body.onepage .top { height: 0; min-height: 0; padding: 0; border: 0; }
  body.onepage main { padding: 0; }
  .one { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; bottom: var(--tabbar); z-index: 1; display: flex; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); }
  .oleft, .oside { display: contents; }
  .ohead { order: 0; flex: none; margin: 0; padding: 0 8px; height: 38px; }
  .owr { order: 1; flex: none; border: 0; border-radius: 0; padding: 4px 10px 6px; gap: 2px 12px; }
  .onm { height: 22px; font-size: 14px; } .obar { height: 18px; }
  /* 312 = the rows around the board (who 54, the state line 30, the steps 52, the menu 42, the head 38) and the three
     moves at 32 each: all three are always whole (2026-11-30: with 242 the third was hidden and the second cut) */
  .obd { order: 2; flex: none; width: min(100vw, calc(100dvh - var(--tabbar) - env(safe-area-inset-top, 0px) - 312px)); margin: 0 auto; }
  .och { display: none; }
  .ocand, .ocand.none { height: 32px; line-height: 32px; font-size: 15px; } .ocand:first-of-type, .och + .ocand { border-top: 0; }
  .oxy { display: none; }      /* a coordinate says nothing on a phone */
  .obd svg.board { border-radius: 0; }
  .ostat { order: 3; flex: none; padding: 0 10px; height: 30px; font-size: 13px; background: var(--card); border-bottom: 1px solid var(--line); }
  .ocands { order: 4; flex: 1 1 0; min-height: 0; overflow: hidden; border: 0; border-radius: 0; padding: 0 10px; }
  .onav { order: 5; flex: none; padding: 0 8px; height: 52px; background: var(--card); border-top: 1px solid var(--line); }
  .onav { gap: 5px; }
  .onav .btn { width: 42px; } .onav .btn.wide { width: 62px; font-size: 13px; }
  .onav .odeep { width: 96px; }
  .oturn { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
  .oturn b { font-size: 17px; } .oturn small { margin: 0; font-size: 11px; }
  .omenu { order: 6; flex: none; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--card); border-top: 1px solid var(--line); }
  .omenu [data-m="mist"], .omenu [data-m="graph"] { display: block; }
  .omenu .btn { height: 42px; border: 0; border-radius: 0; background: none; font-size: 13px; }
  /* 실수 · 그래프 take the place of the three moves under the board: nothing is ever laid over the board (2026-11-30,
     the user: 절대 가리면 안 되지 — the list used to cover the lower third of it), and the board does not move. The
     state line (AI 수 보기, ◀실수 실수▶), the steps and the menu stay where they are */
  #oMistP, #oGraphP { display: none; }
  .opane { order: 4; flex: 1 1 0; min-height: 0; overflow: hidden; border: 0; border-radius: 0; padding: 0 10px; position: relative; }
  .one[data-pane="mist"] .ocands, .one[data-pane="graph"] .ocands { display: none; }
  .one[data-pane="mist"] #oMistP { display: flex; }
  .one[data-pane="graph"] #oGraphP { display: block; flex: 1 1 0; }
  #oGraphP .graph { position: absolute; left: 10px; top: 30px; width: calc(100% - 20px); height: calc(100% - 34px); }
  .oph { height: 28px; font-size: 13px; } .oph .btn { display: inline-flex; height: 24px; }
  .omrow { height: 34px; }
}
/* a short phone: one move under the board, so the board keeps its size */
@media (max-width: 720px) and (orientation: portrait) and (max-height: 640px) {
  .obd { width: min(100vw, calc(100dvh - var(--tabbar) - env(safe-area-inset-top, 0px) - 248px)); }
  .ocands .ocand:nth-of-type(n+3) { display: none; }
  /* one row's room under the board: the list without its title line (실수 in the menu closes it), one mistake at a time */
  #oMistP .oph, #oGraphP .oph { display: none; } .omrow { height: 32px; border-top: 0; }
  #oGraphP .graph { top: 1px; height: calc(100% - 2px); }
  .onav .btn { width: 36px; } .onav .odeep { width: 78px; font-size: 14px; }
}

/* a phone on its side: the board as tall as the screen on the left, everything else in rows of fixed height beside it
   (2026-11-30: 라이브 판 opens this screen now, and held sideways it had a small board and a scroll) */
@media (orientation: landscape) and (max-height: 560px) {
  body.onepage .top { display: none; }
  body.onepage main { padding: 0; }
  .one { --ob: min(100dvh, calc(100vw - 306px)); position: fixed; inset: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); z-index: 1; display: grid; grid-template-columns: var(--ob) minmax(0, 1fr);
    grid-template-rows: 34px auto 26px minmax(0, 1fr) 48px 40px; gap: 0 10px; justify-content: stretch; align-items: stretch; background: var(--bg); }
  .oleft, .oside { display: contents; }
  .obd { grid-column: 1; grid-row: 1 / -1; width: var(--ob); height: var(--ob); align-self: center; }
  .obd svg.board { border-radius: 0; }
  .ohead { grid-column: 2; grid-row: 1; height: 34px; margin: 0; padding-right: 8px; }
  .obk { height: 30px; }
  .owr { grid-column: 2; grid-row: 2; border: 0; border-radius: 0; padding: 2px 8px 4px; gap: 2px 12px; margin-right: 8px; }
  .onm { height: 22px; font-size: 14px; } .obar { height: 18px; }
  .ostat { grid-column: 2; grid-row: 3; height: 26px; font-size: 13px; padding-right: 8px; }
  .ocands { grid-column: 2; grid-row: 4; min-height: 0; overflow: hidden; border: 0; border-radius: 0; padding: 0 8px; margin-right: 8px; }
  .och { height: 22px; line-height: 22px; } .ocand, .ocand.none { height: 32px; line-height: 32px; font-size: 15px; }
  .onav { grid-column: 2; grid-row: 5; height: 48px; gap: 5px; padding-right: 8px; }
  .onav .btn { width: 36px; height: 40px; } .onav .btn.wide { width: 56px; font-size: 12px; }
  .onav .odeep { width: 80px; font-size: 14px; }
  .oturn { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
  .oturn b { font-size: 16px; } .oturn small { margin: 0; font-size: 11px; }
  .omenu { grid-column: 2; grid-row: 6; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--card); border-top: 1px solid var(--line); margin-right: 8px; }
  .omenu [data-m="mist"], .omenu [data-m="graph"] { display: block; }
  .omenu .btn { height: 40px; border: 0; border-radius: 0; background: none; font-size: 13px; }
  /* 실수 · 그래프 in the place of the three moves: the names, the state line (AI 수 보기) and the steps stay in sight */
  #oMistP, #oGraphP { display: none; }
  .opane { grid-column: 2; grid-row: 4; min-height: 0; overflow: hidden; position: relative; border: 0; border-radius: 0; padding: 0 8px; margin-right: 8px; }
  .one[data-pane="mist"] .ocands, .one[data-pane="graph"] .ocands { display: none; }
  .one[data-pane="mist"] #oMistP { display: flex; }
  .one[data-pane="graph"] #oGraphP { display: block; }
  #oGraphP .graph { position: absolute; left: 8px; top: 28px; width: calc(100% - 16px); height: calc(100% - 32px); }
  .oph { height: 26px; font-size: 13px; } .oph .btn { display: inline-flex; height: 22px; }
  .omrow { height: 32px; }
}

/* a tablet held upright: the board as wide as it can be with everything else under it in fixed rows; 실수 and 그래프
   open over the lower part, as on a phone (2026-11-30: the board was 476px on an 820px screen, the lower half empty) */
@media (min-width: 721px) and (max-width: 1100px) and (orientation: portrait) {
  .one { --ob: min(calc(100vw - 48px), calc(100dvh - var(--hdr) - 470px)); grid-template-columns: var(--ob); }
  .oside { height: auto; margin-top: 8px; }
  .omenu { grid-template-columns: repeat(4, 1fr); }
  .omenu [data-m="mist"], .omenu [data-m="graph"] { display: block; }
  /* 실수 · 그래프 in the place of the three moves, at their height: the board is never covered and nothing moves */
  #oMistP, #oGraphP { display: none; }
  .opane, #oMistP, #oGraphP { flex: none; height: 154px; box-sizing: border-box; overflow: hidden; }
  .one[data-pane="mist"] .ocands, .one[data-pane="graph"] .ocands { display: none; }
  .one[data-pane="mist"] #oMistP { display: flex; }
  .one[data-pane="graph"] #oGraphP { display: block; }
  #oGraphP .graph { height: 104px; }
  .oph { height: 28px; } .oph .btn { display: inline-flex; height: 26px; }
  .omrow { height: 36px; }
}
