:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --ink: #1e2230;
  --muted: #6b6f7b;
  --line: #e4dccb;
  --brass: #c9862b;
  --brass-soft: #f3dfb8;
  --teal: #1d7f7a;
  --teal-soft: #d6ece9;
  --red: #b9533a;
  --empty: #d9d1bf;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(30, 34, 48, .06), 0 6px 18px rgba(30, 34, 48, .07);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--teal); }
a:hover { color: #145f5b; }
img, svg { max-width: 100%; }
button { font: inherit; }
h1, h2, h3 { line-height: 1.2; }

/* header */
.site-head { display: flex; align-items: center; gap: 18px; max-width: 980px; margin: 0 auto; padding: 12px 18px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font: 700 1.45rem/1 var(--serif); letter-spacing: .01em; }
.brand .logo { width: 38px; height: 38px; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a, .site-menu-list a { color: var(--ink); text-decoration: none; padding: 7px 11px; border-radius: 9px; font-weight: 500; }
.site-nav a:hover, .site-menu-list a:hover { background: #ece4d3; }
.site-nav a[aria-current="page"], .site-menu-list a[aria-current="page"] { background: var(--ink); color: #fff; }
.site-menu { display: none; margin-left: auto; position: relative; }
.site-menu summary { list-style: none; cursor: pointer; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; }
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu summary svg { width: 24px; height: 24px; stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.site-menu[open] summary { background: #ece4d3; }
.site-menu-list { position: absolute; right: 0; top: 48px; z-index: 30; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; min-width: 190px; }
@media (max-width: 720px) {
  .site-nav { display: none; }
  .site-menu { display: block; }
}

.site-main { max-width: 980px; margin: 0 auto; padding: 0 18px 40px; }

/* footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 30px; padding: 22px 18px 34px; text-align: center; color: var(--muted); font-size: .9rem; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 10px; }
.foot-links a { color: var(--ink); }
.foot-note { max-width: 640px; margin: 0 auto; }

/* text pages */
.doc-text { max-width: 720px; margin: 10px auto 0; }
.doc-text h1 { font: 700 2.1rem/1.15 var(--serif); margin: 12px 0 10px; }
.doc-text h2 { font: 700 1.35rem/1.25 var(--serif); margin: 30px 0 8px; }
.doc-text h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.lede { font-size: 1.15rem; color: #3b4050; }
.crumbs { font-size: .9rem; color: var(--muted); margin: 6px 0 0; }
.crumbs a { color: var(--muted); }
.doc-text li { margin: 4px 0; }
.example { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.chip { display: inline-block; padding: 4px 11px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .88rem; }
.chip.link { background: var(--brass-soft); border-color: #e2c48f; }
.chip.best { background: var(--teal-soft); border-color: #a9d3cd; }
.plus, .arrow { color: var(--muted); font-weight: 700; }
.faq h3 { margin-top: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 12px; border: 0; background: var(--ink); color: #fff; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover { background: #343a4f; color: #fff; }
.btn.alt { background: var(--card); color: var(--ink); border: 1.5px solid var(--ink); }
.btn.alt:hover { background: #efe8da; color: var(--ink); }
.btn.brass { background: var(--brass); }
.btn.brass:hover { background: #b37522; }
.btn:disabled { opacity: .5; cursor: default; }
table.data { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* archive */
.arch-month { margin: 24px 0 8px; font: 700 1.2rem var(--serif); }
.arch-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.arch-list a { display: block; padding: 11px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.arch-list a:hover { border-color: var(--brass); }
.arch-list b { display: block; }
.arch-list span { color: var(--muted); font-size: .88rem; }
.arch-round { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.arch-round h2 { margin: 0 0 6px; font-size: 1.1rem; font-family: var(--sans); }
.arch-round .kind { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.arch-round p { margin: 8px 0 0; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 22px 0; }

/* contact form */
[data-feedback-form] { display: grid; gap: 12px; margin-top: 16px; }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .fb-row { grid-template-columns: 1fr; } }
.fb-field { display: grid; gap: 5px; }
.fb-field label { font-weight: 600; font-size: .92rem; }
.fb-hint { font-weight: 400; color: var(--muted); }
.fb-field input, .fb-field textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.fb-field textarea { min-height: 150px; resize: vertical; }
[data-feedback-form] button { justify-self: start; padding: 11px 22px; border-radius: 12px; border: 0; background: var(--ink); color: #fff; font-weight: 650; cursor: pointer; }

/* ---------- game ---------- */
.game-wrap { max-width: 640px; margin: 4px auto 0; }
.page-title { font: 700 1.9rem/1.15 var(--serif); margin: 8px 0 2px; text-align: center; }
.page-sub { text-align: center; color: var(--muted); margin: 0 0 14px; }
#cl-app { min-height: 520px; }
.cl-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 20px; }
.cl-loading { text-align: center; color: var(--muted); padding: 60px 10px; }

.cl-cover { text-align: center; padding: 26px 20px 24px; }
.cl-cover .no { font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cl-cover h2 { font: 700 1.6rem/1.2 var(--serif); margin: 6px 0 4px; }
.cl-cover .date { color: var(--muted); margin: 0 0 16px; }
.cl-cover .actions { display: grid; gap: 10px; max-width: 320px; margin: 0 auto; }
.cl-cover .actions .btn { padding: 13px 20px; font-size: 1.05rem; }
.cl-cover .count { margin-top: 16px; color: var(--muted); font-size: .92rem; }
.cl-cover .mini { display: flex; justify-content: center; gap: 6px; margin: 12px 0 2px; font-size: 1.35rem; }

.cl-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cl-bar .title { font-weight: 700; }
.cl-bar .total { font-variant-numeric: tabular-nums; color: var(--muted); }
.cl-bar .icons { display: flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: #efe8da; }
.cl-pips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.cl-pip { height: 8px; border-radius: 4px; background: var(--empty); position: relative; overflow: hidden; }
.cl-pip.now { background: #bdb4a0; }
.cl-pip i { position: absolute; inset: 0 auto 0 0; background: var(--brass); border-radius: 4px; }
.cl-kind { text-align: center; margin-bottom: 14px; }
.cl-kind b { display: block; font: 700 1.2rem/1.2 var(--serif); }
.cl-kind span { color: var(--muted); font-size: .95rem; }

.cl-board { display: grid; gap: 10px; }
.cl-clue { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; background: #fbf7ee; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 10px 16px; }
.cl-clue .w { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 1.15rem; overflow-wrap: anywhere; }
.cl-clue .n { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.chain { display: block; width: 176px; height: 26px; }
.chain .lk { fill: none; stroke: var(--empty); stroke-width: 3.2; transition: stroke .25s, fill .25s; }
.chain .lk.on { stroke: var(--brass); fill: rgba(201, 134, 43, .14); }
.chain.best .lk.on { stroke: var(--teal); fill: rgba(29, 127, 122, .12); }
.cl-hub { text-align: center; margin: 4px 0 2px; }
.cl-hub .slot { display: inline-block; min-width: 180px; padding: 12px 18px; border: 2px dashed #cfc5b0; border-radius: 14px; color: var(--muted); font-weight: 600; }
.cl-hub .slot.filled { border: 2px solid var(--brass); background: var(--brass-soft); color: var(--ink); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 1.2rem; }
.cl-entry { display: flex; gap: 8px; margin-top: 14px; }
.cl-entry input { flex: 1; min-width: 0; font: 600 1.15rem var(--sans); padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); text-transform: lowercase; }
.cl-entry input:focus { outline: none; border-color: var(--ink); }
.cl-entry .btn { padding: 12px 22px; font-size: 1.05rem; }
.cl-msg { min-height: 1.5em; margin: 8px 2px 0; color: var(--red); font-size: .95rem; text-align: center; }
.cl-verdict { text-align: center; margin-top: 14px; }
.cl-score { font: 800 2.6rem/1 var(--sans); font-variant-numeric: tabular-nums; }
.cl-score small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.cl-label { font-weight: 700; color: var(--brass); margin: 4px 0 8px; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.cl-rank { color: var(--muted); font-size: .92rem; margin: 0 0 12px; }
.cl-best { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 6px; }
.cl-also { color: var(--muted); font-size: .9rem; margin: 6px 0 14px; }
.cl-next { min-width: 200px; }

.cl-result h2 { text-align: center; font: 700 1.3rem var(--serif); margin: 0; }
.cl-big { text-align: center; font: 800 3rem/1.1 var(--sans); font-variant-numeric: tabular-nums; margin: 6px 0 0; }
.cl-big small { font-size: 1.1rem; color: var(--muted); }
.cl-beat { text-align: center; color: var(--teal); font-weight: 650; margin: 6px 0 0; min-height: 1.5em; }
.cl-sq { text-align: center; font-size: 1.6rem; letter-spacing: 4px; margin: 6px 0 4px; }
.cl-rows { margin: 14px 0; display: grid; gap: 8px; }
.cl-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbf7ee; }
.cl-row .clues { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cl-row .yours { font-weight: 750; }
.cl-row .pts { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.cl-row .bst { grid-column: 1 / -1; font-size: .88rem; color: var(--muted); }
.cl-row .bst b { color: var(--teal); }
.cl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cl-actions .btn { padding: 13px 10px; }
.cl-count { text-align: center; color: var(--muted); margin: 14px 0 0; font-size: .92rem; }
.cl-toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; font-weight: 600; box-shadow: var(--shadow); }

.cl-modal { position: fixed; inset: 0; background: rgba(30, 34, 48, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.cl-modal .box { background: var(--card); border-radius: 18px; max-width: 480px; width: 100%; max-height: 90vh; overflow: auto; padding: 22px; position: relative; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.cl-modal h2 { font: 700 1.4rem var(--serif); margin: 0 0 10px; }
.cl-modal .x { position: absolute; right: 12px; top: 12px; }
.cl-modal ul { padding-left: 20px; }
.cl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin: 10px 0; }
.cl-stats b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.cl-stats span { font-size: .78rem; color: var(--muted); }
.cl-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }

.after-game { max-width: 720px; margin: 34px auto 0; }
.after-game h2 { font: 700 1.45rem/1.25 var(--serif); margin: 28px 0 8px; }

@media (max-width: 520px) {
  .site-main { padding: 0 12px 30px; }
  .cl-card { padding: 16px 13px; border-radius: 16px; }
  .cl-clue { grid-template-columns: 1fr; gap: 6px; padding: 10px 12px; }
  .chain { width: 100%; max-width: 230px; height: 24px; }
  .cl-clue .n { text-align: left; }
  .cl-entry .btn { padding: 12px 16px; }
  .page-title { font-size: 1.6rem; }
  .cl-actions { grid-template-columns: 1fr; }
}
