/* How Do You Do — 보드게임 예약 */
:root {
  --wood-1: #4a3121;
  --wood-2: #3a261a;
  --wood-3: #5b3d29;
  --paper: #f7efe0;
  --paper-2: #efe3cc;
  --paper-edge: #dccaa8;
  --ink: #2e2219;
  --ink-soft: #6d5a48;
  --felt: #2f5d50;
  --felt-dark: #234a3f;
  --felt-light: #e3eee8;
  --mustard: #e3a83a;
  --mustard-light: #fbecc9;
  --token-red: #c4553f;
  --token-red-light: #f6ddd6;
  --token-blue: #3f6f9c;
  --stone: #a39a8f;
  --kakao: #fee500;
  --radius: 14px;
  --shadow: 0 2px 0 var(--paper-edge), 0 10px 24px rgba(20, 10, 4, .28);
  --font-title: 'Gowun Batang', 'Noto Serif KR', serif;
  --font-body: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  background-color: var(--wood-2);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(255, 200, 120, .28), transparent 60%),
    repeating-linear-gradient(92deg, rgba(0,0,0,.08) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(255,255,255,.03) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, var(--wood-3), var(--wood-1) 40%, var(--wood-2));
  background-attachment: fixed;
}
a { color: var(--felt); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 헤더 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--felt), var(--felt-dark));
  border-bottom: 3px solid #1a382f;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.topbar-inner {
  max-width: 960px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; margin-right: auto; }
.brand svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
.brand-name { font-family: var(--font-title); font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; line-height: 1.1; }
.brand-sub { font-size: .72rem; opacity: .75; letter-spacing: .08em; }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button {
  color: var(--paper); text-decoration: none; background: none; border: 0; cursor: pointer;
  padding: 7px 11px; border-radius: 999px; font-size: .92rem;
}
.nav a:hover, .nav button:hover { background: rgba(255,255,255,.1); }
.nav a[aria-current="page"] { background: rgba(255,255,255,.16); font-weight: 700; }
.nav .badge { background: var(--mustard); color: var(--ink); border-radius: 999px; font-size: .72rem; padding: 1px 7px; margin-left: 4px; font-weight: 700; }

