@font-face { font-family: 'Galmuri11'; src: url('shared/fonts/Galmuri11.woff2') format('woff2'); font-weight: 400; }
@font-face { font-family: 'Galmuri11'; src: url('shared/fonts/Galmuri11-Bold.woff2') format('woff2'); font-weight: 700; }
@font-face { font-family: 'Galmuri9'; src: url('shared/fonts/Galmuri9.woff2') format('woff2'); }

:root {
  --wall: #fbe7e4; --wall2: #f5d3d3; --wood: #e3b47c; --wood2: #cf9d66; --desk: #f0cf9a;
  --ink: #3b2f2f; --soft: #8a6a48; --paper: #fff7e6; --board: #2f5d50; --chalk: #d7efe4;
  --go: #3f9b6b; --star: #c8862a; --no: #d9594f;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--wood); }
body { font-family: 'Galmuri11', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; font-size: 16px; line-height: 1.5; color: var(--ink); min-height: 100vh;
  background: linear-gradient(var(--wall) 0 180px, var(--wall2) 180px 204px, #b98958 204px 208px, var(--wood) 208px); background-repeat: no-repeat; background-color: var(--wood); }
canvas { image-rendering: pixelated; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #5f9be0; outline-offset: 2px; }

.app { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.top h1 { font-size: 24px; font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.stars { background: var(--paper); border: 2px solid var(--ink); padding: 2px 10px; font-weight: 700; color: var(--star); }
.link { text-decoration: underline; color: var(--soft); font-size: 14px; }
.loading { padding: 80px 0; text-align: center; color: var(--soft); }

/* 칠판처럼 생긴 상자 */
.board { background: var(--board); color: #fff; border: 6px solid #b98958; padding: 18px 18px 20px; box-shadow: 0 4px 0 #9a6f44; }
.board h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.board p { color: var(--chalk); font-size: 15px; }
.board .big { font-size: 36px; font-weight: 700; line-height: 1.2; }

/* 종이 카드 */
.card { background: var(--paper); border: 3px solid var(--ink); padding: 14px; margin-top: 14px; box-shadow: 0 4px 0 var(--wood2); }
.card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.muted { color: var(--soft); font-size: 14px; }

.btn { display: inline-block; background: var(--go); color: #fff; font-weight: 700; padding: 12px 18px; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); text-decoration: none; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.wide { display: block; width: 100%; text-align: center; margin-top: 14px; }
.btn.small { padding: 6px 12px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
.btn.gold { background: #f2cf5b; color: var(--ink); }
.btn[disabled] { background: #c9c2b4; color: #7d766a; cursor: default; }

.preview { border: 3px solid var(--ink); background: var(--wall); margin: 0 auto; width: 100%; max-width: 480px; aspect-ratio: 160 / 100; box-shadow: 0 4px 0 var(--wood2); }
.preview canvas { width: 100%; height: 100%; }
.poses { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.chip { padding: 4px 12px; border: 2px solid var(--ink); background: var(--paper); font-size: 14px; }
.chip.on { background: var(--ink); color: var(--paper); }

.slots { display: flex; gap: 6px; overflow-x: auto; padding: 14px 0 8px; scrollbar-width: thin; }
.slots .chip { flex: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.opt { position: relative; background: var(--paper); border: 3px solid var(--ink); padding: 6px 4px 6px; text-align: center; font-size: 13px; line-height: 1.3; }
.opt canvas { width: 64px; height: 64px; margin: 0 auto 4px; }
.opt.on { background: #d9f2e3; border-color: var(--go); box-shadow: inset 0 0 0 2px var(--go); }
.opt.locked { background: #ece4d6; color: var(--soft); }
.opt.locked canvas { opacity: 0.45; }
.opt .how { display: block; font-size: 12px; color: var(--star); }
.opt .swatch { width: 48px; height: 48px; margin: 8px auto 12px; border: 3px solid var(--ink); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat { background: var(--paper); border: 3px solid var(--ink); padding: 10px 12px; box-shadow: 0 4px 0 var(--wood2); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--soft); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-top: 8px; border-bottom: 3px solid var(--ink); }
.bars i { flex: 1; background: var(--go); min-height: 2px; display: block; }
.bars i.zero { background: #d8cdb8; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--soft); margin-top: 4px; }
.goal { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 2px dashed #d8cdb8; font-size: 14px; }
.goal:first-of-type { border-top: 0; }
.goal .done { color: var(--go); font-weight: 700; }

.shop-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 2px dashed #d8cdb8; }
.shop-row:first-of-type { border-top: 0; }
.shop-row canvas { width: 56px; height: 56px; flex: none; }
.shop-row .name { flex: 1; }
.rank-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; padding: 5px 0; border-top: 2px dashed #d8cdb8; font-size: 15px; }
.rank-row:first-of-type { border-top: 0; }
.rank-row.me { background: #d9f2e3; }
.rank-row .n { color: var(--soft); font-weight: 700; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--ink); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
.tabs[hidden] { display: none; }
.tabs button { flex: 1; max-width: 130px; padding: 10px 4px; color: #cdbfae; font-size: 15px; }
.tabs button.on { background: var(--paper); color: var(--ink); font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; font-size: 14px; max-width: 90vw; }
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }

/* 도움말 팝업 */
.help-btn { width: 30px; height: 30px; border: 2px solid var(--ink); background: var(--paper); font-weight: 700; line-height: 1; }
.help { position: fixed; inset: 0; z-index: 20; background: rgba(43, 34, 51, .55); display: flex; align-items: center; justify-content: center; padding: 14px; }
.help[hidden] { display: none; }
.help-box { width: 100%; max-width: 560px; height: min(86vh, 760px); background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink); display: flex; flex-direction: column; }
.help-head, .help-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.help-head { border-bottom: 3px solid var(--ink); background: var(--board); color: #fff; }
.help-head button { color: var(--chalk); font-size: 14px; }
.help-foot { border-top: 2px solid var(--wood2); }
.help iframe { flex: 1; width: 100%; border: 0; background: var(--paper); }

/* 건의 게시판 */
.card textarea { width: 100%; font: inherit; font-size: 15px; padding: 8px; border: 2px solid var(--ink); background: #fff; resize: vertical; color: var(--ink); }
.sug-write { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.sug-list { margin-top: 12px; display: grid; gap: 10px; }
.sug { background: var(--paper); border: 3px solid var(--ink); padding: 12px 14px; box-shadow: 0 3px 0 var(--wood2); }
.sug.done { border-color: var(--go); }
.sug-text { white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.sug-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.like { border: 2px solid var(--ink); padding: 2px 10px; font-size: 14px; background: #fff; min-width: 56px; }
.like.on { background: #fbe0e3; color: var(--no); border-color: var(--no); font-weight: 700; }
.badge { color: var(--go); }
.sug-reply { margin-top: 8px; padding: 8px 10px; background: var(--board); color: #fff; font-size: 14px; }
.sug-reply b { color: var(--chalk); margin-right: 6px; }
.sug-tools { display: flex; gap: 14px; justify-content: flex-end; margin-top: 6px; }
.tabs button { max-width: 110px; }
.top h1 { white-space: nowrap; }
.top-right { white-space: nowrap; }
.tabs button { white-space: nowrap; padding: 10px 2px; }
@media (max-width: 420px) {
  .top h1 { font-size: 20px; }
  .top-right { gap: 6px; font-size: 13px; }
  .top-right > span:not(.stars) { max-width: 6em; overflow: hidden; text-overflow: ellipsis; }
  .tabs { gap: 3px; }
  .tabs button { font-size: 14px; }
}
