@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

/* ══════════════════════════════════════════════════════════════
   킹수학 메이킹 — 허브 스타일

   교실 조명 아래 전자칠판에 띄우는 화면이라 밝은 바탕으로 둔다.
   장식(글로우·그라데이션·이모지)은 쓰지 않고, 강조는 색 하나와
   여백·굵기로만 준다.

   본문은 --page 폭(1000px)으로 묶는다. 다만 게임을 고르는 창은
   전자칠판의 넓은 가로를 살려 더 넓게 쓴다.
   ══════════════════════════════════════════════════════════════ */

:root {
  --page: 1000px;            /* 본문 최대 폭 */
  --launcher: 1120px;        /* 게임 고르기 창 폭 — 5개를 가로로 놓는다 */

  --bg:            #e3e7ee;  /* 페이지 바탕 */
  --bg-raise:      #f4f6f9;  /* 카드 · 패널 (순백은 눈이 부셔 한 단계 낮춘다) */
  --bg-sunk:       #e9ecf2;  /* 표 머리 · 우묵한 영역 */
  --bg-field:      #fcfcfd;  /* 입력칸 */
  --bg-hover:      #eceff4;

  --line:          #d6dbe4;
  --line-soft:     #e3e7ed;
  --line-strong:   #b9c0cc;

  --ink:           #1a1e26;
  --ink-2:         #4c5462;
  --ink-3:         #7b8494;

  --ink-accent:    #4a5ad9;
  --ink-accent-2:  #3d4cc4;
  --accent-soft:   #eef0fd;

  --ok:            #1c8a55;
  --warn:          #a76a13;
  --danger:        #c8443c;

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 14px;

  --pad:  clamp(16px, 3vw, 28px);

  --shadow-sm: 0 1px 2px rgba(20, 26, 40, .05);
  --shadow-md: 0 2px 10px rgba(20, 26, 40, .07);
  --shadow-lg: 0 18px 48px rgba(20, 26, 40, .18);
}

