:root {
  color-scheme: light;
  --ink: #292d45;
  --muted: #666b85;
  --panel: #ffffff;
  --violet: #7e8ce8;
  --violet-dark: #4650a8;
  --yellow: #ffd66b;
  --mint: #84d6b5;
  --pink: #ee8fae;
  --blue: #7dc3ef;
  --shadow: 0 12px 28px rgba(48, 54, 120, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 14%, rgba(255, 214, 107, 0.42), transparent 24%),
    linear-gradient(180deg, #eff1ff 0%, #f9fbff 56%, #e0f7ef 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
  touch-action: manipulation;
  user-select: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

a {
  color: inherit;
}

.app {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 12px;
  min-height: 100svh;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.top-bar,
.status-panel,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--violet-dark);
  font-size: 1rem;
  font-weight: 850;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1;
}

.home-link,
.start-button,
.reset-button,
.chip,
.settings-summary {
  min-height: 46px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(70, 80, 168, 0.2);
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--panel);
  box-shadow: 0 7px 0 rgba(70, 80, 168, 0.13);
  font-weight: 900;
  text-decoration: none;
}

.start-button {
  color: #fff;
  background: var(--violet-dark);
}

.sound-button {
  background: #f2f4ff;
}

.status-panel {
  min-height: 88px;
  border: 3px solid rgba(70, 80, 168, 0.18);
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.label,
.big-text,
.message,
.target-label {
  margin: 0;
  text-align: center;
  font-weight: 900;
}

.label {
  color: var(--muted);
  font-size: 0.9rem;
}

.big-text {
  min-width: 54px;
  font-size: 2rem;
  line-height: 1;
}

.small-text {
  font-size: 1.6rem;
}

.message-box {
  flex: 1;
}

.message {
  color: var(--violet-dark);
  font-size: clamp(1.05rem, 3vw, 1.45rem);
}

.target-panel {
  display: grid;
  place-items: center;
}

.target-card {
  width: min(360px, 100%);
  min-height: 190px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 4px solid rgba(70, 80, 168, 0.18);
  border-radius: 8px;
  padding: 12px;
  background:
    radial-gradient(circle at 25% 18%, rgba(255, 255, 255, 0.9), transparent 18%),
    linear-gradient(145deg, #ffffff, #e8ebff);
  box-shadow: var(--shadow);
}

.target-label {
  color: var(--muted);
  font-size: 1rem;
}

.shape-holder {
  position: relative;
  overflow: hidden;
  width: min(150px, 38vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.shape-holder svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  transform: rotate(var(--shape-rotate, 0deg));
}

.silhouette svg {
  filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.08));
}

.silhouette path,
.silhouette circle,
.silhouette rect,
.silhouette polygon,
.silhouette ellipse {
  fill: #252735;
}

.choice-shadow {
  background: #edf0ff;
  border: 3px dashed rgba(70, 80, 168, 0.18);
}

.shape-holder.is-peek::before,
.shape-holder.is-window::before,
.shape-holder.is-window::after {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(232, 235, 255, 0.96));
}

.shape-holder.is-peek::before {
  left: -6%;
  right: -6%;
  bottom: -4%;
  height: 38%;
  border-top: 3px dashed rgba(70, 80, 168, 0.22);
}

.shape-holder.is-window::before {
  inset: 0 58% 0 0;
  border-right: 3px dashed rgba(70, 80, 168, 0.22);
}

.shape-holder.is-window::after {
  inset: 0 0 54% 0;
  border-bottom: 3px dashed rgba(70, 80, 168, 0.22);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  align-content: center;
  gap: clamp(10px, 2.4vw, 16px);
}

.choice-grid.is-five {
  grid-template-columns: repeat(5, minmax(80px, 1fr));
}

.choice-card {
  min-height: 160px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 4px solid rgba(70, 80, 168, 0.16);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.choice-card.is-right {
  background: #fff4c5;
}

.choice-card.is-wrong {
  background: #ffdbe6;
  animation: shake 260ms ease;
}

.choice-name {
  min-height: 1.3em;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 900;
}

.controls {
  justify-content: center;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.settings-panel {
  flex: 1 1 100%;
}

.settings-summary {
  cursor: pointer;
  list-style: none;
}

.settings-summary::-webkit-details-marker {
  display: none;
}

.settings-body {
  margin-top: 8px;
}

.chip.is-active {
  color: #fff;
  background: var(--violet-dark);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

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

  .eyebrow {
    display: none;
  }

  .top-bar {
    align-items: start;
  }

  h1 {
    font-size: 2rem;
  }

  .home-link,
  .start-button,
  .reset-button,
  .chip,
  .settings-summary {
    min-height: 42px;
    padding: 7px 10px;
  }

  .status-panel {
    min-height: 72px;
    padding: 7px;
  }

  .label {
    font-size: 0.78rem;
  }

  .big-text {
    min-width: 42px;
    font-size: 1.55rem;
  }

  .message {
    font-size: 1rem;
  }

  .target-card {
    min-height: 150px;
  }

  .shape-holder {
    width: min(108px, 30vw);
  }

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-grid.is-five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-card {
    min-height: 128px;
  }
}

@media (max-width: 390px) {
  .target-card {
    min-height: 132px;
  }

  .choice-card {
    min-height: 110px;
  }

  .choice-name {
    font-size: 0.84rem;
  }
}
