:root {
  --paper: #f3ecdc;
  --paper-2: #e9dfc8;
  --sumi: #1c1a17;
  --vermilion: #c8321f;
  --faint: rgba(28, 26, 23, .55);
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Songti SC", "Iowan Old Style", "Palatino", Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #d9ceb5;
  color: var(--sumi);
  font-family: var(--serif);
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 60px rgba(28, 26, 23, .25);
}

canvas { display: block; width: 100%; height: 100%; }

/* score = a red hanko seal */
#hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 24px);
  right: 22px;
  pointer-events: none;
}
#score {
  min-width: 58px;
  height: 58px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
  color: var(--paper);
  background: var(--vermilion);
  border-radius: 6px;
  box-shadow: inset 0 0 0 3px var(--vermilion), inset 0 0 0 5px rgba(243, 236, 220, .75);
  transform: rotate(-4deg);
  opacity: 0;
  transition: opacity .4s;
  font-variant-numeric: tabular-nums;
}
#score.on { opacity: .92; }
#score.pop { animation: stamp .3s ease-out; }
@keyframes stamp {
  0% { transform: rotate(-4deg) scale(1.3); opacity: .5; }
  100% { transform: rotate(-4deg) scale(1); opacity: .92; }
}

.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
.panel.show { opacity: 1; pointer-events: auto; }
#menu.show, #over.show { background: radial-gradient(ellipse at center, rgba(243,236,220,.92) 30%, rgba(243,236,220,.55) 75%, rgba(243,236,220,0)); }

.title {
  display: flex;
  align-items: center;
  gap: 16px;
}
.kanji {
  writing-mode: vertical-rl;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 6px;
  line-height: 1;
}
h1 {
  margin: 0;
  font-size: clamp(48px, 15vw, 68px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -1px;
  line-height: 1;
}
.seal {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  font-size: 15px;
  font-weight: 700;
  color: var(--paper);
  background: var(--vermilion);
  border-radius: 4px;
  transform: rotate(6deg);
  writing-mode: vertical-rl;
}

.tag {
  margin: 0;
  font-size: 16px;
  font-style: italic;
  color: var(--faint);
  max-width: 260px;
  line-height: 1.5;
}

.rule {
  width: 120px;
  height: 6px;
  background: var(--sumi);
  border-radius: 50% 40% 60% 30%;
  opacity: .85;
  transform: skewX(-20deg);
}

.best {
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--faint);
}
.best b { color: var(--vermilion); font-size: 18px; letter-spacing: 0; margin-left: 6px; }

.btn {
  font-family: inherit;
  font-size: 19px;
  letter-spacing: 3px;
  color: var(--paper);
  background: var(--sumi);
  border: none;
  border-radius: 2px;
  padding: 14px 36px;
  cursor: pointer;
  position: relative;
  transition: transform .15s, background .2s;
}
.btn::after {
  content: "";
  position: absolute;
  right: -6px; bottom: -6px;
  width: 14px; height: 14px;
  background: var(--vermilion);
  border-radius: 2px;
  transform: rotate(8deg);
}
.btn:active { transform: scale(.97); background: #36322c; }

.skins { display: flex; gap: 14px; margin-top: 6px; }
.skin {
  width: 30px; height: 30px;
  border: none;
  padding: 0;
  border-radius: 48% 52% 44% 56% / 55% 45% 55% 45%;
  cursor: pointer;
  opacity: .55;
  transition: transform .2s, opacity .2s;
}
.skin.on { opacity: 1; transform: scale(1.25); }

h2 {
  margin: 0;
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
}
h2 small {
  display: block;
  font-size: 15px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 3px;
  color: var(--faint);
  margin-top: 8px;
}

.card {
  display: flex;
  gap: 36px;
  padding: 10px 0;
  border-top: 1px solid rgba(28,26,23,.25);
  border-bottom: 1px solid rgba(28,26,23,.25);
}
.card div { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.card span { font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--faint); }
.card b { font-size: 44px; font-weight: 400; line-height: 1.15; font-variant-numeric: tabular-nums; }
.card div:last-child b { color: var(--vermilion); }

.medal {
  min-height: 22px;
  font-size: 15px;
  font-style: italic;
  letter-spacing: 1px;
}