/* 과목 색 — 밝은 바탕에서 읽히도록 톤을 낮춘다 */
[data-sub="수학"] { --sub: #2f66b5; }
[data-sub="국어"] { --sub: #1f7a5a; }
[data-sub="사회"] { --sub: #a06a18; }
[data-sub="과학"] { --sub: #1c7686; }
[data-sub="영어"] { --sub: #71499f; }
[data-sub="음악"] { --sub: #a3437a; }
[data-sub="미술"] { --sub: #b04a4a; }
[data-sub="체육"] { --sub: #5a7c24; }
[data-sub="도덕"] { --sub: #1b7d74; }
[data-sub="실과"] { --sub: #8c7015; }
[data-sub="창체"] { --sub: #5f5ab0; }
[data-sub="기타"], [data-sub="all"] { --sub: #66708a; }

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 속성이 항상 이긴다.
   .icon-btn{display:grid} 처럼 display 를 지정한 규칙이 UA 의 [hidden] 을
   덮어써서, 숨겼다고 생각한 요소가 그대로 보이는 일을 막는다. */
[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #bcc4d1; border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #a4adbd; }

:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 2px; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* 본문 폭을 한 군데서 묶는다 */
.wrap { width: 100%; max-width: var(--page); margin: 0 auto; }

/* 아이콘 — 선 굵기를 통일해 픽토그램처럼 보이게 한다 */
.ic {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-lg { width: 26px; height: 26px; stroke-width: 1.5; }

/* ───────────────────────────── 헤더 ───────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(244, 246, 249, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-in {
  display: flex; align-items: center; gap: 16px;
  padding: 11px var(--pad);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 0;
  cursor: pointer; color: inherit; text-align: left;
  font-family: inherit; text-decoration: none;
}

.brand-mark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--ink-accent);
  font-size: 17px; font-weight: 800; letter-spacing: 0.02em;
  color: #fff;
}

/* 프로그램 이름은 화면에서 가장 큰 글자다 — 멀리서도 먼저 읽히게 */
.brand-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.brand-text strong {
  font-size: 21px; font-weight: 800; letter-spacing: -0.035em;
  color: var(--ink);
}
.brand-text span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; letter-spacing: -0.01em; }

.topbar-search {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: var(--bg-sunk);
  border: 1px solid transparent;
  border-radius: var(--r);
  transition: border-color .14s, background .14s;
}
.topbar-search:focus-within { background: var(--bg-field); border-color: var(--line-strong); }
.topbar-search .ic { color: var(--ink-3); }
.topbar-search input {
  flex: 1; min-width: 0; height: 36px;
  background: none; border: 0; outline: none;
  color: var(--ink); font: inherit; font-size: 13.5px;
}
.topbar-search input::placeholder { color: var(--ink-3); }

.topbar-actions { display: flex; align-items: center; gap: 7px; }

.site-link {
  padding: 0 4px;
  color: var(--ink-3); font-size: 12.5px; font-weight: 650;
  text-decoration: none; white-space: nowrap;
  transition: color .14s;
}
.site-link:hover { color: var(--ink); text-decoration: underline; }

/* ───────────────────────────── 버튼 ───────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 37px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r);
  font: inherit; font-size: 13.5px; font-weight: 650;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
}
.btn:disabled { opacity: .5; cursor: default; }

.btn-solid  { background: var(--ink-accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-solid:hover:not(:disabled) { background: var(--ink-accent-2); }

.btn-quiet  { background: var(--bg-raise); color: var(--ink-2); border-color: var(--line); }
.btn-quiet:hover:not(:disabled) { background: var(--bg-hover); color: var(--ink); border-color: var(--line-strong); }

.btn-plain  { background: none; color: var(--ink-3); }
.btn-plain:hover:not(:disabled) { color: var(--ink); background: var(--bg-sunk); }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.btn-sm .ic { width: 14px; height: 14px; }

.icon-btn {
  display: grid; place-items: center;
  width: 33px; height: 33px; flex: none;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--ink-3); cursor: pointer; text-decoration: none;
  transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--ink); }
.icon-btn-sm { width: 28px; height: 28px; }
.icon-btn-sm .ic { width: 15px; height: 15px; }

/* ─────────────────────────── 과목 · 학년 메뉴 ─────────────────────────── */

.subject-nav {
  /* --topbar-h 는 hub.js 가 헤더를 재서 넣는다. 값이 없으면 아래 기본값을 쓴다. */
  position: sticky; top: var(--topbar-h, 66px); z-index: 30;
  background: rgba(244, 246, 249, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.subject-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--pad);
}
.subject-tabs {
  display: flex; gap: 2px;
  flex: 1; min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.subject-tabs::-webkit-scrollbar { display: none; }

/* 과목 · 학년 줄 왼쪽 머리글 */
.bar-label {
  flex: none;
  font-size: 12px; font-weight: 700; color: var(--ink-3);
}

.subject-tab {
  padding: 10px 12px 9px;
  background: none; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-3); font: inherit; font-size: 13.5px; font-weight: 620;
  white-space: nowrap; cursor: pointer;
  transition: color .14s, border-color .14s;
}
.subject-tab:hover { color: var(--ink-2); }
.subject-tab .tab-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.subject-tab.is-on { color: var(--ink); border-bottom-color: var(--sub, var(--ink-accent)); }

/* 학년 — 과목(전체) 바로 아래 줄 */
.grade-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px var(--pad);
  border-top: 1px solid var(--line-soft);
  background: var(--bg-sunk);
}
.bar-sort { margin-left: auto; }

/* ─────────────────────────── 본문 ─────────────────────────── */

.main { flex: 1; padding: 22px var(--pad) 72px; }

.view { display: none; }
.view.is-active { display: block; animation: rise .18s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ─────────────────────────── 필터 칩 · 정렬 ─────────────────────────── */

.chips { display: flex; gap: 5px; flex-wrap: wrap; }

.chip {
  height: 28px; padding: 0 11px;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-3); font: inherit; font-size: 12.5px; font-weight: 620;
  cursor: pointer; transition: all .14s;
}
.chip:hover { color: var(--ink-2); border-color: var(--line-strong); }
.chip.is-on {
  background: var(--ink-accent); border-color: var(--ink-accent); color: #fff;
}

.select-wrap { display: flex; align-items: center; gap: 7px; }
.select-wrap > span { font-size: 12px; font-weight: 700; color: var(--ink-3); }

.select-wrap select {
  height: 30px; padding: 0 26px 0 10px;
  background: var(--bg-raise) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b8494' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 7px center / 13px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; appearance: none; -webkit-appearance: none; outline: none;
}
.select-wrap select:hover { border-color: var(--line-strong); }

/* ─────────────────────────── 게시판 목록 ─────────────────────────── */

/* 한 줄에 문제 세트 하나. 열은 제목 · 문항 · 플레이 · 등록일 · 실행. */
.board {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-raise);
  box-shadow: var(--shadow-sm);
}

/* 머리글과 각 줄은 서로 다른 grid 다. 마지막 열을 auto 로 두면 저마다
   내용에 맞춰 다른 폭이 잡혀 열이 어긋난다. 그래서 열 정의를 변수 하나로
   묶고 실행 열 폭도 고정해 둘을 정확히 같게 만든다. */
.board {
  --board-cols: minmax(0, 1fr) 56px 64px 92px 288px;
}

.board-head,
.board-row {
  display: grid;
  grid-template-columns: var(--board-cols);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

.board-head {
  height: 36px;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--ink-3);
}
.board-head .bh-num  { text-align: right; }
.board-head .bh-date { text-align: right; }
.board-head .bh-act  { text-align: right; }

.board-row {
  min-height: 60px;
  padding-top: 10px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s;
}
.board-row:last-child { border-bottom: 0; }
.board-row:hover { background: var(--bg-hover); }

.br-title { min-width: 0; }
.br-tags { display: flex; gap: 5px; margin-bottom: 3px; }

/* 제목 자체가 플레이 링크다 — 누르면 플레이 버튼과 똑같이 동작한다 */
.br-name {
  display: block; width: 100%;
  padding: 0; border: 0; background: none;
  font: inherit; font-size: 15px; font-weight: 700; line-height: 1.35;
  color: var(--ink); text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .12s;
}
.br-name:hover { color: var(--ink-accent); text-decoration: underline; text-underline-offset: 2px; }

.br-num, .br-date {
  text-align: right;
  font-size: 13px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.br-num b { font-size: 15px; font-weight: 700; color: var(--ink); }

/* 좁은 화면에서만 보이는 항목 이름 */
.br-k { display: none; font-size: 10.5px; color: var(--ink-3); font-weight: 600; margin-right: 5px; }

.br-act { display: flex; gap: 6px; justify-content: flex-end; }
.br-act .btn { white-space: nowrap; }
.br-act .ic { width: 13px; height: 13px; }

.tag {
  padding: 1px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 10.5px; font-weight: 700; color: var(--ink-3);
  letter-spacing: .02em;
}
.tag-subject {
  color: var(--sub, var(--ink-2));
  border-color: color-mix(in srgb, var(--sub, var(--line-strong)) 40%, transparent);
  background: color-mix(in srgb, var(--sub, transparent) 7%, transparent);
}

.empty {
  padding: 56px 20px; text-align: center;
  color: var(--ink-3);
}
.empty p { font-size: 14px; }
.empty-hint { font-size: 12.5px; margin-top: 6px; opacity: .8; }

/* ═══════════════════ 모달 공통 ═══════════════════ */

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: flex-start; justify-content: center;
  padding: 3vh 16px;
  background: rgba(24, 28, 38, 0.5);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.modal.is-open { display: flex; animation: fade .16s ease; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal-box {
  width: 100%; max-width: 700px;
  background: var(--bg-raise);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: rise .18s ease;
}

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 16px 18px 13px;
  border-bottom: 1px solid var(--line);
}
.modal-head-main { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.modal-head h2 { font-size: 17px; font-weight: 760; letter-spacing: -0.02em; line-height: 1.35; }
.modal-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ═══════════════ 실행 창 — 게임 고르기 + 옵션이 한 화면 ═══════════════ */

.launcher-box { max-width: var(--launcher); }

.launcher-body { padding: 16px 18px 4px; }

.sec-label {
  display: flex; align-items: baseline; gap: 9px;
  margin-bottom: 9px;
}
.sec-label h3 { font-size: 12.5px; font-weight: 750; color: var(--ink); letter-spacing: -0.01em; }
.sec-label span { font-size: 11.5px; color: var(--ink-3); }

/* 게임 5개를 가로로 — 전자칠판의 넓은 가로를 쓴다 */
.game-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.game-choice {
  display: flex; flex-direction: column;
  padding: 0; overflow: hidden;
  background: var(--bg-raise);
  border: 1.5px solid var(--line); border-radius: var(--r);
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
.game-choice:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.game-choice.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.game-shot {
  position: relative;
  display: block; overflow: hidden;
  aspect-ratio: 8 / 5;
  background: #d8dde6;
  border-bottom: 1px solid var(--line-soft);
}
.game-shot img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
/* 고른 게임에는 색 띠를 얹어 어느 것을 골랐는지 바로 보이게 */
.game-choice.is-on .game-shot::after {
  content: ''; position: absolute; inset: 0;
  border-bottom: 3px solid var(--accent);
}

.game-choice-body {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 11px 11px; min-width: 0;
}
.game-choice-name { font-size: 13.5px; font-weight: 730; }
.game-choice.is-on .game-choice-name { color: var(--accent); }
.game-choice-how {
  font-size: 11px; color: var(--ink-3); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.game-choice-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; font-weight: 600; }

.game-choice.is-weak { opacity: .5; }
.game-choice.is-weak .game-choice-meta { color: var(--warn); }

/* 옵션 — 고른 게임 바로 아래 */
.opt-panel {
  padding: 14px 16px 16px;
  background: var(--bg-sunk);
  border-radius: var(--r);
}

.opt-list { display: flex; flex-direction: column; }

.opt-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: start; gap: 12px;
  padding: 8px 0;
}
.opt-row + .opt-row { border-top: 1px solid var(--line); }

.opt-label {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  padding-top: 6px;
}
.opt-default {
  padding: 0 5px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  font-size: 9.5px; font-weight: 700; color: var(--ink-3);
}

.opt-choices { display: flex; gap: 5px; flex-wrap: wrap; }

.opt-btn {
  height: 31px; padding: 0 12px;
  background: var(--bg-raise);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 640;
  cursor: pointer; transition: all .13s;
}
.opt-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.opt-btn.is-on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* 실행 창 바닥 — 공유 링크와 시작 버튼 */
.launcher-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 18px;
}
.share-inline { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.share-inline > span { font-size: 11.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.share-inline input {
  flex: 1; min-width: 0; height: 30px; padding: 0 10px;
  background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink-3); font: inherit; font-size: 11.5px; outline: none;
}

.btn-start {
  min-width: 240px; height: 46px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 730;
  box-shadow: var(--shadow-sm);
}
.btn-start:hover:not(:disabled) { filter: brightness(1.08); }
.btn-start .ic { width: 14px; height: 14px; }

/* ─────────────────────── 문제 보기 (읽기 전용) ─────────────────────── */

.view-scroll {
  max-height: min(56vh, 460px);
  overflow-y: auto;
  margin: 14px 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.view-table { width: 100%; border-collapse: collapse; }
.view-table th {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 12px; text-align: left;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--ink-3);
}
.view-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; color: var(--ink-2);
}
.view-table tr:last-child td { border-bottom: 0; }
.view-table .vt-no {
  width: 48px; text-align: center; color: var(--ink-3);
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.view-table .vt-a { color: var(--ink); font-weight: 650; }
.view-table .vt-d { width: 22%; }
.view-table .vt-none { color: var(--ink-3); font-size: 11.5px; }
.view-loading { text-align: center; color: var(--ink-3); padding: 40px 0 !important; }

.view-foot {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 16px 18px 18px;
}

/* ═══════════════════ 편집기 / 가져오기 / 안내 ═══════════════════ */

.sheet-panel {
  padding: 20px 22px 22px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.sheet-panel.narrow { max-width: 640px; margin: 0 auto; }

.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-bottom: 15px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 17px; font-weight: 760; letter-spacing: -0.02em; }
.panel-head p  { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.panel-head-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.field-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 15px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-grow { flex: 1; min-width: 240px; }
.field-sm { width: 140px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--ink-3); }

.field input, .field select {
  height: 37px; padding: 0 11px;
  background: var(--bg-field);
  border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); font: inherit; font-size: 13.5px; outline: none;
  transition: border-color .14s;
}
.field select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b8494' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
}
.field input:focus, .field select:focus { border-color: var(--ink-accent); }

.note {
  padding: 10px 13px; margin-bottom: 15px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--ink-accent) 22%, transparent);
  border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--ink-2); line-height: 1.6;
}

.sheet-scroll {
  max-height: 440px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 12px;
}

.sheet { width: 100%; border-collapse: collapse; }
.sheet th {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 10px; text-align: left;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--ink-3);
}
.sheet td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); }
.sheet tr:last-child td { border-bottom: 0; }
.sheet .row-no {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.sheet input {
  width: 100%; height: 32px; padding: 0 9px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--ink); font: inherit; font-size: 13px; outline: none;
  transition: background .12s, border-color .12s;
}
.sheet input:hover  { background: var(--bg-sunk); }
.sheet input:focus  { background: var(--bg-field); border-color: var(--ink-accent); }
.sheet input::placeholder { color: #aeb6c3; }

.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-count { font-size: 12.5px; color: var(--ink-3); }
.sheet-count b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* 가져오기 */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 48px 20px; margin-bottom: 15px;
  background: var(--bg-sunk);
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  cursor: pointer; color: var(--ink-3);
  transition: border-color .14s, background .14s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--ink-accent); background: var(--accent-soft); }
.dropzone strong { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.dropzone span   { font-size: 12.5px; }

/* 게임 안내 */
.howto-list { display: flex; flex-direction: column; gap: 9px; }

.howto-row {
  display: flex; align-items: stretch; overflow: hidden;
  background: var(--bg-raise);
  border: 1px solid var(--line); border-radius: var(--r);
}

.howto-shot {
  position: relative; flex: none;
  width: 208px; overflow: hidden;
  background: #d8dde6;
  border-right: 1px solid var(--line-soft);
}
.howto-shot::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent); z-index: 1;
}
.howto-shot img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}

.howto-main { flex: 1; padding: 14px 16px; min-width: 0; }
.howto-main h3 { font-size: 14.5px; font-weight: 730; }
.howto-main p  { font-size: 12.5px; color: var(--ink-2); margin: 3px 0 0; }
.howto-how {
  font-size: 12px; color: var(--ink-3) !important;
  margin: 6px 0 10px !important;
  padding-left: 9px; border-left: 2px solid var(--line-strong);
}

.howto-opts { display: flex; flex-direction: column; gap: 3px; }
.howto-opts span { font-size: 11.5px; color: var(--ink-3); }
.howto-opts b { color: var(--ink-2); font-weight: 700; margin-right: 5px; }

.howto-meta {
  display: flex; flex-direction: column; gap: 10px; justify-content: center;
  padding: 14px 16px; flex: none;
  border-left: 1px solid var(--line-soft);
}
.howto-meta div { display: flex; flex-direction: column; gap: 1px; }
.howto-meta dt { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.howto-meta dd { font-size: 13px; font-weight: 700; color: var(--ink-2); }

/* ─────────────────────────── 토스트 ─────────────────────────── */

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200;
  transform: translate(-50%, 14px);
  padding: 11px 18px;
  background: #232936; color: #fff;
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 650;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ─────────────────────────── 반응형 ─────────────────────────── */

@media (max-width: 1180px) {
  /* 게임 5개를 한 줄에 못 놓는 폭 */
  .game-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .topbar-in { flex-wrap: wrap; gap: 10px; }
  .topbar-search { order: 3; flex-basis: 100%; }
  .game-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .howto-row { flex-wrap: wrap; }
  .howto-shot { width: 100%; height: 150px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .howto-meta { flex-direction: row; gap: 22px; border-left: 0; border-top: 1px solid var(--line-soft); width: 100%; }

  /* 열을 유지할 수 없는 폭에서는 게시판 한 줄을 카드처럼 접는다 */
  .board-head { display: none; }
  .board-row {
    grid-template-columns: 1fr 1fr;
    row-gap: 8px;
    padding: 14px 16px;
  }
  .br-title { grid-column: 1 / -1; }
  .br-name { white-space: normal; }
  .br-num, .br-date { text-align: left; }
  .br-k { display: inline; }
  .br-act { grid-column: 1 / -1; justify-content: stretch; }
  .br-act .btn { flex: 1; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .topbar-actions .btn span { display: none; }
  .game-list { grid-template-columns: 1fr; }
  .opt-row { grid-template-columns: 1fr; gap: 6px; }
  .opt-label { padding-top: 0; }
  .br-act { flex-wrap: wrap; }
  .launcher-foot { flex-direction: column; align-items: stretch; }
  .btn-start { min-width: 0; width: 100%; }
  .view-foot { flex-direction: column-reverse; }
  .view-foot .btn { width: 100%; }
  .modal { padding: 0; }
  .modal-box { max-width: none; min-height: 100vh; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