/* ---------- 레이아웃 ---------- */
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 64px; }
.hero { text-align: center; color: var(--paper); padding: 22px 8px 26px; }
.hero h1 { font-family: var(--font-title); font-size: clamp(1.7rem, 5vw, 2.5rem); margin: 0 0 6px; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.hero p { margin: 0; opacity: .85; }
.hero .hours { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(247,239,224,.12); border: 1px solid rgba(247,239,224,.25); font-size: .85rem; }

.card {
  background: var(--paper);
  background-image: radial-gradient(rgba(120,90,50,.06) 1px, transparent 1px);
  background-size: 6px 6px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
  position: relative;
}
.card h2 { font-family: var(--font-title); font-size: 1.2rem; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.card h2 .step {
  width: 28px; height: 28px; border-radius: 6px; display: inline-grid; place-items: center;
  background: var(--paper); border: 2px solid var(--ink); font-size: .9rem; box-shadow: 2px 2px 0 var(--ink);
}
.muted { color: var(--ink-soft); font-size: .9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  padding: 10px 18px; border-radius: 10px; cursor: pointer; font-weight: 700;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, box-shadow .08s; text-decoration: none;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn-primary { background: var(--felt); color: var(--paper); }
.btn-danger { background: var(--token-red); color: #fff; }
.btn-warn { background: var(--mustard); }
.btn-sm { padding: 6px 12px; font-size: .88rem; border-radius: 8px; box-shadow: 2px 2px 0 var(--ink); }
.btn-block { width: 100%; }
.btn-kakao {
  background: var(--kakao); color: rgba(0,0,0,.85); border: 0; box-shadow: 0 3px 0 #c9b500;
  border-radius: 12px; padding: 12px 20px;
}
.btn-kakao:hover { box-shadow: 0 4px 0 #c9b500; }
.btn-kakao:active { box-shadow: 0 1px 0 #c9b500; transform: translateY(2px); }
.btn-kakao svg { width: 20px; height: 20px; }

/* ---------- 달력 (게임 보드) ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head strong { font-family: var(--font-title); font-size: 1.15rem; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper);
  cursor: pointer; font-size: 1.1rem; display: grid; place-items: center; box-shadow: 2px 2px 0 var(--ink);
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.cal {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
  background: var(--felt); padding: 8px; border-radius: 12px; border: 3px solid var(--felt-dark);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08);
}
.cal .dow { text-align: center; font-size: .78rem; color: var(--felt-light); padding: 2px 0 4px; }
.cal .dow.sun { color: #ffb3a3; } .cal .dow.sat { color: #b5d4f5; }
.day {
  aspect-ratio: 1 / 1.05; border: 0; border-radius: 8px; background: var(--paper); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px;
  box-shadow: 0 2px 0 var(--paper-edge); position: relative; min-width: 0;
}
.day .num { font-weight: 700; font-size: .98rem; line-height: 1; }
.day.sun .num { color: var(--token-red); } .day.sat .num { color: var(--token-blue); }
.day .info { font-size: .64rem; color: var(--ink-soft); line-height: 1; white-space: nowrap; }
.day .pips { display: flex; gap: 2px; height: 6px; }
.day .pips i { width: 6px; height: 6px; border-radius: 50%; background: var(--felt); }
.day.full .pips i { background: var(--token-red); }
.day.empty { background: transparent; box-shadow: none; cursor: default; }
.day:disabled { background: rgba(247,239,224,.25); box-shadow: none; cursor: default; }
.day:disabled .num { color: rgba(247,239,224,.6); }
.day:disabled .info { color: rgba(247,239,224,.5); }
.day.today::after { content: ''; position: absolute; inset: 3px; border: 2px dashed var(--mustard); border-radius: 6px; pointer-events: none; }
.day.selected { background: var(--mustard); box-shadow: 0 2px 0 #9b6e1c; }
.day.selected .num, .day.selected .info { color: var(--ink); }
.day.full:not(:disabled) .info { color: var(--token-red); }

/* ---------- 시간 토큰 ---------- */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.slot {
  border: 2px solid var(--ink); background: #fffaf0; border-radius: 12px; padding: 10px 6px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .12s; position: relative;
}
.slot .t { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.slot .s { font-size: .74rem; color: var(--ink-soft); }
.slot:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.slot.selected { background: var(--felt); color: var(--paper); }
.slot.selected .s { color: var(--felt-light); }
.slot.pending { background: repeating-linear-gradient(-45deg, var(--mustard-light) 0 6px, #fff4dc 6px 12px); }
.slot.taken { background: var(--token-red-light); }
.slot.taken .s { color: var(--token-red); font-weight: 700; }
.slot.blocked, .slot.past { background: #e6ded1; border-color: var(--stone); color: var(--stone); box-shadow: 0 4px 0 var(--stone); }
.slot.blocked .s, .slot.past .s { color: var(--stone); }
.slot:disabled { cursor: default; }
.slot.mine::before {
  content: '내 예약'; position: absolute; top: -9px; right: -6px; background: var(--token-blue); color: #fff;
  font-size: .62rem; padding: 1px 6px; border-radius: 999px; font-weight: 700;
}
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: .8rem; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--ink); display: inline-block; }
.legend .l-open { background: #fffaf0; } .legend .l-sel { background: var(--felt); }
.legend .l-pend { background: var(--mustard-light); } .legend .l-taken { background: var(--token-red-light); }
.legend .l-off { background: #e6ded1; border-color: var(--stone); }

/* ---------- 인원 (미플) ---------- */
.meeples { display: flex; gap: 8px; flex-wrap: wrap; }
.meeple-btn {
  border: 2px solid var(--ink); background: #fffaf0; border-radius: 12px; padding: 8px 10px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 62px; box-shadow: 0 3px 0 var(--ink);
}
.meeple-btn svg { width: 30px; height: 30px; }
.meeple-btn .lbl { font-size: .8rem; font-weight: 700; }
.meeple-btn .row { display: flex; gap: 1px; }
.meeple-btn .row svg { width: 14px; height: 14px; }
.meeple-btn[aria-pressed="true"] { background: var(--mustard); }

/* ---------- 폼 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; margin-bottom: 6px; font-size: .92rem; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 12px; border: 2px solid var(--ink); border-radius: 10px; background: #fffdf7;
  outline: none;
}
.input:focus { border-color: var(--felt); box-shadow: 0 0 0 3px rgba(47,93,80,.25); }
textarea.input { resize: vertical; min-height: 70px; }

.summary {
  border: 2px dashed var(--ink-soft); border-radius: 12px; padding: 12px 14px; margin: 14px 0; background: #fffaf0;
}
.summary dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.summary dt { color: var(--ink-soft); font-size: .88rem; }
.summary dd { margin: 0; font-weight: 700; }

/* ---------- 예약 카드 ---------- */
.res-list { display: grid; gap: 12px; }
.res {
  background: #fffaf0; border: 2px solid var(--ink); border-radius: 12px; padding: 14px 16px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; box-shadow: 0 3px 0 var(--ink);
}
.res .date-tile {
  width: 58px; text-align: center; border-radius: 10px; background: var(--felt); color: var(--paper); padding: 6px 0;
}
.res .date-tile b { display: block; font-size: 1.4rem; line-height: 1.1; font-family: var(--font-title); }
.res .date-tile small { font-size: .72rem; opacity: .85; }
.res .meta { min-width: 0; }
.res .meta .title { font-weight: 700; }
.res .meta .sub { font-size: .86rem; color: var(--ink-soft); word-break: break-word; }
.res .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.res.dim { opacity: .6; box-shadow: none; }
@media (max-width: 560px) {
  .res { grid-template-columns: auto 1fr; }
  .res .actions { grid-column: 1 / -1; justify-content: stretch; }
  .res .actions .btn { flex: 1; }
}
.status { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1.5px solid currentColor; margin-left: 6px; vertical-align: 2px; }
.status.pending { color: #9b6e1c; background: var(--mustard-light); }
.status.confirmed { color: var(--felt); background: var(--felt-light); }
.status.rejected, .status.cancelled { color: var(--ink-soft); background: #ece4d7; }

/* ---------- 탭 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  flex: 0 0 auto; border: 2px solid var(--paper); background: transparent; color: var(--paper); padding: 8px 16px;
  border-radius: 999px; cursor: pointer; font-weight: 700;
}
.tab[aria-selected="true"] { background: var(--paper); color: var(--ink); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; padding: 8px 10px; }

/* 관리자 시간 그리드 */
.admin-hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ah {
  border: 2px solid var(--ink); border-radius: 10px; padding: 8px 10px; background: #fffaf0; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; box-shadow: 0 3px 0 var(--ink);
}
.ah b { font-variant-numeric: tabular-nums; }
.ah small { color: var(--ink-soft); font-size: .78rem; }
.ah.blocked { background: #e6ded1; border-color: var(--stone); box-shadow: 0 3px 0 var(--stone); }
.ah.has-res { background: var(--felt-light); cursor: default; }
.ah.has-res.pending { background: var(--mustard-light); }

table.users { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.users th, table.users td { text-align: left; padding: 10px 8px; border-bottom: 1px dashed var(--paper-edge); vertical-align: middle; }
table.users th { font-size: .8rem; color: var(--ink-soft); }
@media (max-width: 640px) {
  table.users thead { display: none; }
  table.users tr { display: block; padding: 10px 0; border-bottom: 1px dashed var(--paper-edge); }
  table.users td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 0; }
  table.users td::before { content: attr(data-label); color: var(--ink-soft); font-size: .8rem; }
}

/* ---------- 토스트 / 다이얼로그 / 로딩 ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast {
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
  animation: pop .2s ease-out; font-size: .94rem;
}
.toast.err { background: var(--token-red); }
.toast.ok { background: var(--felt); }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

dialog {
  border: 0; border-radius: 16px; padding: 22px; width: min(92vw, 420px); background: var(--paper); color: var(--ink);
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(20, 12, 6, .6); }
dialog h3 { font-family: var(--font-title); margin: 0 0 8px; }
dialog .row-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.dice-loader { display: flex; justify-content: center; padding: 26px; }
.dice-loader span {
  width: 34px; height: 34px; border-radius: 8px; background: #fffaf0; border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink); animation: roll 1s infinite ease-in-out;
  background-image: radial-gradient(circle, var(--ink) 3px, transparent 3.5px);
  background-size: 50% 50%;
}
@keyframes roll { 0% { transform: rotate(0); } 50% { transform: rotate(180deg) scale(.9); } 100% { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 26px 10px; color: var(--ink-soft); }
.empty-state svg { width: 54px; height: 54px; margin: 0 auto 10px; opacity: .55; }

.login-card { max-width: 420px; margin: 10px auto 0; text-align: center; }
.login-card .btn-kakao { width: 100%; margin-top: 8px; }

.notice { border-left: 4px solid var(--mustard); background: var(--mustard-light); padding: 10px 12px; border-radius: 6px; font-size: .9rem; margin-bottom: 14px; }

footer.site { text-align: center; color: rgba(247,239,224,.6); font-size: .8rem; padding: 0 16px 30px; }
footer.site a { color: rgba(247,239,224,.8); }

.prose h2 { font-family: var(--font-title); margin-top: 22px; font-size: 1.1rem; }
.prose ul { padding-left: 20px; }

@media (max-width: 480px) {
  main { padding: 12px 12px 56px; }
  .card { padding: 16px 14px; }
  .brand-sub { display: none; }
  .cal { gap: 3px; padding: 5px; }
  .day .info { font-size: .58rem; }
  .slots { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
