:root { --paper: #f6efdf; --ink: #241c14; --curry: #8a4b14; --turmeric: #f0b429; --red: #e0312b; --dim: #7d6b55; --sheet: #fffaf0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b2118; }
body { position: fixed; inset: 0; font: 16px/1.4 "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; }
#stage { position: absolute; left: 0; top: 0; width: 960px; height: 540px; transform-origin: 0 0; overflow: hidden; background: var(--paper); }
#cv { position: absolute; inset: 0; width: 960px; height: 540px; touch-action: none; }
.hidden { display: none !important; }

button { font: inherit; font-weight: 700; color: var(--ink); background: var(--turmeric); border: 3px solid var(--ink); border-radius: 12px; padding: 8px 18px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
button.ghost { background: var(--sheet); }
button.big { font-size: 22px; padding: 10px 34px; }
button.icon { width: 44px; height: 44px; padding: 0; font-size: 22px; line-height: 1; background: var(--sheet); }
input { font: inherit; padding: 7px 10px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; width: 170px; }
.row { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.dim { color: var(--dim); font-size: 14px; }

#hud { position: absolute; inset: 0; pointer-events: none; }
#hud button { pointer-events: auto; }
#hudLeft { position: absolute; left: 10px; top: 10px; display: flex; gap: 10px; align-items: center; }
#hudRight { position: absolute; right: 10px; top: 10px; display: flex; gap: 10px; align-items: center; }
#stageName, #strokes { font-weight: 700; font-size: 18px; background: rgba(255, 250, 240, .85); padding: 4px 12px; border-radius: 10px; }
#hint { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); max-width: 760px; text-align: center; font-weight: 700; font-size: 18px; background: rgba(255, 250, 240, .92); border: 2px dashed var(--curry); padding: 6px 16px; border-radius: 12px; transition: opacity .6s; }
#hint:empty { display: none; }
#hint.fade { opacity: 0; }
#lostMsg, #replayBar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; font-weight: 700; background: rgba(255, 250, 240, .95); border: 3px solid var(--ink); padding: 6px 8px 6px 16px; border-radius: 14px; white-space: nowrap; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(246, 239, 223, .9); }
#logo { max-width: 620px; max-height: 210px; }
#logo[src=""] { display: none; }
#title h1 { margin: 0 0 18px; font-size: 52px; letter-spacing: .06em; }
#title h1:empty { display: none; }
#select h2 { margin: 0 0 14px; }
#select h2 { margin-bottom: 4px; }
.pager { margin: 0 0 10px; gap: 14px; font-weight: 700; }
.pager button:disabled { opacity: .35; }
#grid { display: grid; grid-template-columns: repeat(10, 72px); gap: 8px; margin-bottom: 12px; }
#grid button { height: 60px; font-size: 20px; padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 24px; }
#grid button small { font-size: 12px; font-weight: 700; }
#grid button.done { background: #ffe7a6; }
#grid button:disabled { background: #ddd2bd; color: #9a8d78; cursor: default; }

.sheet { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 420px; max-width: 640px; max-height: 500px; overflow: auto; background: var(--sheet); border: 4px solid var(--ink); border-radius: 18px; padding: 16px 24px; text-align: center; box-shadow: 0 8px 0 rgba(0, 0, 0, .25); }
.sheet h2 { margin: 4px 0 8px; }
#clearTitle { color: var(--red); font-size: 34px; }
#clearStrokes { font-size: 22px; font-weight: 700; margin: 0; }
#solsList { list-style: none; padding: 0; margin: 0 0 12px; text-align: left; }
#solsList li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 2px dashed #e2d5bd; cursor: pointer; }
#solsList li:hover { background: #fff1cc; }
#solsList li b { min-width: 52px; }
#solsList li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#solsList li.msg { cursor: default; color: var(--dim); justify-content: center; }
#solsList li.me { background: #ffe7a6; }
#howBody { text-align: left; font-size: 16px; }
#howBody li { margin: 5px 0; }

#rotate { display: none; position: fixed; inset: 0; background: #2b2118; color: #fff; align-items: center; justify-content: center; text-align: center; font-size: 22px; font-weight: 700; padding: 24px; }
@media (orientation: portrait) and (max-width: 820px) { #rotate { display: flex; } }
