:root {
  color-scheme: light;
  --paper: #f4efe6;
  --paper-deep: #e9dfd0;
  --ink: #1e2723;
  --muted: #66716b;
  --accent: #dc5f42;
  --accent-dark: #a63d28;
  --mint: #9cbbae;
  --key-border: #bcb7ad;
  --white-count: 15;
  font-family:
    Inter, "Hiragino Sans", "Yu Gothic", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgb(255 255 255 / 78%), transparent 24rem),
    linear-gradient(145deg, var(--paper) 0%, #eee7dc 62%, var(--paper-deep) 100%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
  margin-bottom: 28px;
}

.eyebrow,
.section-kicker,
.now-playing__label {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  font-weight: 500;
}

.lead {
  max-width: 43rem;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

.now-playing {
  display: grid;
  min-width: 210px;
  padding: 18px 20px;
  border: 1px solid rgb(30 39 35 / 12%);
  border-radius: 18px;
  background: rgb(255 255 255 / 48%);
  box-shadow: 0 18px 45px rgb(73 58 39 / 8%);
}

.now-playing strong {
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
}

.now-playing > span:last-child {
  min-height: 1.2em;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid rgb(30 39 35 / 12%);
  border-radius: 18px;
  background: rgb(255 255 255 / 50%);
}

.volume-control {
  display: grid;
  grid-template-columns: auto minmax(130px, 260px) 3.2rem;
  align-items: center;
  gap: 12px;
  width: min(100%, 390px);
  font-size: 0.88rem;
  font-weight: 700;
}

.volume-control input {
  width: 100%;
  accent-color: var(--accent);
}

.volume-control output {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.control-actions {
  display: flex;
  gap: 10px;
}

.control-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: white;
  background: var(--ink);
  cursor: pointer;
  transition:
    transform 140ms ease,
    color 140ms ease,
    background 140ms ease;
}

.control-button:hover {
  transform: translateY(-1px);
}

.control-button:focus-visible,
.key:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.control-button[aria-pressed="true"] {
  border-color: var(--accent-dark);
  background: var(--accent);
}

.control-button--quiet {
  color: var(--ink);
  background: transparent;
}

kbd {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 0.65rem;
  opacity: 0.72;
}

.instrument {
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgb(30 39 35 / 18%);
  border-radius: 26px;
  background: #26322c;
  box-shadow: 0 24px 70px rgb(46 43 35 / 18%);
}

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

.instrument__heading .section-kicker {
  color: #dcb6a9;
}

.instrument__heading > p {
  margin-bottom: 2px;
  color: rgb(255 255 255 / 58%);
  font-size: 0.75rem;
}

.piano-scroll {
  overflow-x: auto;
  padding: 0 2px 10px;
  scrollbar-color: var(--mint) transparent;
}

.piano {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 760px;
  height: clamp(260px, 35vw, 390px);
  overflow: hidden;
  border-radius: 12px;
  background: #171c1a;
  touch-action: none;
  user-select: none;
}

.key {
  position: relative;
  padding: 0;
  cursor: pointer;
  touch-action: none;
}

.key__label {
  position: absolute;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.key__note {
  font-family: Georgia, serif;
  font-size: 0.82rem;
}

.key__shortcut {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.key--white {
  flex: 1 1 calc(100% / var(--white-count));
  height: 100%;
  border: 0;
  border-right: 1px solid var(--key-border);
  border-bottom: 8px solid #d8d3c9;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(95deg, #eeeae2 0%, #fff 32%, #f7f3eb 100%);
  box-shadow: inset 0 -10px 18px rgb(101 91 72 / 8%);
  transition:
    transform 80ms ease,
    background 80ms ease,
    border-bottom-width 80ms ease;
}

.key--white:first-child {
  border-radius: 10px 0 8px 8px;
}

.key--white:last-child {
  border-right: 0;
  border-radius: 0 10px 8px 8px;
}

.key--white .key__label {
  right: 8px;
  bottom: 15px;
  left: 8px;
  gap: 4px;
  color: #5c625e;
}

.key--white .key__shortcut {
  min-width: 24px;
  padding: 4px;
  border: 1px solid #cdc8bf;
  border-radius: 6px;
  background: #f2eee7;
}

.key--black {
  position: absolute;
  z-index: 2;
  top: 0;
  left: calc(
    var(--white-before) * (100% / var(--white-count)) -
      (100% / var(--white-count) * 0.31)
  );
  width: calc(100% / var(--white-count) * 0.62);
  height: 62%;
  border: 0;
  border-bottom: 10px solid #090b0a;
  border-radius: 0 0 7px 7px;
  color: white;
  background: linear-gradient(105deg, #101513 0%, #303b36 55%, #111614 100%);
  box-shadow: 0 8px 10px rgb(0 0 0 / 26%);
  transition:
    transform 80ms ease,
    background 80ms ease,
    border-bottom-width 80ms ease;
}

.key--black .key__label {
  right: 4px;
  bottom: 10px;
  left: 4px;
  gap: 2px;
  color: rgb(255 255 255 / 74%);
}

.key--black .key__note {
  font-size: 0.66rem;
}

.key.is-active.key--white {
  border-bottom-width: 2px;
  background: linear-gradient(120deg, #e9b09f, #f9d8ca);
  transform: translateY(5px);
}

.key.is-active.key--black {
  border-bottom-width: 3px;
  background: linear-gradient(120deg, #8d3727, var(--accent));
  transform: translateY(6px);
}

.keyboard-guide {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) 1.3fr;
  gap: 28px;
  margin-top: 18px;
  padding: 24px;
  border: 1px solid rgb(30 39 35 / 12%);
  border-radius: 22px;
  background: rgb(255 255 255 / 42%);
}

.octave-guide {
  display: grid;
  gap: 11px;
}

.octave-guide p {
  display: grid;
  grid-template-columns: 7.4rem 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.octave-guide code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

footer {
  padding: 20px 4px 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

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

  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .now-playing {
    min-width: 0;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .volume-control {
    width: 100%;
  }

  .control-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .instrument {
    padding: 14px;
    border-radius: 20px;
  }

  .instrument__heading > p {
    max-width: 8rem;
    font-size: 0.68rem;
    line-height: 1.5;
    text-align: right;
  }

  .piano {
    height: 310px;
  }

  .keyboard-guide {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px;
  }

  .octave-guide p {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
