@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/dmmono-400.woff2) format("woff2"); }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/dmmono-500.woff2) format("woff2"); }
:root { --ink: #1f2228; --muted: #6c737d; --card: #fffdf8; --cream: #f1ede2; --gold: #d9b45f;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: #171b19; color: var(--ink); font: 15px/1.5 var(--ui); }

#game { position: relative; display: flex; flex-direction: column; height: 100vh; height: 100svh; min-height: 460px; overflow: hidden;
  --f1: #2c4f41; --f2: #264538; --f3: #1d362c;
  background: radial-gradient(ellipse 110% 95% at 50% 40%, var(--f1) 0%, var(--f2) 55%, var(--f3) 100%); -webkit-user-select: none; user-select: none; }
#game::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 180px rgba(0,0,0,0.22); }
header, #bar { position: relative; z-index: 2; flex: none; display: flex; align-items: center; gap: 8px; color: var(--cream);
  background: linear-gradient(180deg, rgba(0,0,0,0.44), rgba(0,0,0,0.36)); }
header { height: 54px; padding: 0 14px 0 18px; border-bottom: 1px solid rgba(255,255,255,0.07); box-shadow: 0 1px 0 rgba(0,0,0,0.25); }
#bar { padding: 9px 14px; border-top: 1px solid rgba(255,255,255,0.07); box-shadow: 0 -1px 0 rgba(0,0,0,0.25); }
h1 { font-size: 17px; margin: 0 6px 0 0; font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; }
h1 span { font-weight: 500; opacity: 0.6; }
.grow { flex: 1; }

button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 14px var(--ui); color: var(--ink); background: var(--card);
  border: 1px solid rgba(0,0,0,0.18); border-radius: 11px; padding: 8px 14px; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.08s, opacity 0.15s; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.35; cursor: default; }
