/* Riddle Maze — clean, high-contrast, mobile-first. No frameworks. */
:root {
  --bg: #f4f0fa; --panel: #fffdf7; --ink: #3c1e60; --line: #2b2f3a;
  --thin: #c3b9d6; --accent: #7c3aed; --ok: #15803d; --bad: #dc2626;
  --gem: #fff; --path: #d8c9f5; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.4; -webkit-text-size-adjust: 100%; }
.wrap { max-width: 760px; margin: 0 auto; padding: 14px 14px 40px; }

header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
header h1 { font-size: 1.5rem; margin: 0; letter-spacing: .5px; }
header .sub { flex: 1 1 100%; color: #6b7280; font-size: .92rem; margin: 2px 0 8px; }
.spacer { flex: 1; }
.iconbtn { border: 1px solid var(--thin); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-size: .95rem; cursor: pointer; min-height: 40px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin: 8px 0 8px; flex-wrap: wrap; }
.toolbar button { min-height: 44px; border-radius: 10px; border: 1px solid var(--thin);
  background: var(--panel); color: var(--ink); font-size: 1rem; padding: 0 14px; cursor: pointer; }
#newBtn { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.meta { margin-left: auto; font-variant-numeric: tabular-nums; }

.riddle { text-align: center; font-size: 1.25rem; font-weight: 700; margin: 6px 0; }
.hintbar { color: #6b7280; font-size: .86rem; margin: 0 0 8px; text-align: center; }
.collected { text-align: center; font: 700 1.8rem/1 "Consolas", monospace; letter-spacing: 8px;
  color: var(--accent); min-height: 34px; margin: 4px 0 8px; }

.canvaswrap { display: flex; justify-content: center; }
#board { background: var(--panel); border: 3px solid var(--line); border-radius: 6px;
  touch-action: none; user-select: none; -webkit-user-select: none; max-width: 100%; }

.status { text-align: center; min-height: 28px; margin: 12px 0; font-weight: 700; font-size: 1.15rem; }
.status.win { color: var(--ok); } .status.bad { color: var(--bad); }

.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 4px 0; }
.actions button { min-height: 48px; border-radius: 10px; border: 1px solid var(--thin);
  background: var(--panel); color: var(--ink); font-size: .95rem; cursor: pointer; padding: 0 16px; }

body.large .wrap { max-width: 1100px; } body.large .riddle { font-size: 1.5rem; }

.book { background: var(--panel); border: 1px solid var(--thin); border-radius: var(--radius);
  padding: 16px; margin: 22px 0 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.book h3 { margin: 0 0 4px; font-size: 1.05rem; } .book p { margin: 0; color: #555; font-size: .92rem; }
.book .rm-ico { width: 54px; height: 54px; flex: none; border: 3px solid var(--line); border-radius: 8px;
  background: radial-gradient(circle at 32% 32%, var(--accent) 22%, transparent 23%),
              radial-gradient(circle at 70% 70%, var(--accent) 22%, transparent 23%); }

.crosslinks { text-align: center; margin: 8px 0 0; font-size: .9rem; }
.crosslinks a { color: #6b7280; text-decoration: none; margin: 0 4px; }
.crosslinks a:hover { text-decoration: underline; }
footer { text-align: center; color: #8a8f9a; font-size: .82rem; margin-top: 16px; }
footer .links a { color: #6b7280; text-decoration: none; margin: 0 6px; }
.privacy { margin-top: 6px; }

@media print {
  body { background: #fff; }
  .toolbar, .actions, .book, .crosslinks, footer, header .sub, .hintbar, #langBtn, #largeBtn, .meta, .collected, .status { display: none !important; }
  #board { border-color: #000; }
}
@media (max-width: 420px) { header h1 { font-size: 1.3rem; } .riddle { font-size: 1.05rem; } .collected { font-size: 1.4rem; letter-spacing: 5px; } }
