﻿:root {
  color-scheme: light;
  --ink: #253044;
  --muted: #68758b;
  --line: #dbe5ed;
  --accent: #1c92a9;
  --accent-dark: #126b7d;
  --paper: #ffffff;
  --back: #eef7f8;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, #dff4f6 0, transparent 34rem),
    linear-gradient(145deg, #f8fbfc, var(--back));
}

.app {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 24px;
}

.app__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.app__eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .12em;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.status {
  display: flex;
  gap: 8px;
  margin: 0;
}

.status__item {
  min-width: 92px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .88);
  text-align: center;
  box-shadow: 0 5px 18px rgba(41, 83, 94, .06);
}

.status dt {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}

.status dd {
  margin: 2px 0 0;
  color: var(--accent-dark);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
}

.status small {
  margin-left: 2px;
  font-size: .72rem;
}

.play-area {
  position: relative;
  height: clamp(430px, 66vh, 650px);
  overflow: hidden;
  border: 3px solid #b9dbe0;
  border-radius: 22px;
  background:
    linear-gradient(rgba(255, 255, 255, .72), rgba(255, 255, 255, .92)),
    repeating-linear-gradient(90deg, transparent 0 79px, #d9eef0 80px);
  box-shadow: 0 18px 45px rgba(37, 76, 88, .12);
}

.keys {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 18px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.75rem, 2vw, .92rem);
  font-weight: 700;
  letter-spacing: .08em;
}

.falling-key {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 1.25em;
  color: var(--accent-dark);
  font-family: Arial, sans-serif;
  font-size: clamp(4rem, 10vw, 6.5rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 5px 0 #d4edf0;
  will-change: transform;
}

.panel {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100% - 32px));
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  text-align: center;
  box-shadow: 0 20px 50px rgba(37, 76, 88, .15);
  transform: translate(-50%, -50%);
}

.panel__label,
.panel__sub {
  margin: 0;
  color: var(--muted);
}

.panel__main {
  margin: 16px 0;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 800;
}

kbd {
  display: inline-block;
  padding: .28em .65em;
  border: 1px solid #9eb8bf;
  border-bottom-width: 4px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: #f8ffff;
  font: inherit;
}

.countdown {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, .84);
  font-family: Arial, sans-serif;
  font-size: clamp(6rem, 22vw, 13rem);
  font-weight: 900;
  text-shadow: 0 8px 0 #d4edf0;
}

.result h2 {
  margin: 8px 0 20px;
  font-size: 1.8rem;
}

.result__scores {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.result__scores p {
  min-width: 130px;
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  color: var(--muted);
  background: #edf8f9;
  font-size: .82rem;
  font-weight: 700;
}

.result__scores strong {
  display: block;
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 2.2rem;
}

.message {
  min-height: 1.5em;
  margin: 14px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: .92rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 20px, 1100px);
    padding-top: 18px;
  }

  .app__header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .status {
    width: 100%;
  }

  .status__item {
    flex: 1;
    min-width: 0;
    padding: 8px 4px;
  }

  .play-area {
    height: 62vh;
    min-height: 400px;
    border-radius: 16px;
  }

  .result__scores {
    gap: 8px;
  }

  .result__scores p {
    min-width: 0;
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .falling-key {
    will-change: auto;
  }
}
