:root {
  color-scheme: dark;
  --bg: #0a1020;
  --panel: #111a30;
  --line: #34425d;
  --white: #f8f8f6;
  --muted: #c0cbe0;
  --red: #ff6378;
  --gold: #ffce81;
  font: 16px/1.4 system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 0, #222b45, var(--bg) 68%);
  color: var(--white);
  min-height: 100vh;
}
.shell { width: min(100% - 40px, 1120px); margin-inline: auto; }
.hero { padding: 26px 0 20px; }
.byline { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .875rem; }
.brand { color: var(--white); font-weight: 850; text-decoration: none; }
.mark { display: inline-block; background: #b91c36; border-radius: 4px; padding: 1px 6px; color: white; margin-right: 3px; }
.byline > span { border-left: 1px solid var(--line); padding-left: 12px; }
h1 { margin: 3px 0 1px; font-size: clamp(2rem, 4vw, 2.85rem); line-height: 1.08; letter-spacing: -.055em; font-weight: 900; }
h1 em { font-style: normal; color: var(--red); }
.hero p { margin: 3px 0 0; color: var(--muted); }
.panel { border: 1px solid var(--line); background: linear-gradient(145deg, #17233b, var(--panel) 78%); border-radius: 14px; }
.console { padding: 18px 22px; }
form { display: grid; gap: 9px; }
.input-label { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
label { font-size: 1rem; font-weight: 800; }
#count, .form-actions p, footer { font-size: .875rem; }
#count, footer { color: var(--muted); }
textarea, button, summary { font: inherit; color: inherit; }
textarea { display: block; width: 100%; min-height: 76px; resize: vertical; background: #0b1325; border: 1px solid #526181; border-radius: 8px; padding: 10px 12px; }
textarea::placeholder { color: #aab6cc; }
.form-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
button, summary { border: 1px solid #526181; background: #182641; border-radius: 7px; font-size: .875rem; font-weight: 750; padding: 7px 11px; min-height: 42px; cursor: pointer; }
button:hover:not(:disabled), summary:hover { filter: brightness(1.2); }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.text-button { background: transparent; border-color: transparent; color: #ffabb7; }
.primary { background: #b91c36; border-color: #ff647a; color: #fff; }
#spin { text-transform: uppercase; letter-spacing: .045em; }
#spin span { margin-right: 4px; }
.form-actions p, #action-status { color: var(--gold); margin: 0; }
#error { color: #ffdce2; background: #4b1d2c; border: 1px solid #ab435a; padding: 7px 10px; border-radius: 7px; margin: 8px 0 0; }
.result { margin-top: 18px; padding: 24px 26px; background: #131d33; border-radius: 14px; }
#technique { color: var(--gold); margin: 0 0 10px; font-size: .95rem; line-height: 1.35; }
blockquote { margin: 0; font-size: clamp(1.65rem, 2.25vw, 1.875rem); font-weight: 780; line-height: 1.3; overflow-wrap: anywhere; }
.breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 30px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.breakdown > section { min-width: 0; overflow-wrap: anywhere; }
h3 { margin: 0 0 5px; font-size: 1.15rem; }
.breakdown p { margin: 0; color: var(--muted); font-size: 1.0625rem; line-height: 1.55; }
.result-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin: 12px 0; }
.meter { display: flex; flex-wrap: wrap; gap: 10px clamp(16px, 4vw, 44px); margin-inline-start: auto; color: var(--muted); }
.metric { display: grid; gap: 3px; font-size: .975rem; }
.metric strong { color: var(--red); font-size: clamp(2rem, 4vw, 2.5rem); line-height: 1.05; font-variant-numeric: tabular-nums; }
#score { color: var(--gold); }
#more { position: relative; }
#more summary { display: flex; align-items: center; gap: 7px; list-style: none; }
#more summary::-webkit-details-marker { display: none; }
#more summary::after { content: ''; width: .35em; height: .35em; border-right: 1px solid; border-bottom: 1px solid; transform: rotate(45deg); margin-top: -.15em; }
#more[open] summary::after { transform: rotate(225deg); margin-top: .15em; }
.more-actions { position: absolute; z-index: 1; top: calc(100% + 6px); inset-inline-start: 0; display: grid; min-width: max-content; border: 1px solid var(--line); border-radius: 8px; background: #131d33; padding: 4px; box-shadow: 0 8px 22px #03060db3; }
.more-actions button { text-align: start; border: 0; background: transparent; }
.more-actions button:hover { background: #243350; }
#action-status { font-size: .875rem; }
#action-status:not(:empty) { margin-top: 8px; }
footer { padding: 6px 0 12px; }
@media (max-width: 620px) {
  .shell { width: calc(100% - 24px); }
  .hero { padding: 18px 0 15px; }
  .console, .result { padding: 16px; }
  .breakdown { grid-template-columns: 1fr; gap: 15px; }
  button, summary { min-height: 44px; }
  .result-footer { flex-direction: column; align-items: stretch; }
  .meter { margin-inline-start: 0; }
  .actions { position: relative; }
  #more { position: static; }
  .more-actions { inset-inline: auto 0; }
}
