:root {
  --navy: #0c2340;
  --navy-soft: #173c66;
  --emerald: #0d5c3a;
  --emerald-bright: #13754d;
  --amber: #b45309;
  --cream: #faf5eb;
  --paper: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --border: rgba(12, 35, 64, 0.14);
  --border-strong: rgba(12, 35, 64, 0.25);
  --shadow: 0 22px 60px -32px rgba(12, 35, 64, 0.34);
  --radius-large: 25px;
  --radius-medium: 15px;
  --display: "Outfit", sans-serif;
  --body: "Inter", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 0;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: radial-gradient(circle at 14% 13%, rgba(19, 117, 77, .13), transparent 22rem), radial-gradient(circle at 88% 82%, rgba(180, 83, 9, .11), transparent 24rem), var(--cream);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 10; top: -5rem; left: 1rem; padding: .75rem 1rem; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 700; text-decoration: none; transition: top 160ms ease; }
.skip-link:focus { top: 1rem; }
.page-glow { position: fixed; z-index: -1; width: 22rem; height: 22rem; border-radius: 50%; filter: blur(75px); opacity: .23; pointer-events: none; }
.glow-one { top: -12rem; left: -10rem; background: #53af80; }
.glow-two { right: -11rem; bottom: -12rem; background: #e0a35c; }
.app-shell { width: min(100% - 2rem, 1160px); min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; }
.app-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--border); }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: .7rem; color: var(--navy); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg, var(--navy), var(--emerald)); color: #fff; box-shadow: 0 8px 18px rgba(12,35,64,.2); }
.brand-mark svg { width: 27px; height: 27px; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--display); font-size: 1.05rem; font-weight: 800; letter-spacing: .035em; line-height: 1.1; }
.brand small { margin-top: .18rem; color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.back-link { min-height: 44px; display: inline-flex; align-items: center; flex: 0 0 auto; color: var(--muted); font-size: .88rem; font-weight: 600; text-underline-offset: 3px; }
.back-link:hover { color: var(--navy); }
.tool-layout { width: 100%; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-areas: "intro names" "results results"; gap: clamp(1.25rem, 4vw, 3.5rem); flex: 1; padding: clamp(2rem, 5vw, 4.75rem) 0; }
.intro-panel { grid-area: intro; min-width: 0; align-self: start; }
.eyebrow { margin: 0 0 .65rem; color: var(--emerald); font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
h1, h2 { font-family: var(--display); color: var(--navy); }
h1 { max-width: 9ch; margin: 0; font-size: clamp(2.4rem, 5vw, 4.5rem); font-weight: 800; letter-spacing: -.045em; line-height: .98; }
h2 { margin: 0; font-size: 1.42rem; line-height: 1.12; }
.intro { max-width: 35rem; margin: 1.25rem 0 0; color: var(--muted); font-size: 1.03rem; }
.settings-card, .names-panel, .results-panel { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-large); background: rgba(255,255,255,.85); box-shadow: var(--shadow); }
.settings-card { margin-top: 2rem; padding: clamp(1.25rem, 3vw, 1.7rem); }
.section-heading, .results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.section-heading .eyebrow, .results-heading .eyebrow { margin-bottom: .35rem; }
.mode-fieldset { margin: 1.35rem 0 0; padding: 0; border: 0; }
.mode-fieldset legend, .number-label { color: var(--ink); font-size: .88rem; font-weight: 700; }
.mode-options { display: grid; gap: .6rem; margin-top: .55rem; }
.mode-option { min-height: 66px; display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--radius-medium); background: #fff; cursor: pointer; transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease; }
.mode-option:has(input:checked) { border-color: var(--emerald); background: rgba(13,92,58,.06); box-shadow: 0 0 0 2px rgba(13,92,58,.1); }
.mode-option input { width: 20px; height: 20px; margin: 0; accent-color: var(--emerald); }
.mode-option span { min-width: 0; }
.mode-option strong, .mode-option small { display: block; }
.mode-option strong { color: var(--navy); font-size: .9rem; }
.mode-option small { color: var(--muted); font-size: .77rem; }
.number-label { display: grid; gap: .45rem; margin-top: 1.2rem; }
select, input, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 12px; background: #fff; color: var(--ink); font-size: 1rem; }
select, input { min-height: 52px; padding: .72rem .85rem; }
textarea { min-height: 126px; padding: .75rem .85rem; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: #64748b; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(13,92,58,.14); }
.setting-help { min-height: 1.25rem; margin: .5rem 0 0; color: var(--muted); font-size: .8rem; }
.make-button, .add-button, .shuffle-button { border: 0; font-weight: 800; transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.make-button { width: 100%; min-height: 54px; display: inline-flex; align-items: center; justify-content: center; gap: .6rem; margin-top: 1rem; padding: .75rem 1.25rem; border-radius: 14px; background: linear-gradient(135deg, var(--emerald), var(--emerald-bright)); box-shadow: 0 12px 22px -14px rgba(13,92,58,.72); color: #fff; }
.make-button svg { width: 22px; height: 22px; }
.make-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 25px -14px rgba(13,92,58,.78); }
.make-button:active:not(:disabled), .add-button:active:not(:disabled), .shuffle-button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .52; }
.action-status { min-height: 1.4rem; margin: .7rem 0 0; color: var(--muted); font-size: .86rem; text-align: center; }
.names-panel { grid-area: names; padding: clamp(1.25rem, 3vw, 1.9rem); }
.count-badge { flex: 0 0 auto; border: 1px solid rgba(13,92,58,.2); border-radius: 999px; padding: .34rem .62rem; background: rgba(13,92,58,.08); color: var(--emerald); font-size: .78rem; font-weight: 800; }
.add-one-form, .paste-area { margin-top: 1.5rem; }
.add-one-form label, .paste-area > label { display: block; margin-bottom: .45rem; color: var(--ink); font-size: .88rem; font-weight: 700; }
.entry-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .65rem; }
.add-button { min-height: 52px; padding: .75rem 1rem; border-radius: 12px; background: var(--navy); color: #fff; white-space: nowrap; }
.add-button:hover:not(:disabled) { background: var(--navy-soft); }
.field-message { min-height: 1.3rem; margin: .45rem 0 0; color: var(--muted); font-size: .82rem; }
.field-message.error { color: #a03f12; font-weight: 600; }
.paste-actions, .list-tools, .list-tools > div { display: flex; align-items: center; gap: .65rem; }
.paste-actions, .list-tools { justify-content: space-between; margin-top: .55rem; }
.paste-actions p, .list-tools p { margin: 0; color: var(--muted); font-size: .8rem; }
.text-button { min-height: 44px; padding: .45rem .6rem; border: 0; border-radius: 9px; background: transparent; color: var(--emerald); font-size: .86rem; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover:not(:disabled) { background: rgba(13,92,58,.08); }
.text-button.danger { color: #a03f12; }
.text-button.danger:hover:not(:disabled) { background: rgba(160,63,18,.08); }
.list-tools { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.name-list { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.name-chip { max-width: 100%; min-width: 0; display: inline-flex; align-items: center; border: 1px solid rgba(12,35,64,.14); border-radius: 999px; background: #f8fafc; color: var(--navy); }
.chip-name { min-width: 0; padding: .48rem .3rem .48rem .78rem; overflow-wrap: anywhere; font-size: .9rem; font-weight: 700; }
.remove-button { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; margin-right: .12rem; border: 0; border-radius: 50%; background: transparent; color: var(--navy); }
.remove-button:hover { background: rgba(12,35,64,.1); }
.remove-button svg { width: 19px; height: 19px; }
.empty-state { display: grid; justify-items: center; padding: 2.25rem 1rem .5rem; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state svg { width: 42px; height: 42px; margin-bottom: .5rem; color: #94a3b8; }
.empty-state p { margin: 0; font-size: .9rem; }
.results-panel { grid-area: results; padding: clamp(1.25rem, 3vw, 1.9rem); }
.shuffle-button { min-height: 46px; display: inline-flex; align-items: center; gap: .45rem; padding: .6rem .8rem; border: 1px solid rgba(13,92,58,.25); border-radius: 12px; background: rgba(13,92,58,.06); color: var(--emerald); font-size: .85rem; }
.shuffle-button:hover:not(:disabled) { background: rgba(13,92,58,.13); }
.shuffle-button svg { width: 19px; height: 19px; }
.results-summary { margin: 1rem 0 0; color: var(--muted); }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-top: 1.3rem; }
.group-card { min-width: 0; overflow: hidden; border: 1px solid rgba(12,35,64,.14); border-radius: var(--radius-medium); background: #fff; box-shadow: 0 10px 26px -22px rgba(12,35,64,.42); }
.group-card h3 { margin: 0; padding: .75rem .9rem; background: var(--navy); color: #fff; font-family: var(--display); font-size: 1rem; letter-spacing: .01em; }
.group-card:nth-child(3n+2) h3 { background: var(--emerald); }
.group-card:nth-child(3n) h3 { background: var(--amber); }
.group-card ul { margin: 0; padding: .5rem .9rem .65rem 2rem; }
.group-card li { padding: .25rem 0; overflow-wrap: anywhere; }
.app-footer { padding: 1.5rem 0 2rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .83rem; text-align: center; }
.app-footer p { margin: 0 0 .35rem; }
.app-footer nav { line-height: 1.9; }
.app-footer a { color: var(--navy); font-weight: 700; text-underline-offset: 2px; }
.app-footer span { margin: 0 .18rem; color: #94a3b8; }
@media (max-width: 840px) { .tool-layout { grid-template-columns: 1fr; grid-template-areas: "intro" "names" "results"; max-width: 680px; margin: 0 auto; } h1 { max-width: none; } }
@media (max-width: 560px) {
  .app-shell { width: min(100% - 1.25rem, 1160px); }
  .app-header { min-height: 74px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
  .brand strong { font-size: .93rem; }
  .brand small { font-size: .62rem; }
  .back-link { font-size: .78rem; }
  .tool-layout { gap: 1.25rem; padding: 1.5rem 0 2.5rem; }
  .settings-card, .names-panel, .results-panel { border-radius: 19px; }
  .entry-row { grid-template-columns: 1fr; }
  .add-button { width: 100%; }
  .paste-actions, .list-tools { align-items: flex-start; flex-direction: column; }
  .list-tools > div { width: 100%; justify-content: space-between; }
  .results-heading { align-items: stretch; flex-direction: column; }
  .shuffle-button { justify-content: center; }
  .groups { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
