:root {
  color-scheme: light;
  font-family: system-ui, 'Segoe UI', sans-serif;
  color: #242036;
  background: #f4f1fb;
  --accent: #5540b8;
  --ink: #242036;
  --muted: #60586f;
}

* { box-sizing: border-box; }
body {
  min-width: 280px;
  min-height: 100dvh;
  margin: 0;
  background: radial-gradient(ellipse at 50% 0, #e8e1ff 0, #f4f1fb 35rem, #faf9fd 100%);
}
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 3px solid #6b51e8; outline-offset: 3px; }
[hidden] { display: none; }

.shell {
  width: min(100%, 34rem);
  margin-inline: auto;
  padding: clamp(2rem, 8vh, 4.5rem) 1.15rem max(2rem, env(safe-area-inset-bottom));
}
.intro { margin-bottom: 1.5rem; }
.brand {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: .55rem;
  color: #443780;
  font-size: .9rem;
  font-weight: 680;
  margin-bottom: 1.15rem;
}
.brand-mark { display: grid; grid-template-columns: repeat(2, 6px); gap: 2px; padding: 5px; background: #dbd3fa; border-radius: 6px; }
.brand-mark i { height: 6px; border-radius: 1px; background: #5b47bd; }
.brand-mark i:nth-child(2) { background: #927bef; }
.brand-mark i:nth-child(3) { background: #b19cf9; }
h1 { font-size: clamp(2rem, 7.8vw, 3rem); line-height: 1.09; letter-spacing: -.038em; font-weight: 800; }
.intro > p { margin-top: .6rem; color: var(--muted); line-height: 1.45; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-bottom: .85rem; }
.choice {
  display: grid;
  min-height: 7.65rem;
  padding: .8rem 1rem .75rem;
  gap: .25rem;
  justify-items: start;
  align-content: space-between;
  border: 1px solid #d6cdee;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 3px 8px #2c195a09;
  text-align: left;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 635;
}
.choice:active, .choice[data-chosen='true'] { background: #f0ebff; border-color: #b9a9ee; color: #3e3279; }
.choice-value { color: var(--accent); font-size: 2.85rem; font-weight: 780; line-height: 1; }
.result {
  min-height: 8.6rem;
  padding: .95rem 1rem 1.1rem;
  border: 1px solid #403662;
  border-radius: 1rem;
  background: #2b2245;
  color: #fff;
  box-shadow: 0 6px 12px #35245c1f;
}
.result h2 { color: #d7cdf8; font-size: .9rem; font-weight: 665; }
.result-word { margin-top: .55rem; color: #ded8eb; font-size: 1.3rem; line-height: 1.2; }
.result-word.has-image { color: #fff; font-size: clamp(1.7rem, 7vw, 2.35rem); font-weight: 650; letter-spacing: -.025em; overflow-wrap: anywhere; }
.marked-letter { color: #cfbcff; font-weight: 820; }
.result-pattern { margin-top: .65rem; color: #ded8eb; font-size: .875rem; line-height: 1.4; }

.picker {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 31rem);
  max-width: 100%;
  padding: 0;
  margin: 0 auto;
  border: 0;
  border-radius: 1.3rem 1.3rem 0 0;
  color: var(--ink);
  background: #fcfbff;
  box-shadow: 0 -7px 30px #20153432;
}
.picker::backdrop { background: #2119328c; }
.picker-content { padding: .95rem .95rem max(1.25rem, env(safe-area-inset-bottom)); }
.picker-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .65rem; }
.picker-header h2 { font-size: 1.38rem; font-weight: 740; letter-spacing: -.025em; }
.close-picker {
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: .66rem;
  background: #f0ebfa;
  color: #403279;
  font-size: 1.5rem;
  line-height: 1;
}
.alphabet { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .38rem; }
.letter {
  min-height: 3.2rem;
  padding: 0;
  border: 1px solid #ded5f2;
  border-radius: .6rem;
  background: #f6f2fd;
  color: #49349c;
  font-size: 1.25rem;
  font-weight: 710;
}
.letter:active, .letter[aria-pressed='true'] { border-color: #6348d0; background: #e6dcfc; color: #382788; }

@media (hover: hover) {
  .choice:hover { border-color: #8c75e3; }
  .letter:hover, .close-picker:hover { background: #eae1fa; }
}
@media (min-width: 44rem) {
  .picker { inset: 0; margin: auto; border-radius: 1.3rem; }
  .picker-content { padding: 1.1rem; }
}
@media (max-width: 21rem) {
  .picker-content { padding-inline: .5rem; }
  .alphabet { gap: .24rem; }
}
