:root {
  --paper: #f4efe4;
  --panel: #fbf8f1;
  --ink: #2b2a27;
  --quiet: #77736b;
  --line: #ddd5c4;
  --celadon: #2f6b66;
  --up: #b5452f;     /* 오름·사자 */
  --down: #2f5f9e;   /* 내림·팔자 */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; font-size: 14px;
}
.top {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--celadon); color: #fff;
}
.title { font-size: 20px; font-weight: 700; }
.title .sub { font-size: 12px; font-weight: 400; opacity: .8; margin-left: 6px; }
.date { font-size: 15px; }
.online { margin-left: auto; font-size: 13px; opacity: .9; }
.me-bar, .join {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.me-name { font-weight: 700; color: var(--celadon); }
.join form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.join label { font-weight: 700; }
.hint { color: var(--quiet); font-size: 12px; }
.msg { font-size: 13px; }
.msg.err { color: var(--up); }
.msg.ok { color: var(--celadon); }
input { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
button { font: inherit; padding: 6px 12px; border: 1px solid var(--celadon); border-radius: 4px;
         background: var(--celadon); color: #fff; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
.grid { display: grid; grid-template-columns: 300px 1fr 420px; gap: 12px; padding: 12px 16px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 300px; gap: 12px; padding: 12px 16px 16px; }
@media (max-width: 1100px) { .grid, .grid2 { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; min-width: 0; }
h2 { font-size: 15px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--celadon); }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--quiet); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 3px 6px; text-align: right; white-space: nowrap; }
th { color: var(--quiet); font-weight: 400; font-size: 12px; border-bottom: 1px solid var(--line); }
td:first-child, th:first-child { text-align: left; }
.ticker tr { cursor: pointer; }
.ticker tr:hover td { background: #efe8d8; }
.ticker tr.sel td { background: #e3ecea; font-weight: 700; }
.ticker .grp td { color: var(--quiet); font-size: 12px; padding-top: 8px; cursor: default; background: none; font-weight: 400; }
.up { color: var(--up); }
.down { color: var(--down); }
.book td { text-align: center; }
.book td.ask { color: var(--down); }
.book td.bid { color: var(--up); }
.book td.price { font-weight: 700; cursor: pointer; }
.book tr.mid td { background: #efe8d8; font-weight: 700; color: var(--ink); }
.tape, .board, .ranking { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; font-size: 13px; }
.tape li, .board li { padding: 3px 0; border-bottom: 1px dotted var(--line); }
.board .kind { display: inline-block; min-width: 54px; font-weight: 700; color: var(--celadon); }
.board .kind.헛소문, .board .kind.재해 { color: var(--up); }
.board .kind.절기, .board .kind.도착, .board .kind.전갈 { color: var(--quiet); }
.board .kind.작황, .board .kind.행사, .board .kind.구휼 { color: #8a6d1f; }
.board .date { color: var(--quiet); font-size: 12px; margin-right: 6px; }
.ranking { list-style: decimal inside; }
.ranking li { padding: 3px 0; }
.order { display: grid; gap: 8px; }
.order label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order label input { width: 160px; text-align: right; }
.qty-box { display: flex; gap: 6px; }
.qty-box input { width: 106px; }
button.small { padding: 4px 10px; font-size: 13px; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side { background: #fff; color: var(--ink); border-color: var(--line); }
.side.buy.on { background: var(--up); border-color: var(--up); color: #fff; }
.side.sell.on { background: var(--down); border-color: var(--down); color: #fff; }
.list td button { padding: 2px 8px; font-size: 12px; }
.list th, .list td { padding: 3px 4px; }
.list input[type="checkbox"] { margin: 0; vertical-align: middle; }
/* ---------- 길 ---------- */
.travel-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 8px 16px;
              background: #e9efe9; border-bottom: 1px solid var(--line); font-size: 13px; }
.travel-bar .where { font-weight: 700; color: var(--celadon); }
.travel-bar .routes button { margin-right: 6px; padding: 3px 10px; font-size: 12px; }
.progress { flex: 1; min-width: 160px; max-width: 420px; height: 10px; background: #fff; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.progress .fill { height: 100%; width: 0; background: var(--celadon); transition: width .8s linear; }
.ticker tr.away td { color: var(--quiet); }
.ticker tr.away td.up, .ticker tr.away td.down { opacity: .7; }

/* ---------- 보따리, 가게, 물물교환 ---------- */
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; padding: 0 16px 16px; }
@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr; } }
.slots { display: grid; gap: 4px; }
.bag { grid-template-columns: repeat(6, 1fr); }
.offer { grid-template-columns: repeat(3, 1fr); }
.small-bag { grid-template-columns: repeat(8, 1fr); margin-top: 6px; }
.slot {
  position: relative; aspect-ratio: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 4px;
  background: #fff; font-size: 11px; line-height: 1.2; padding: 3px; overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center; word-break: keep-all;
}
.slot.empty { background: #f1ece0; cursor: default; }
.slot.sel { outline: 2px solid var(--celadon); }
.slot.tool { border-color: #c9b98f; }
.slot.goods { border-color: #a9c4c0; }
.slot .n { position: absolute; right: 3px; bottom: 1px; font-weight: 700; color: var(--celadon); }
.item-detail { margin-top: 8px; min-height: 40px; font-size: 12px; }
.item-detail b { color: var(--ink); }
.item-detail button { margin-top: 6px; margin-right: 6px; }
.notes, .shop, .traders { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.notes { max-height: 180px; overflow-y: auto; }
.notes li { padding: 4px 0; border-bottom: 1px dotted var(--line); white-space: pre-line; }
.notes .date { color: var(--quiet); font-size: 11px; display: block; }
.shop li, .traders li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.shop .what, .traders .who { flex: 1; }
.shop .price { font-weight: 700; white-space: nowrap; }
.shop .desc { display: block; color: var(--quiet); font-size: 12px; margin-top: 2px; }
.shop button, .traders button { padding: 3px 10px; font-size: 12px; white-space: nowrap; }
button.ghost { background: #fff; color: var(--celadon); }
button.gold { background: #c9962b; border-color: #a97a1d; }
button.gold.on { background: #7d8f3a; border-color: #6a7a2f; }
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 40, .55); display: grid; place-items: center; z-index: 10; }
.popup { background: var(--panel); border-radius: 8px; padding: 18px 22px; max-width: 460px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.notice-text { white-space: pre-line; line-height: 1.6; }
.row-buttons { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.trade-box { background: #eef1ee; border: 3px solid #5d7d8f; border-radius: 10px; padding: 12px 14px; width: 560px; max-width: calc(100vw - 32px); }
.trade-title { text-align: center; font-weight: 700; color: #fff; background: #5d7d8f; border-radius: 6px; padding: 4px; margin-bottom: 10px; letter-spacing: 2px; }
.trade-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.trader { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.face { width: 64px; height: 64px; border-radius: 50%; background: var(--celadon); color: #fff; font-size: 26px; font-weight: 700; display: grid; place-items: center; }
.face.partner { background: #a25f8a; }
.tag { background: #44515a; color: #fff; border-radius: 10px; padding: 1px 10px; font-size: 12px; }
.trade-buttons { display: flex; flex-direction: column; gap: 6px; }
.trade-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 8px; padding: 10px; background: #fff; border-radius: 6px; }
.trade-side { display: grid; gap: 6px; }
.trade-side .coins { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-size: 13px; }
.trade-side .coins input { width: 120px; text-align: right; }
.side-state { font-size: 12px; text-align: center; min-height: 16px; color: var(--quiet); }
.side-state.ok { color: #6a7a2f; font-weight: 700; }
.ending { position: fixed; inset: 0; background: rgba(20, 30, 40, .72); display: grid; place-items: center; }
.ending[hidden] { display: none; }
.ending-box { background: var(--panel); border-radius: 8px; padding: 24px 28px; max-width: 420px; text-align: center; }
.ending-box h2 { border: none; font-size: 22px; color: var(--down); }
