/* 옮게임즈(ormgames): 로고에 맞춘 스티커풍(굵은 먹선·노랑·하늘색·둥근 글씨) */
:root {
  --bg: #fffaf0;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --ink: #1d1d1f;
  --ink-2: #5f5d66;
  --edge: #1d1d1f;
  --line: #e9e3d6;
  --yellow: #ffd60a;
  --yellow-2: #ffe680;
  --blue: #2fa8ec;
  --blue-ink: #ffffff;
  --wood: #ecbd66;
  --wood-line: #8a5a1c;
  --radius: 20px;
  --pop: 0 4px 0 var(--edge);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #19191d; --surface: #26262d; --surface-2: #31313a; --ink: #f5f3ee; --ink-2: #b3b0ba;
    --edge: #000000; --line: #3a3a44; --wood: #d7a752; --wood-line: #5e3c10;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #19191d; --surface: #26262d; --surface-2: #31313a; --ink: #f5f3ee; --ink-2: #b3b0ba;
  --edge: #000000; --line: #3a3a44; --wood: #d7a752; --wood-line: #5e3c10;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px; line-height: 1.75; word-break: keep-all; overflow-wrap: anywhere;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, .card-body strong, .status, .toast strong, .score b, .hero-lead, .foot-title, .btn-big, .game-head p, .logo-text {
  font-family: "Jua", "Pretendard Variable", Pretendard, sans-serif; font-weight: 400; letter-spacing: 0;
}
h1, h2, h3 { line-height: 1.3; }
h1 { font-size: clamp(32px, 7vw, 44px); margin: 8px 0 4px; }
h2 { font-size: clamp(24px, 5vw, 29px); margin: 46px 0 10px; display: flex; align-items: center; }
h2::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none; margin-right: 18px;
  background: #1d1d1f; box-shadow: 10px 0 0 -2px #fff, 10px 0 0 0 #1d1d1f;
}
h3 { font-size: 18px; margin: 24px 0 6px; }
p { margin: 0 0 12px; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* 머리 */
.top { background: var(--surface); border-bottom: 3px solid var(--edge); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 18px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.logo img { display: block; width: 46px; height: 46px; border-radius: 12px; box-shadow: 0 3px 0 var(--edge); }
.logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.logo-text b { font-weight: 400; font-size: 23px; }
.logo-text small { font-size: 13px; color: var(--ink-2); }
.top-nav { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 7px; margin-left: auto; }
.top-nav a {
  text-decoration: none; font-weight: 800; font-size: 15px; white-space: nowrap; color: #1d1d1f;
  padding: 3px 14px; border: 2.5px solid var(--edge); border-radius: 999px; background: var(--yellow);
  box-shadow: 0 3px 0 var(--edge); transition: transform .1s, box-shadow .1s;
}
.top-nav a:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--edge); }

.crumb { font-size: 13px; color: var(--ink-2); margin: 18px 0 0; }
.crumb a { text-decoration: none; }

