/* DeskBrief — looks like an office document viewer. Gray/white only, no bright accents. */
:root {
  --bg: #eef0f3; --paper: #ffffff; --line: #d9dde3; --line-soft: #e8ebef;
  --ink: #1f2937; --ink-2: #4b5563; --ink-3: #6b7280; --ink-4: #9ca3af;
  --accent: #374151; --accent-soft: #e5e7eb; --focus: #6b7280;
  --cell: #f3f4f6; --cell-2: #e5e7eb; --cell-3: #d1d5db; --cell-4: #9ca3af; --cell-5: #6b7280; --cell-6: #4b5563;
  --radius: 6px; --panel-w: 360px;
  --font: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans JP", "Noto Sans SC", "Noto Sans TC", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--ink-2); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 6px 10px; border: 1px solid var(--line); z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- top bar: a document app toolbar ---------- */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); height: 48px; display: flex; align-items: center; padding: 0 16px; gap: 16px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 600; letter-spacing: .01em; }
.brand svg { width: 20px; height: 20px; color: var(--ink-3); }
.topbar nav { display: flex; gap: 2px; margin-left: 4px; }
.topbar nav a { text-decoration: none; padding: 6px 10px; border-radius: 4px; font-size: 14px; color: var(--ink-2); }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar .tool { background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 5px 8px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.topbar .tool:hover { background: var(--accent-soft); border-color: var(--line); }
.topbar .tool svg { width: 16px; height: 16px; }
.lang-wrap { position: relative; }
.lang-wrap select { appearance: none; -webkit-appearance: none; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 5px 24px 5px 8px; font-size: 13px; color: var(--ink-2); max-width: 150px; }
.lang-wrap select:hover { background: var(--accent-soft); border-color: var(--line); }
.lang-wrap::after { content: ""; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.doc-crumbs { color: var(--ink-3); font-size: 13px; display: none; align-items: center; gap: 6px; }
.doc-crumbs .doc-title { color: var(--ink); font-weight: 500; }

/* ---------- ad slots: outside the game area only ---------- */
.ad { background: var(--paper); border: 1px dashed var(--line); color: var(--ink-4); font-size: 11px; text-align: center; min-height: 0; }
.ad[hidden] { display: none; }
.ad-top, .ad-bottom { margin: 12px auto 0; width: min(1200px, calc(100% - 32px)); }
.ad-side { margin-top: 12px; }
.ad .ad-label { display: block; padding: 2px 0; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- layout ---------- */
.layout { width: min(1200px, calc(100% - 32px)); margin: 16px auto; display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); gap: 16px; align-items: start; flex: 1; }
.layout.single { grid-template-columns: minmax(0, 1fr); }
.doc { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-height: 70vh; padding: 48px 56px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.doc-screen[hidden] { display: none; }
.doc.only-work { display: none; }
html[data-mode="work"] .doc.only-work { display: block; }
html[data-mode="work"] .layout > :not(.doc) { display: none !important; }
.panel { position: sticky; top: 64px; }

/* ---------- fake document screens ---------- */
.rep h1 { font-size: 24px; margin: 0 0 4px; font-weight: 600; }
.rep .sub { color: var(--ink-3); margin: 0 0 20px; font-size: 14px; }
.rep .meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; font-size: 13px; color: var(--ink-2); border: 1px solid var(--line-soft); padding: 10px 14px; border-radius: 4px; margin-bottom: 24px; background: #fafafa; }
.rep .meta dt { color: var(--ink-3); } .rep .meta dd { margin: 0; }
.rep h2 { font-size: 17px; margin: 28px 0 8px; font-weight: 600; padding-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.rep p { margin: 0 0 12px; color: var(--ink-2); text-align: justify; }
.rep ol.toc { columns: 2; font-size: 13.5px; color: var(--ink-2); padding-left: 20px; margin: 0 0 8px; }
.rep table, .sheet table, .news table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rep table { margin: 8px 0 14px; }
.rep th, .rep td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.rep th { background: var(--cell); font-weight: 600; }
.rep td.num, .rep th.num, .sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rep .cap { font-size: 12px; color: var(--ink-3); margin: -8px 0 16px; }
.chart { margin: 8px 0 16px; font-size: 12.5px; }
.chart .row { display: grid; grid-template-columns: 140px 1fr 48px; align-items: center; gap: 8px; margin: 4px 0; color: var(--ink-2); }
.chart .bar { height: 14px; background: var(--cell-2); border-radius: 2px; overflow: hidden; }
.chart .bar i { display: block; height: 100%; background: var(--cell-5); }
.chart .val { text-align: right; font-variant-numeric: tabular-nums; }
.rep .note { font-size: 12px; color: var(--ink-4); border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 28px; }

.sheet { padding: 0; overflow: hidden; }
.sheet .toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); background: #fafafa; }
.sheet .toolbar .cellref { font-family: var(--mono); border: 1px solid var(--line); background: #fff; padding: 2px 8px; border-radius: 3px; min-width: 56px; }
.sheet .toolbar .fx { flex: 1; border: 1px solid var(--line); background: #fff; padding: 2px 8px; border-radius: 3px; font-family: var(--mono); color: var(--ink-3); }
.sheet .grid { overflow: auto; max-height: 72vh; }
.sheet table { font-size: 12.5px; min-width: 760px; }
.sheet th, .sheet td { border: 1px solid var(--line-soft); padding: 4px 8px; white-space: nowrap; }
.sheet th { background: var(--cell); color: var(--ink-2); font-weight: 500; text-align: center; position: sticky; top: 0; }
.sheet td.rh, .sheet th.rh { background: var(--cell); text-align: center; color: var(--ink-3); width: 36px; position: sticky; left: 0; }
.sheet tr.head td { font-weight: 600; background: #fafafa; }
.sheet tr.total td { font-weight: 600; border-top: 2px solid var(--cell-3); }
.sheet td.sel { outline: 2px solid var(--ink-3); outline-offset: -2px; }
.sheet .tabs { display: flex; gap: 2px; border-top: 1px solid var(--line); background: #fafafa; padding: 4px 8px 0; font-size: 12.5px; }
.sheet .tabs span { padding: 4px 14px; border: 1px solid var(--line); border-bottom: 0; background: #f0f1f3; color: var(--ink-3); border-radius: 4px 4px 0 0; }
.sheet .tabs span.on { background: #fff; color: var(--ink); font-weight: 500; }

.news h1 { font-size: 20px; margin: 0; font-weight: 600; }
.news .dateline { color: var(--ink-3); font-size: 13px; margin: 2px 0 16px; }
.news .tabsrow { display: flex; gap: 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; margin-bottom: 8px; }
.news .tabsrow span { padding: 6px 2px; color: var(--ink-3); }
.news .tabsrow span.on { color: var(--ink); border-bottom: 2px solid var(--ink); }
.news-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
.news .item { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.news .item h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 600; }
.news .item p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.news .src { font-size: 12px; color: var(--ink-4); margin-top: 4px; }
.news aside h4 { font-size: 13px; color: var(--ink-3); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.news aside ol { padding-left: 20px; margin: 0; font-size: 13.5px; } .news aside li { margin: 6px 0; color: var(--ink-2); }

/* ---------- game panel: a small side window ---------- */
.panel .win { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden; }
.win-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafafa; font-size: 13px; }
.win-head .dots { display: flex; gap: 5px; } .win-head .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--cell-3); display: block; }
.win-head .title { flex: 1; font-weight: 500; color: var(--ink-2); }
.win-head .hint { color: var(--ink-4); font-size: 11.5px; }
.win-head kbd { font: 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; background: #fff; color: var(--ink-2); }
.win-body { padding: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.stats div { background: var(--cell); border-radius: 4px; padding: 4px 8px; font-size: 11px; color: var(--ink-3); }
.stats b { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
#game-root { position: relative; background: var(--cell); border-radius: 4px; display: flex; justify-content: center; align-items: center; min-height: 200px; outline: none; }
#game-root .g-canvas { display: block; max-width: 100%; height: auto; background: #fff; border-radius: 3px; outline: none; }
#game-root.is-paused::after { content: attr(data-paused); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(243,244,246,.86); color: var(--ink-2); font-size: 14px; font-weight: 500; border-radius: 4px; cursor: pointer; }
#g-extra { font-size: 12px; color: var(--ink-3); margin-top: 6px; min-height: 16px; display: flex; gap: 12px; flex-wrap: wrap; }
.g-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-radius: 4px; text-align: center; padding: 16px; }
.g-overlay[hidden] { display: none; }
.g-overlay h3 { margin: 0; font-size: 16px; font-weight: 600; }
.g-overlay .big { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0 8px; }
.ctrl { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 6px 10px; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--cell); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: #1f2937; }
.btn svg { width: 14px; height: 14px; }
.howto { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 0; line-height: 1.5; }
.howto kbd { font: 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; background: #fff; }
.panel .side-links { margin-top: 10px; font-size: 12.5px; }
.panel .side-links a { display: block; padding: 5px 8px; border-radius: 4px; text-decoration: none; color: var(--ink-2); }
.panel .side-links a:hover { background: var(--paper); }
.touch-pad { display: none; grid-template-columns: repeat(3, 44px); gap: 4px; justify-content: center; margin-top: 8px; }
.touch-pad button { height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 4px; font-size: 16px; }
@media (pointer: coarse) { .touch-pad { display: grid; } }

/* ---------- work mode: one attribute flips everything ---------- */
html[data-mode="work"] .panel, html[data-mode="work"] .ad, html[data-mode="work"] .nav-games, html[data-mode="work"] .footer-games,
html[data-mode="work"] .hero, html[data-mode="work"] .game-grid, html[data-mode="work"] .brand-name, html[data-mode="work"] .topbar .tool-settings,
html[data-mode="work"] .cookie-notice, html[data-mode="work"] dialog[open], html[data-mode="work"] .premium-box { display: none !important; }
html[data-mode="work"] .layout { grid-template-columns: minmax(0, 1fr); width: min(960px, calc(100% - 32px)); }
html[data-mode="work"] .doc-crumbs { display: flex; }
html[data-mode="work"] body { background: var(--bg); }
/* no transitions anywhere: the swap must be a single paint */
html[data-mode="work"] *, html[data-mode="work"] *::before, html[data-mode="work"] *::after { transition: none !important; animation: none !important; }

/* ---------- home ---------- */
.hero { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; margin-bottom: 16px; }
.hero h1 { font-size: 24px; margin: 0 0 6px; font-weight: 600; }
.hero p { margin: 0 0 12px; color: var(--ink-2); max-width: 720px; }
.hero .how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.hero .how div { background: var(--cell); border-radius: 4px; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); }
.hero .how b { display: block; color: var(--ink); margin-bottom: 2px; }
.hero kbd { font: 12px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; background: #fff; }
.section-title { font-size: 15px; font-weight: 600; margin: 20px 0 10px; color: var(--ink-2); display: flex; justify-content: space-between; align-items: baseline; }
.section-title a { font-size: 13px; font-weight: 400; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.game-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.game-card:hover { border-color: var(--cell-4); }
.game-card .ico { width: 36px; height: 36px; color: var(--ink-3); }
.game-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.game-card p { margin: 0; font-size: 12.5px; color: var(--ink-3); flex: 1; }
.game-card .best { font-size: 11.5px; color: var(--ink-4); }
.article-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.article-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.article-card:hover { border-color: var(--cell-4); }
.article-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.article-card p { margin: 0; font-size: 13px; color: var(--ink-3); }
.article-card .meta { font-size: 11.5px; color: var(--ink-4); margin-top: 8px; }

/* ---------- article / static page ---------- */
.prose { max-width: 760px; margin: 0 auto; }
.prose h1 { font-size: 26px; font-weight: 600; margin: 0 0 6px; }
.prose .meta { color: var(--ink-4); font-size: 13px; margin-bottom: 20px; }
.prose h2 { font-size: 18px; margin: 28px 0 8px; font-weight: 600; }
.prose h3 { font-size: 15.5px; margin: 20px 0 6px; font-weight: 600; }
.prose p, .prose li { color: var(--ink-2); }
.prose table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 10px 0 16px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose th { background: var(--cell); }
.prose blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--cell-3); color: var(--ink-3); background: #fafafa; }
.prose .lang-note { background: var(--cell); border-radius: 4px; padding: 8px 12px; font-size: 13px; color: var(--ink-3); margin-bottom: 16px; }
.prose .related { margin-top: 32px; border-top: 1px solid var(--line-soft); padding-top: 14px; font-size: 13.5px; }
.premium-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.premium-box b { display: block; color: var(--ink); margin-bottom: 2px; }
.affiliate-corner[hidden] { display: none; }

/* ---------- dialogs ---------- */
dialog { border: 1px solid var(--line); border-radius: 8px; padding: 0; max-width: min(520px, calc(100vw - 32px)); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.15); }
dialog::backdrop { background: rgba(31,41,55,.35); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
dialog .dlg-body { padding: 16px; }
dialog .dlg-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: transparent; border: 0; font-size: 20px; line-height: 1; color: var(--ink-3); padding: 2px 6px; }
.field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.field:last-child { border-bottom: 0; }
.field small { display: block; color: var(--ink-4); font-size: 12px; }
.field select, .field input[type="time"] { border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; background: #fff; }
.keybtn { font: 13px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 4px 12px; background: #fff; min-width: 56px; }
.switch { position: relative; width: 38px; height: 22px; appearance: none; background: var(--cell-3); border-radius: 11px; cursor: pointer; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch:checked { background: var(--accent); } .switch:checked::after { left: 18px; }
#share-img { width: 100%; border: 1px solid var(--line); border-radius: 4px; display: block; }
.cookie-notice { position: fixed; bottom: 12px; left: 12px; right: 12px; max-width: 560px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; font-size: 13px; display: flex; gap: 12px; align-items: center; z-index: 50; box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.cookie-notice[hidden] { display: none; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); background: var(--paper); margin-top: 24px; padding: 20px 16px 28px; font-size: 12.5px; color: var(--ink-3); }
footer .inner { width: min(1200px, 100%); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
footer a { color: var(--ink-3); text-decoration: none; margin-right: 14px; } footer a:hover { color: var(--ink); text-decoration: underline; }
footer .disclaimer { width: 100%; color: var(--ink-4); font-size: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; order: -1; }
  .doc { padding: 28px 24px; }
  .news-grid { grid-template-columns: 1fr; }
  .hero .how { grid-template-columns: 1fr; }
  .topbar nav a { padding: 6px 7px; font-size: 13px; }
  .rep ol.toc { columns: 1; }
}
@media (max-width: 560px) {
  html { font-size: 14px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar nav .nav-articles, .topbar nav .nav-about { display: none; }
  .doc { padding: 20px 16px; }
  .panel .win-body { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .panel, .ad, .topbar, footer { display: none !important; } .doc { border: 0; padding: 0; } }

/* typing game */
.typing { width: 100%; padding: 4px; }
.page-game .typing { min-height: 160px; }
.typing-target { font-size: 14.5px; line-height: 1.7; background: #fff; border-radius: 4px; padding: 10px 12px; min-height: 84px; color: #9ca3af; word-break: break-word; }
.typing-target .ok { color: #1f2937; }
.typing-target .bad { color: #1f2937; background: #e5e7eb; text-decoration: underline; }
.typing-target .cur { border-bottom: 2px solid #6b7280; }
.typing-input { width: 100%; margin-top: 8px; border: 1px solid #d9dde3; border-radius: 4px; padding: 8px 10px; font: inherit; resize: none; background: #fff; }
