:root {
  --paper: #fbfaf4; --card: #fffef8; --rule: #bcd3ea; --margin: #f0a5a5;
  --pencil: #3b3b3f; --faint: #7a7a80; --red: #c62e2e; --box-line: #b8b8bc;
  --sketch: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--pencil); background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 46px, var(--margin) 46px, var(--margin) 47.5px, transparent 47.5px),
    repeating-linear-gradient(var(--paper) 0 31px, var(--rule) 31px 32px);
  font-family: "Klee One", "Hiragino Maru Gothic ProN", "Yu Gothic", serif;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 600px) {
  body { background-image:
    linear-gradient(90deg, transparent 14px, var(--margin) 14px, var(--margin) 15.5px, transparent 15.5px),
    repeating-linear-gradient(var(--paper) 0 31px, var(--rule) 31px 32px); }
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
header { max-width: 980px; margin: 0 auto; padding: 18px 16px 6px 64px; }
@media (max-width: 600px) { header { padding-left: 26px; } }
h1 { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: .04em; line-height: 1.3; }
header svg { display: block; margin: -2px 0 2px -4px; }
header p { margin: 0; font-size: 15px; color: var(--faint); }
.wrap { max-width: 980px; margin: 0 auto; padding: 14px 16px 48px 64px;
  display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 40px; align-items: start; }
@media (max-width: 860px) { .wrap { grid-template-columns: minmax(0, 1fr); gap: 28px; } }
@media (max-width: 600px) { .wrap { padding-left: 26px; } }

.stage { position: relative; overflow: hidden; width: 100%; aspect-ratio: 3 / 4.4;
  border: 2px solid var(--pencil); border-radius: 6px 14px 5px 12px / 12px 5px 14px 6px; background: var(--paper);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
canvas { display: block; width: 100%; height: 100%; }
.sound { position: absolute; right: 8px; top: 52px; font-size: 13px; background: var(--paper); padding: 0 6px; }
.sound u { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

.sheet { position: absolute; inset: 0; background: rgba(251, 250, 244, .6); padding: 52px 28px 30px; display: flex; flex-direction: column; }
.sheet[hidden], .page[hidden] { display: none; }
.note-line { font-size: 17px; line-height: 32px; margin: 0; width: fit-content; max-width: 100%; background: var(--paper); padding: 0 8px; margin-left: -8px; }
.push { flex: 1; }
.scribble-btn { display: block; width: 100%; padding: 10px 0; text-align: center; font-size: 22px; font-weight: 600;
  border: 2.2px solid var(--pencil); border-radius: var(--sketch); background: var(--card); }
.scribble-btn:active { transform: translate(1px, 2px) rotate(-.5deg); }
.small-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; margin-top: 12px; font-size: 21px; color: var(--faint); }
.small-links > * { background: var(--paper); }
.small-links button { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
@media (max-width: 600px) { .sheet { padding: 44px 22px 14px; } .small-links { margin-top: 6px; } }

.page { position: absolute; inset: 0; overflow-y: auto; padding: 22px 22px 28px 30px; background: var(--paper);
  background-image: repeating-linear-gradient(var(--paper) 0 31px, var(--rule) 31px 32px); touch-action: pan-y; }
.page .note-line { background: transparent; }
.score { position: relative; display: inline-block; padding: 0 6px; font-size: 58px; font-weight: 600; line-height: 1.1; margin: 4px 0 0 4px; font-variant-numeric: tabular-nums; }
.score small { font-size: 24px; }
.score svg { position: absolute; left: -20px; top: -8px; width: calc(100% + 40px); height: calc(100% + 16px); overflow: visible; }
.grade { width: fit-content; margin: -4px 0 4px auto; font-size: 20px; font-weight: 600; color: var(--red); transform: rotate(-6deg); }
.redline { color: var(--red); font-size: 15px; margin: 2px 0 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; margin: 10px 0 4px; }
.stats > div + div { border-left: 1px dashed #b8b8bc; }
.stats small { display: block; font-size: 12px; color: var(--faint); }
.stats b { font-size: 20px; }
.retry { margin-top: 18px; }

aside h2 { font-size: 22px; font-weight: 600; margin: 0 0 4px; display: inline-block;
  background: linear-gradient(transparent 62%, rgba(242, 194, 48, .55) 62%, rgba(242, 194, 48, .55) 92%, transparent 92%); }
aside ol, aside ul { margin: 0 0 24px; padding-left: 1.6em; font-size: 16px; line-height: 32px; }
aside li::marker { color: var(--faint); }
/* weekly ranking */
.registered { margin: 10px 0 0; font-size: 17px; line-height: 1.6; }
.registered[hidden], .namebox[hidden] { display: none; }
.registered .big { font-size: 26px; font-weight: 600; color: var(--red); }
.faint { color: var(--faint); }
.namebox { margin: 18px 0 0; padding: 12px 12px 10px; background: var(--card);
  border: 1.6px solid var(--pencil); border-radius: 10px 4px 12px 6px / 4px 10px 6px 12px; transform: rotate(.4deg); }
.namebox b { display: block; font-size: 17px; line-height: 1.6; }
.namelabel { display: block; font-size: 13px; color: var(--faint); line-height: 1.6; }
.nameline { display: flex; gap: 8px; align-items: flex-end; }
.nameline input { flex: 1; min-width: 0; border: 0; border-bottom: 2px solid var(--pencil); background: transparent; font: inherit; font-size: 20px; padding: 2px 4px; outline: none; border-radius: 0; }
.nameline input::placeholder { color: #b5b3ab; }
.nameline button { flex: none; padding: 6px 12px; font-size: 15px; font-weight: 600; border: 1.8px solid var(--red); color: var(--red); border-radius: var(--sketch); background: var(--card); }
.nameline button:disabled { opacity: .5; }
.regmsg { margin: 6px 0 0; font-size: 14px; color: var(--red); min-height: 1em; }
.rk-title { font-size: 22px; font-weight: 600; margin: 0; display: inline-block;
  background: linear-gradient(transparent 62%, rgba(242, 194, 48, .55) 62%, rgba(242, 194, 48, .55) 92%, transparent 92%); }
ol.board { list-style: none; margin: 10px 0 14px; padding: 0; min-height: 64px; }
ol.board li { display: flex; align-items: baseline; gap: 10px; line-height: 32px; font-size: 16px; }
ol.board .n { width: 2em; text-align: right; color: var(--faint); font-variant-numeric: tabular-nums; }
ol.board li:nth-child(-n+3) .n { color: var(--red); font-weight: 600; }
ol.board .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.board .d { font-weight: 600; font-variant-numeric: tabular-nums; }
ol.board li.me { background: linear-gradient(transparent 55%, rgba(198, 46, 46, .16) 55%, rgba(198, 46, 46, .16) 92%, transparent 92%); }
ol.board li.me .who::after { content: " ← あなた"; color: var(--red); font-size: 13px; }
ol.board li.msg { color: var(--faint); justify-content: center; }