/* 첫 화면 */
.hero {
  position: relative; text-align: center; margin: 24px 0 0; padding: 22px 18px 30px;
  background: radial-gradient(circle at 12% 0%, #d6efff 0, transparent 42%), radial-gradient(circle at 92% 8%, #fff2b8 0, transparent 38%), var(--surface);
  border: 3px solid var(--edge); border-radius: 28px; box-shadow: 0 6px 0 var(--edge); overflow: hidden;
}
.hero-logo { margin: 0 auto 2px; line-height: 0; }
.hero-logo img { width: min(100%, 600px); height: auto; }
.hero .hero-lead { font-size: clamp(19px, 4.4vw, 25px); color: var(--blue); margin: 0 0 6px; }
.hero p { color: var(--ink-2); max-width: 30em; margin: 0 auto 18px; }
.hero .made { font-size: 14px; margin: 16px auto 0; }
.btn-big {
  display: inline-flex; align-items: center; gap: 8px; font-size: 22px; text-decoration: none; color: #1d1d1f;
  background: var(--yellow); border: 3px solid var(--edge); border-radius: 999px; padding: 8px 28px 7px;
  box-shadow: 0 5px 0 var(--edge); transition: transform .1s, box-shadow .1s;
}
.btn-big:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--edge); }
.btn-big:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--edge); }
.stone-deco { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 3px solid #1d1d1f; }
.stone-deco.b { background: radial-gradient(circle at 35% 30%, #666, #111 60%); }
.stone-deco.w { background: #fff; }
.hero .s1 { left: 6%; bottom: 16%; } .hero .s2 { left: 11%; bottom: 8%; width: 18px; height: 18px; }
.hero .s3 { right: 6%; bottom: 13%; } .hero .s4 { right: 11%; bottom: 24%; width: 18px; height: 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin: 18px 0; }
.card {
  display: flex; gap: 14px; align-items: center; padding: 14px;
  background: var(--surface); border: 3px solid var(--edge); border-radius: var(--radius);
  text-decoration: none; box-shadow: var(--pop); transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--edge); }
.card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--edge); }
.card img { width: 82px; height: 82px; flex: none; border-radius: 16px; border: 3px solid var(--edge); }
.card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-body strong { font-size: 25px; line-height: 1.15; }
.card-tag { align-self: flex-start; font-size: 12px; font-weight: 800; color: #fff; background: var(--blue); border: 2px solid var(--edge); border-radius: 999px; padding: 0 8px; }
.card-blurb { font-size: 14px; color: var(--ink-2); line-height: 1.5; }

/* 글 */
.prose { max-width: 700px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 12px; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--blue); font-weight: 800; }
.answer { font-size: 17px; }
.answer strong { background: linear-gradient(transparent 60%, var(--yellow-2) 60%); }
.note { background: #e8f6ff; color: #173447; border: 3px solid var(--edge); border-radius: 16px; padding: 12px 16px; font-size: 15px; box-shadow: var(--pop); }
.note a { color: inherit; }
table.rules { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; margin: 10px 0 18px; background: var(--surface); border: 3px solid var(--edge); border-radius: 16px; overflow: hidden; }
table.rules th, table.rules td { border-bottom: 2px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
table.rules tr:last-child th, table.rules tr:last-child td { border-bottom: 0; }
table.rules tr:first-child th { background: var(--yellow); color: #1d1d1f; border-bottom: 3px solid var(--edge); }
table.rules th { white-space: nowrap; }

.faq details { background: var(--surface); border: 3px solid var(--edge); border-radius: 16px; margin: 12px 0; padding: 0 16px; box-shadow: 0 3px 0 var(--edge); }
.faq summary { cursor: pointer; font-weight: 800; padding: 12px 0; }
.faq summary::marker { color: var(--blue); }
.faq details[open] summary { color: var(--blue); }
.faq details p { color: var(--ink-2); padding-bottom: 14px; margin: 0; }

/* 바닥 */
.foot { margin-top: 70px; background: #1d1d1f; color: #c9c7cf; font-size: 14px; }
.foot-in { padding: 28px 16px 36px; }
.foot-in p { margin: 0 0 2px; }
.foot-title { font-size: 26px; color: #fff; }
.foot-title b { color: var(--yellow); font-weight: 400; }
.foot nav { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0 8px; }
.foot nav a { text-decoration: none; color: #fff; }
.foot nav a:hover { color: var(--yellow); }
.copy { font-size: 12px; opacity: .8; }

/* 게임 공통 */
.game-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 16px; }
.game-head p { color: var(--blue); margin: 0; font-size: 20px; }
.game { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 20px; align-items: start; margin: 20px 0 8px; }
.board-box {
  position: relative; width: min(100%, max(300px, calc(100svh - 108px))); justify-self: center;
  background: var(--surface); border: 3px solid var(--edge); border-radius: 24px; padding: 10px; box-shadow: 0 6px 0 var(--edge);
}
.board-box canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; touch-action: manipulation; border-radius: 14px; cursor: pointer; }
.panel { display: flex; flex-direction: column; gap: 16px; }
.box { background: var(--surface); border: 3px solid var(--edge); border-radius: var(--radius); padding: 14px; box-shadow: var(--pop); }
.box h2 { font-family: inherit; font-size: 13px; margin: 0 0 8px; color: var(--ink-2); font-weight: 800; display: block; }
.box h2::before { display: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 2px solid var(--edge); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 9px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 700; padding: 5px 4px; border-radius: 999px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--blue); color: var(--blue-ink); box-shadow: inset 0 0 0 2px var(--edge); }
.seg[hidden] { display: none; }
.btns { display: flex; gap: 10px; }
.btn {
  flex: 1; border: 3px solid var(--edge); background: var(--surface); color: var(--ink); font: inherit; font-weight: 800; font-size: 15px;
  padding: 8px; border-radius: 999px; cursor: pointer; box-shadow: 0 4px 0 var(--edge); transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--edge); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn.primary { background: var(--yellow); color: #1d1d1f; }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: 0 4px 0 var(--edge); }
.status { font-size: 23px; min-height: 1.5em; display: flex; align-items: center; gap: 8px; line-height: 1.25; }
.status .dot { width: 20px; height: 20px; border-radius: 50%; flex: none; border: 2.5px solid #1d1d1f; }
.dot.b { background: radial-gradient(circle at 35% 30%, #666, #111 60%); }
.dot.w { background: #fff; }
.hint { font-size: 13px; color: var(--ink-2); margin: 2px 0 8px; min-height: 1.5em; }
.score { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6px; }
.score > div { background: var(--surface-2); border: 2px solid var(--edge); border-radius: 14px; padding: 2px 0 4px; }
.score b { display: block; font-size: 30px; line-height: 1.2; }
.score span { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; font-weight: 600; }
.toggle input { accent-color: var(--blue); width: 16px; height: 16px; }

.toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.85); opacity: 0; pointer-events: none;
  background: var(--surface); border: 3px solid var(--edge); border-radius: 24px; padding: 18px 18px 20px; text-align: center;
  box-shadow: 0 6px 0 var(--edge); transition: opacity .2s, transform .25s cubic-bezier(.3, 1.5, .5, 1); width: min(300px, 86%); z-index: 3;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.toast strong { display: block; font-size: 36px; line-height: 1.15; margin-bottom: 4px; }
.toast .btn { white-space: nowrap; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-logo img { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
  :root:not([data-theme="light"]) .hero { background: var(--surface); }
  :root:not([data-theme="light"]) .note { background: #1d3442; color: #e1f2fc; }
}

@media (max-width: 760px) {
  .game { grid-template-columns: 1fr; }
  .board-box { padding: 6px; }
  .logo img { width: 42px; height: 42px; }
  .logo-text small { display: none; }
  .hero { padding: 16px 12px 24px; border-radius: 22px; }
  .hero .hero-lead { font-size: 18px; }
  .stone-deco { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 언어 전환 */
.lang-switch {
  flex: none; text-decoration: none; font-weight: 800; font-size: 13px; color: var(--ink);
  border: 2.5px solid var(--edge); border-radius: 999px; padding: 2px 10px; background: var(--surface);
  box-shadow: 0 3px 0 var(--edge); margin-bottom: 3px;
}
.lang-switch:hover { background: var(--blue); color: #fff; }
.top-nav + .lang-switch { margin-left: 4px; }
@media (max-width: 760px) { .top-in { gap: 10px; } .top-nav a { padding: 3px 11px; font-size: 14px; } }
.hero-mascot { display: block; width: min(100%, 520px); height: auto; margin: 0 auto 4px; }
.hero h1:not(.hero-logo) { margin: 0 0 4px; font-size: clamp(36px, 8vw, 54px); }

/* 바닥 누적 숫자 */
.site-stats { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 12px 0 6px !important; }
.site-stats span { background: rgba(255, 255, 255, .08); border: 1.5px solid rgba(255, 255, 255, .18); border-radius: 999px; padding: 2px 12px; }
.site-stats b { color: var(--yellow); font-family: "Jua", sans-serif; font-weight: 400; font-size: 16px; margin-left: 4px; }
.site-stats[hidden] { display: none; }
.top-nav { min-width: 0; flex: 1 1 auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
@media (max-width: 760px) {
  table.rules { display: block; overflow-x: auto; font-size: 14px; }
  table.rules th { white-space: normal; }
  table.rules th, table.rules td { padding: 7px 8px; }
}