button svg { flex: none; }
header button, #bar button { color: var(--cream); background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.14); height: 36px; padding: 0 13px; }
header button:hover, #bar button:not(:disabled):hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.26); }
header button.icon, #bar button.icon { width: 36px; padding: 0; }
header button.solid { color: #1c2a24; background: var(--cream); border-color: transparent; font-weight: 700; }
header button.solid:hover { background: #fff; }
#numBtn { gap: 7px; border-radius: 999px; font-size: 13px; height: 32px; padding: 0 12px; }
#numBtn .long { opacity: 0.6; font-weight: 500; }
#numBtn b { font: 500 13.5px var(--mono); letter-spacing: -0.01em; }
#numBtn i { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: 0.55; }
.short { display: none; }

#table { position: relative; flex: 1; min-height: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#toast { position: absolute; z-index: 3; left: 50%; bottom: 16px; transform: translate(-50%, 8px); max-width: calc(100% - 24px); padding: 10px 18px; border-radius: 999px;
  background: rgba(12,18,16,0.88); color: #fff; font-weight: 600; font-size: 14px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.1);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#dead { position: absolute; z-index: 4; left: 50%; bottom: 16px; transform: translate(-50%, 12px); display: flex; align-items: center; gap: 12px; max-width: calc(100% - 20px); padding: 8px 8px 8px 18px; border-radius: 999px;
  background: rgba(72,20,16,0.94); color: #ffe9e2; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,170,150,0.28); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
#dead.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
#dead.show ~ #toast, #toast:has(~ #dead.show) { bottom: 72px; }
#deadMsg { white-space: nowrap; }
#dead button { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; background: #ffe9e2; color: #4a1510; border-color: transparent; white-space: nowrap; }

#bar .stat { display: inline-flex; align-items: baseline; gap: 7px; margin-right: 10px; white-space: nowrap; }
#bar .stat i { font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.5; }
#bar .stat b { font: 500 17px var(--mono); letter-spacing: -0.02em; }
#bar #hint { color: #2a2206; background: var(--gold); border-color: transparent; font-weight: 700; }
#bar #hint:not(:disabled):hover { background: #e6c373; border-color: transparent; }
#hint.busy { opacity: 0.6; }

#win { position: absolute; left: 50%; top: 50%; z-index: 5; width: 320px; max-width: calc(100% - 32px); padding: 24px 22px 18px; border-radius: 22px; text-align: center;
  background: var(--card); box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(0,0,0,0.06); opacity: 0; pointer-events: none; transform: translate(-50%, -46%) scale(0.96); transition: opacity 0.25s, transform 0.25s; }
#win.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
#win .dh { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
#win .sub { color: var(--muted); margin-bottom: 14px; font: 500 13px var(--mono); }
#win .nums { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; }
#winNote { min-height: 20px; margin: 0 0 14px; font-size: 13.5px; font-weight: 600; color: #2b7a4f; }
#winShare { width: 100%; height: 40px; margin-bottom: 8px; }
#win .nums div { flex: 1; padding: 10px 0 8px; border-radius: 14px; background: #f3efe5; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
#win .nums b { display: block; font: 500 26px var(--mono); letter-spacing: -0.03em; color: var(--ink); text-transform: none; }
#win .btns, .dlg .btns { display: flex; gap: 8px; }
#win .btns button, .dlg .btns button { flex: 1; height: 42px; }
.primary { background: #1f6e4d; color: #fff; border-color: transparent; }
.primary:hover { background: #24805a; }

.dlg { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(6,16,12,0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); padding: 16px; }
.dlg.show { display: flex; }
.dlg .card { width: 350px; max-width: 100%; padding: 20px; border-radius: 22px; background: var(--card); box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
.dlg .dh { font-size: 18px; font-weight: 800; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.dlg .dh button { width: 30px; height: 30px; padding: 0; border-radius: 50%; background: #f1ede2; border-color: transparent; }
.dlg .lab { font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 16px 2px 7px; }
.dlg .lab:first-of-type { margin-top: 0; }
.seg { display: flex; gap: 0; padding: 3px; border-radius: 12px; background: #ebe6d9; }
.seg button { flex: 1; height: 34px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.16); }
#numRandom { width: 100%; height: 42px; margin-top: 8px; }
#dailyBtn { width: 100%; justify-content: flex-start; gap: 12px; padding: 10px 14px; text-align: left; background: #fff7e2; border-color: #e6cf93; }
#dailyBtn:hover { background: #fff1cf; }
#dailyBtn svg { color: #b98a16; }
#dailyBtn div { display: flex; flex-direction: column; line-height: 1.3; }
#dailyBtn span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
#dailyBtn.done { background: #eaf4ec; border-color: #b9d6c0; } #dailyBtn.done svg { color: #2b7a4f; }
.numrow { display: flex; gap: 8px; } .numrow input[type="number"] { flex: 1; min-width: 0; font-size: 20px; padding: 7px 12px; } .numrow button { flex: none; height: auto; padding: 0 16px; }
#themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
#themes button { flex-direction: column; gap: 5px; padding: 6px 2px 5px; border-radius: 12px; border: 1.5px solid transparent; background: transparent; font-size: 11px; font-weight: 600; color: var(--muted); }
#themes button i { width: 100%; aspect-ratio: 1.25; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25); }
#themes button.on { border-color: #1f6e4d; color: var(--ink); background: #fff; }
.chk { display: flex; align-items: center; gap: 10px; padding: 7px 2px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.chk input { width: 18px; height: 18px; margin: 0; accent-color: #1f6e4d; flex: none; }
.chk small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
#fullBtn { width: 100%; height: 40px; margin-top: 6px; }
#stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#stats div { padding: 8px 2px 6px; border-radius: 11px; background: #f3efe5; text-align: center; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); line-height: 1.25; }
#stats b { display: block; font: 500 18px var(--mono); letter-spacing: -0.03em; color: var(--ink); text-transform: none; }
#statsReset { all: unset; cursor: pointer; display: block; margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.dlg input[type="number"] { width: 100%; font: 500 24px var(--mono); padding: 10px 14px; border-radius: 12px; border: 1.5px solid rgba(0,0,0,0.16); background: #fff; outline: none; }
.dlg input[type="number"]:focus { border-color: #1f6e4d; }
.dlg .note { font-size: 12.5px; color: var(--muted); min-height: 36px; margin: 8px 2px 0; }

#more { display: block; text-align: center; padding: 12px; color: #b9c4be; font-size: 13.5px; text-decoration: none; }
#more:hover { color: #fff; }
article { color: #d6ddd8; background: #171b19; }
article > div { max-width: 780px; margin: 0 auto; padding: 8px 18px 36px; font-size: 16px; line-height: 1.65; }
article h2 { font-size: 23px; line-height: 1.25; margin: 34px 0 10px; color: #fff; letter-spacing: -0.01em; }
article h3 { font-size: 17px; margin: 22px 0 4px; color: #f1f4f2; }
article p { margin: 0 0 12px; } article li { margin-bottom: 7px; } article ol, article ul { padding-left: 22px; margin: 0 0 12px; }
article a { color: #f0cf7a; text-underline-offset: 3px; }
article strong { color: #f1f4f2; }
article table { width: 100%; border-collapse: collapse; margin: 6px 0 16px; font-size: 14.5px; }
article th, article td { text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.1); vertical-align: top; }
article th { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #9fb0a7; font-weight: 600; }
article td.n { font-family: var(--mono); white-space: nowrap; color: #fff; }
article .note { font-size: 13.5px; color: #9fb0a7; }
article figure { margin: 14px 0 18px; } article figure img { display: block; width: 100%; height: auto; border-radius: 12px; } article figcaption { font-size: 13px; color: #9fb0a7; margin-top: 6px; }
footer { background: #171b19; color: #b9c4be; padding: 8px 0 34px; }
footer a { color: inherit; }

@media (max-width: 620px) {
  header { height: 50px; padding: 0 8px 0 12px; gap: 6px; }
  h1 { font-size: 16px; } h1 span { display: none; }
  .long { display: none; } .short { display: inline; }
  #bar { gap: 6px; padding: 8px; }
  #bar .stat { margin-right: 4px; gap: 5px; } #bar .stat i { font-size: 9.5px; letter-spacing: 0.08em; } #bar .stat b { font-size: 15px; }
  header button, #bar button { padding: 0 11px; }
  #bar .stat { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; margin-right: 8px; }
  #undo span { display: none; } #undo, #restart { width: 40px; padding: 0; }
  #dead { font-size: 12.5px; padding-left: 14px; gap: 8px; bottom: 10px; } #dead button { padding: 0 11px; font-size: 13px; }
  #numBtn { padding: 0 10px; }
  #bar button { height: 40px; } #bar button.icon { width: 40px; }
}
