:root {
  color-scheme: dark;
  font-family:
    "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: #d8fff1;
  background: #050807;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100vh;
  margin: 0;
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px),
    radial-gradient(circle at 72% 8%, rgb(139 235 205 / 13%), transparent 28rem),
    #050807;
  background-size: 100% 4px, auto, auto;
  outline: none;
}

.shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border: 1px solid rgb(119 255 214 / 26%);
  border-radius: 8px;
  background: rgb(2 10 8 / 90%);
  box-shadow: 0 28px 90px rgb(0 0 0 / 58%);
  overflow: hidden;
}

.topbar,
.statusbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 48px;
  padding: 10px 16px;
  border-bottom: 1px solid rgb(119 255 214 / 18%);
  color: #97d9c5;
  font-size: 13px;
}

.statusbar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgb(119 255 214 / 18%);
  border-bottom: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #57f0bd;
  border-radius: 4px;
  color: #57f0bd;
}

.title {
  color: #f0fff9;
  font-weight: 800;
}

.signal,
.metric strong {
  color: #57f0bd;
}

.select-screen,
.result-screen {
  min-height: 0;
  padding: clamp(20px, 4vw, 48px);
}

.select-hero h1,
.result-screen h1 {
  margin: 18px 0 0;
  color: #f4fffb;
  font-size: clamp(38px, 7vw, 88px);
  line-height: 1;
}

.select-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 22px;
  color: #97d9c5;
  font-size: 13px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.mode-card {
  min-height: 220px;
  padding: 22px;
  border: 1px solid rgb(119 255 214 / 20%);
  border-radius: 8px;
  background: rgb(255 255 255 / 2%);
  color: #8ab8aa;
  text-align: left;
  cursor: pointer;
}

.mode-card.active {
  border-color: #57f0bd;
  background: rgb(87 240 189 / 10%);
  color: #f0fff9;
  box-shadow: inset 0 0 0 1px rgb(87 240 189 / 34%);
}

.mode-card span,
.play-head span {
  color: #57f0bd;
  font-size: 12px;
}

.mode-card strong {
  display: block;
  margin-top: 18px;
  color: #f4fffb;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.35;
}

.mode-card small {
  display: block;
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.7;
}

.select-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 6px;
  cursor: pointer;
}

.primary-action {
  border: 1px solid #57f0bd;
  background: #57f0bd;
  color: #04110d;
  font-weight: 800;
}

.secondary-action {
  border: 1px solid rgb(119 255 214 / 28%);
  background: transparent;
  color: #d8fff1;
}

.play-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 58px;
  padding: 10px 16px;
  border-bottom: 1px solid rgb(119 255 214 / 18%);
  color: #f0fff9;
}

.play-head span {
  display: block;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 0;
}

.terminal {
  min-width: 0;
  padding: clamp(18px, 3vw, 34px);
  border-right: 1px solid rgb(119 255 214 / 18%);
}

.prompt {
  color: #57f0bd;
  font-size: clamp(13px, 1.6vw, 16px);
}

.target {
  min-height: 120px;
  margin-top: 22px;
  padding: 22px 0;
  color: #f4fffb;
  font-size: clamp(28px, 4.8vw, 64px);
  font-weight: 800;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.furigana {
  margin-top: 16px;
  color: #97d9c5;
  font-size: clamp(16px, 1.8vw, 24px);
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.target .hidden {
  color: #275348;
  text-shadow: none;
}

.typed {
  min-height: 72px;
  padding: 18px 0 12px;
  border-top: 1px solid rgb(119 255 214 / 18%);
  border-bottom: 1px solid rgb(119 255 214 / 18%);
  color: #57f0bd;
  font-size: clamp(22px, 3vw, 36px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.caret {
  display: inline-block;
  width: 0.7ch;
  height: 1em;
  margin-left: 4px;
  background: #57f0bd;
  transform: translateY(0.12em);
  animation: blink 1s steps(2, start) infinite;
}

.feedback {
  min-height: 28px;
  margin-top: 18px;
  color: #e9d985;
}

.feedback.miss {
  color: #ff6b7a;
}

.hint {
  margin-top: 18px;
  color: #8ab8aa;
  font-size: 14px;
}

.side {
  min-width: 0;
  padding: 22px;
  background: rgb(255 255 255 / 2%);
}

.lock {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgb(119 255 214 / 20%);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 6%), transparent 42%),
    rgb(2 10 8 / 86%);
}

.shackle {
  position: relative;
  width: 58%;
  height: 58%;
  border: 12px solid #57f0bd;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  opacity: 0.76;
}

.shackle::after {
  content: "";
  position: absolute;
  left: -22%;
  right: -22%;
  bottom: -42%;
  height: 48%;
  border: 1px solid rgb(119 255 214 / 36%);
  border-radius: 7px;
  background: #07130f;
  box-shadow: inset 0 0 24px rgb(87 240 189 / 14%);
}

.alarm {
  margin-top: 22px;
}

.alarm-label {
  display: flex;
  justify-content: space-between;
  color: #97d9c5;
  font-size: 12px;
}

.alarm-track {
  height: 12px;
  margin-top: 8px;
  border: 1px solid rgb(119 255 214 / 24%);
  border-radius: 999px;
  overflow: hidden;
}

.alarm-fill {
  height: 100%;
  background: linear-gradient(90deg, #57f0bd, #e9d985, #ff6b7a);
  transition: width 160ms ease;
}

.log {
  margin-top: 22px;
  display: grid;
  gap: 10px;
  color: #8ab8aa;
  font-size: 13px;
}

.log-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

.log-line b {
  color: #57f0bd;
  font-weight: 500;
}

.metric {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-mode {
  margin-top: 14px;
  color: #97d9c5;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.result-stat {
  min-height: 130px;
  padding: 18px;
  border: 1px solid rgb(119 255 214 / 20%);
  border-radius: 8px;
  background: rgb(255 255 255 / 2%);
}

.result-stat.wide {
  grid-column: span 2;
}

.result-stat span {
  display: block;
  color: #97d9c5;
  font-size: 12px;
}

.result-stat strong {
  display: block;
  margin-top: 18px;
  color: #57f0bd;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 820px) {
  .app {
    padding: 12px;
  }

  .shell {
    min-height: calc(100vh - 24px);
  }

  .topbar,
  .statusbar {
    grid-template-columns: 1fr;
  }

  .mode-grid,
  .workbench {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-stat.wide {
    grid-column: auto;
  }

  .terminal {
    border-right: 0;
  }

  .side {
    border-top: 1px solid rgb(119 255 214 / 18%);
  }

  .lock {
    max-height: 220px;
  }
}
