:root {
  color-scheme: light;
  --paper: #f4f3ee;
  --card: #fffefa;
  --ink: #1d2926;
  --muted: #59675f;
  --line: #e4e5dc;
  --green: #176c57;
  --green-dark: #125745;
  --mint: #e9f2ec;
  --orange: #a84b27;
  --orange-pale: #fff0e7;
  --shadow: 0 18px 50px rgba(38, 50, 43, .055), 0 2px 8px rgba(38, 50, 43, .025);
  font-family: Inter, "Aptos", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 15px; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.page-shell { width: min(1180px, calc(100% - 64px)); margin: 0 auto; }

.topbar { min-height: 78px; border-bottom: 1px solid #dedfd7; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.wordmark { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-size: 12px; font-weight: 850; letter-spacing: .15em; }
.brand-mark { position: relative; display: grid; grid-template-columns: repeat(2, 6px); gap: 3px; transform: rotate(-8deg); }
.brand-mark i { width: 6px; height: 6px; display: block; border: 1.5px solid var(--green); border-radius: 2px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--orange); border-color: var(--orange); }
.top-meta, .text-link { font-family: "Aptos Mono", "Cascadia Code", monospace; font-size: 10px; letter-spacing: .13em; color: #526058; }
.top-meta { display: flex; align-items: center; gap: 9px; }
.live-dot, .result-dot { width: 7px; height: 7px; border-radius: 99px; background: #58a875; box-shadow: 0 0 0 3px rgba(88, 168, 117, .14); }
.top-divider { color: #c1c7bf; }
.text-link { text-decoration: none; font-family: inherit; font-size: 12px; letter-spacing: .01em; }
.text-link span { color: var(--green); padding-left: 4px; }

.tool-intro { padding: 35px 0 24px; }
.eyebrow, .section-kicker, .brief-label { font-family: "Aptos Mono", "Cascadia Code", monospace; font-size: 10px; letter-spacing: .13em; font-weight: 700; color: var(--green); }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow-line { width: 23px; height: 1px; background: var(--orange); }
.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 13px 0 6px; font-size: clamp(31px, 4vw, 43px); line-height: 1.05; letter-spacing: -.052em; font-weight: 720; }
.intro-copy { color: #59675f; margin: 0; font-size: 14px; line-height: 1.55; }
.edition-chip { flex: none; margin-bottom: 4px; border: 1px solid #d8e4da; color: var(--green); background: rgba(255,255,255,.56); border-radius: 99px; padding: 9px 12px; font-family: "Aptos Mono", "Cascadia Code", monospace; font-size: 9px; letter-spacing: .09em; font-weight: 700; }
.chip-icon { color: var(--orange); font-size: 13px; vertical-align: -1px; margin-right: 6px; }

.generator-grid { display: grid; grid-template-columns: minmax(320px, .88fr) minmax(480px, 1.42fr); gap: 18px; align-items: start; }
.form-card, .result-card { background: var(--card); border: 1px solid #e6e6df; border-radius: 14px; box-shadow: var(--shadow); }
.form-card { padding: 25px 25px 18px; }
.card-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 21px; }
.section-kicker { color: #59675f; font-size: 9px; }
.section-kicker span { color: var(--orange); padding: 0 2px; }
.card-heading h2 { margin: 7px 0 0; font-size: 20px; letter-spacing: -.035em; }
.die-stamp { width: 35px; height: 35px; border: 1px solid #e7ded0; border-radius: 10px 10px 12px 10px; display: grid; place-items: center; color: var(--orange); font-family: "Aptos Mono", monospace; font-size: 10px; font-weight: 800; transform: rotate(4deg); }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin-bottom: 16px; }
.field-title { display: flex; gap: 8px; align-items: center; color: #46534d; font-size: 11px; line-height: 1.2; font-weight: 680; }
.optional { font-family: "Aptos Mono", monospace; font-size: 8px; color: #59675f; letter-spacing: .08em; }
input, select { min-width: 0; width: 100%; height: 42px; border: 1px solid #e1e5dc; border-radius: 7px; background-color: #fff; color: #293631; padding: 0 12px; outline: none; font-size: 12px; transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease; }
select { cursor: pointer; appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='m3 4.5 3 3 3-3' stroke='%2375807b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input::placeholder { color: #59675f; }
input:hover, select:hover { border-color: #c5d5c9; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(34, 124, 94, .22); outline-offset: 2px; border-color: #4e9a78; }
.field-hint { color: #59675f; font-size: 10px; line-height: 1.4; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-footer { padding-top: 3px; }
.button { min-height: 46px; border: 0; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.button-primary { width: 100%; background: var(--green); color: white; padding: 0 15px; font-size: 12px; font-weight: 700; box-shadow: 0 4px 10px rgba(23, 108, 87, .13); transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease; }
.button-primary:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 7px 15px rgba(23, 108, 87, .19); }
.button-primary:active { transform: translateY(1px) scale(.995); }
.button-star { color: #d5f2d9; font-size: 16px; }
.button-arrow { font-size: 15px; font-weight: 500; }
.privacy-note { margin: 12px 0 0; display: flex; gap: 7px; align-items: center; color: #59675f; font-size: 10px; }
.privacy-note span { font-size: 12px; color: #34734d; }
.form-message { display: none; margin: 11px 0 0; padding: 8px 10px; border-radius: 6px; color: #9c4c36; background: var(--orange-pale); font-size: 11px; }
.form-message.visible { display: block; }

.result-card { position: relative; padding: 19px 23px 20px; overflow: hidden; }
.result-topline { display: flex; align-items: center; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid #ecece5; }
.result-actions { display: flex; gap: 6px; }
.icon-button { height: 32px; border: 1px solid #e4e8df; border-radius: 7px; background: #fff; color: #4b5b53; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; font-size: 12px; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.icon-button:hover { border-color: #b8d2c0; background: #f4f8f4; color: var(--green); }
.icon-button span:first-child { font-size: 14px; }
.action-label { font-size: 10px; font-weight: 650; }
.npc-result { transition: opacity .14s ease, transform .14s ease; }
.npc-result.is-refreshing { opacity: .4; transform: translateY(3px); }
.result-identity { display: flex; align-items: center; gap: 15px; padding: 19px 0 17px; }
.portrait-token { position: relative; isolation: isolate; flex: none; width: 62px; height: 62px; overflow: hidden; display: grid; place-items: center; border-radius: 20px 20px 24px 20px; background: #e9eee5; color: var(--green); font-family: Georgia, serif; font-size: 22px; font-weight: 700; letter-spacing: -.08em; }
.portrait-token::before, .portrait-token::after { position: absolute; content: ""; z-index: -1; border-radius: 50%; }
.portrait-token::before { width: 56px; height: 56px; background: #d3e5d6; top: -22px; right: -20px; }
.portrait-token::after { width: 48px; height: 48px; background: rgba(226,123,78,.19); bottom: -28px; left: -13px; }
.token-initials { position: relative; }
.token-spark { position: absolute; right: 8px; top: 5px; z-index: 1; color: var(--orange); font-family: sans-serif; font-size: 11px; }
.token-ring { position: absolute; bottom: 7px; right: 8px; width: 7px; height: 7px; border: 1px solid #6a9c7d; border-radius: 50%; }
.result-label { display: flex; align-items: center; gap: 8px; color: #59675f; font-family: "Aptos Mono", monospace; font-size: 8px; letter-spacing: .12em; font-weight: 700; }
.result-dot { width: 6px; height: 6px; box-shadow: none; }
.identity-copy h2 { margin: 6px 0 4px; font-size: clamp(20px, 2.6vw, 26px); line-height: 1.1; letter-spacing: -.045em; }
.identity-subtitle { margin: 0; color: #59675f; font-size: 12px; }
.bullet { padding: 0 7px; color: #b7bcb6; }
.result-rule { height: 1px; background: #ecece5; }
.character-brief { display: grid; grid-template-columns: 1.05fr .95fr; gap: 20px; padding: 17px 0 12px; }
.brief-label { color: #59675f; font-size: 8px; letter-spacing: .12em; }
.description-copy, .personality-copy { min-height: 47px; margin: 8px 0 10px; color: #405049; font-size: 11px; line-height: 1.58; }
.personality-copy { font-family: Georgia, serif; font-size: 12px; font-style: italic; line-height: 1.48; }
.detail-pair { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; padding: 5px 0; border-top: 1px solid #f0f0ea; color: #59675f; font-size: 10px; }
.detail-pair strong { max-width: 72%; color: #405049; font-size: 10px; text-align: right; font-weight: 650; }
.hook-strip { display: flex; align-items: start; gap: 10px; padding: 12px 13px; border: 1px solid #f0e1d6; border-radius: 8px; background: #fff9f3; }
.hook-icon { color: var(--orange); font-family: Georgia, serif; font-size: 18px; line-height: 1; }
.hook-strip .brief-label { color: #a84b27; }
.hook-strip p { margin: 5px 0 0; color: #614c40; font-size: 11px; line-height: 1.5; }
.stat-block { margin-top: 15px; padding: 14px 14px 11px; border: 1px solid #e5ebe2; border-radius: 9px; background: #f8faf6; }
.stat-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.stat-heading h3 { margin: 4px 0 0; font-size: 15px; letter-spacing: -.025em; }
.cr-badge { border: 1px solid #d9e7dc; border-radius: 99px; padding: 5px 9px; background: white; color: var(--green); font-family: "Aptos Mono", monospace; font-size: 9px; font-weight: 700; }
.combat-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 11px; }
.combat-stat { padding: 7px 8px; border-radius: 6px; background: #fff; border: 1px solid #edf0e9; }
.combat-stat span { display: block; color: #59675f; font-family: "Aptos Mono", monospace; font-size: 7px; letter-spacing: .1em; }
.combat-stat strong { display: block; margin-top: 3px; color: #34443c; font-size: 12px; font-weight: 720; font-variant-numeric: tabular-nums; }
.ability-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid #e7ebe3; border-bottom: 1px solid #e7ebe3; }
.ability { padding: 8px 4px; text-align: center; border-right: 1px solid #e7ebe3; }
.ability:last-child { border: 0; }
.ability span { display: block; color: #59675f; font-family: "Aptos Mono", monospace; font-size: 7px; letter-spacing: .04em; }
.ability strong { display: block; margin-top: 4px; font-size: 13px; line-height: 1; font-variant-numeric: tabular-nums; }
.ability em { display: block; margin-top: 3px; color: var(--green); font-size: 9px; font-style: normal; font-variant-numeric: tabular-nums; }
.stat-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 10px; }
.stat-extra-block { min-width: 0; }
.stat-extra-block b { display: block; margin-bottom: 4px; color: #59675f; font-family: "Aptos Mono", monospace; font-size: 7px; letter-spacing: .1em; }
.stat-extra-block span { display: block; color: #4a584f; font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
.stat-source { margin: 10px 0 0; color: #59675f; font-size: 8px; line-height: 1.45; }
.stat-source a { color: #176c57; text-underline-offset: 2px; }
.copy-toast { position: absolute; right: 20px; top: 61px; z-index: 2; transform: translateY(-3px); opacity: 0; pointer-events: none; border-radius: 6px; padding: 7px 10px; background: #243b31; color: white; font-size: 10px; box-shadow: 0 5px 14px rgba(0,0,0,.12); transition: opacity .16s ease, transform .16s ease; }
.copy-toast.show { opacity: 1; transform: translateY(0); }

.trust-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 13px 0 70px; }
.trust-row > div { display: flex; gap: 9px; align-items: center; min-height: 40px; border-top: 1px solid #dddfd6; padding: 0 4px; color: #59675f; font-size: 10px; }
.trust-mark { color: var(--orange); font-family: "Aptos Mono", monospace; font-size: 8px; font-weight: 700; }
.details-section { display: grid; grid-template-columns: .78fr 1.22fr; gap: 50px; padding: 32px 0 62px; border-top: 1px solid #dedfd7; }
.details-heading h2 { margin: 16px 0 0; font-size: 30px; line-height: 1.12; letter-spacing: -.05em; }
.details-heading h2 span { color: #59675f; }
.details-content { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-card { position: relative; min-height: 157px; padding: 17px; border: 1px solid #e1e3da; border-radius: 10px; background: rgba(255,255,255,.5); }
.detail-number { color: var(--orange); font-family: "Aptos Mono", monospace; font-size: 9px; font-weight: 700; }
.detail-card h3 { margin: 11px 0 7px; font-size: 13px; letter-spacing: -.015em; }
.detail-card p { margin: 0; color: #59675f; font-size: 10px; line-height: 1.6; }
.source-links { display: flex; gap: 7px 12px; flex-wrap: wrap; margin-top: 10px; }
.source-links a { min-height: 28px; display: inline-flex; align-items: center; padding: 0 4px; color: var(--green); font-size: 9px; text-decoration: none; text-underline-offset: 3px; }
.source-links a:hover { text-decoration: underline; }
.faq-section { display: grid; grid-template-columns: .78fr 1.22fr; gap: 50px; padding: 33px 0 56px; border-top: 1px solid #dedfd7; }
.faq-head h2 { margin: 13px 0 0; font-size: 25px; letter-spacing: -.04em; }
.faq-list details { padding: 13px 0; border-bottom: 1px solid #dedfd7; }
.faq-list details:first-child { border-top: 1px solid #dedfd7; }
.faq-list summary { cursor: pointer; list-style: none; font-size: 12px; font-weight: 650; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; float: right; color: var(--green); font-size: 16px; line-height: 12px; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list details p { margin: 9px 24px 0 0; max-width: 620px; color: #59675f; font-size: 11px; line-height: 1.6; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; border-top: 1px solid #dedfd7; color: #59675f; font-size: 9px; }
.footer-brand { color: var(--ink); font-size: 9px; }
.footer > a:last-child { text-decoration: none; color: var(--green); }

@media (max-width: 880px) {
  .page-shell { width: min(100% - 40px, 720px); }
  .generator-grid { grid-template-columns: minmax(0, .91fr) minmax(0, 1.09fr); gap: 12px; }
  .form-card { padding: 20px 17px 16px; }
  .result-card { padding: 17px; }
  .character-brief { gap: 13px; }
  .details-section, .faq-section { gap: 30px; }
}

@media (max-width: 680px) {
  body { font-size: 14px; }
  .page-shell { width: min(100% - 30px, 520px); }
  .topbar { min-height: 62px; gap: 10px; }
  .top-meta { display: none; }
  .wordmark { font-size: 10px; }
  .text-link { font-size: 11px; }
  .tool-intro { padding: 25px 0 17px; }
  .eyebrow { font-size: 8px; }
  .intro-row { display: block; }
  h1 { font-size: clamp(30px, 8vw, 37px); margin-top: 11px; }
  .intro-copy { max-width: 350px; font-size: 12px; }
  .edition-chip { display: inline-block; margin-top: 13px; margin-bottom: 0; padding: 7px 10px; font-size: 8px; }
  .generator-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-card { padding: 20px 18px 16px; }
  .card-heading { margin-bottom: 18px; }
  .field { margin-bottom: 14px; }
  .field-grid { gap: 10px; }
  input, select { height: 44px; font-size: 12px; }
  .result-card { padding: 15px 16px 17px; border-radius: 12px; }
  .result-topline { padding-bottom: 12px; }
  .result-identity { padding: 16px 0 14px; gap: 12px; }
  .portrait-token { width: 54px; height: 54px; border-radius: 17px 17px 20px 17px; font-size: 19px; }
  .identity-copy h2 { font-size: 22px; }
  .character-brief { gap: 12px; padding-top: 14px; }
  .description-copy, .personality-copy { min-height: 0; font-size: 10px; }
  .personality-copy { font-size: 11px; }
  .detail-pair { align-items: start; }
  .detail-pair strong { max-width: 68%; }
  .stat-block { padding: 12px 11px 10px; }
  .combat-summary { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; }
  .combat-stat { padding: 7px 5px; }
  .combat-stat strong { font-size: 11px; }
  .ability { padding: 8px 2px; }
  .ability span { font-size: 6px; }
  .trust-row { gap: 7px; margin: 10px 0 46px; }
  .trust-row > div { align-items: flex-start; gap: 6px; font-size: 8px; line-height: 1.4; }
  .details-section, .faq-section { grid-template-columns: 1fr; gap: 20px; padding: 27px 0 40px; }
  .details-heading h2 { font-size: 26px; }
  .details-content { gap: 9px; }
  .detail-card { min-height: 0; padding: 13px; }
  .detail-card h3 { font-size: 12px; }
  .detail-card p { font-size: 9px; }
  .faq-section { gap: 16px; }
  .footer { flex-wrap: wrap; justify-content: space-between; padding: 13px 0; }
  .footer > span { order: 3; width: 100%; }
}

@media (max-width: 370px) {
  .page-shell { width: calc(100% - 24px); }
  .form-card { padding-inline: 14px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .character-brief { grid-template-columns: 1fr; }
  .description-copy, .personality-copy { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  body { background: white; }
  .topbar, .tool-intro, .form-card, .trust-row, .details-section, .faq-section, .footer, .result-topline, .copy-toast { display: none !important; }
  .page-shell { width: 100%; }
  .generator-grid { display: block; }
  .result-card { border: 0; box-shadow: none; padding: 0; }
  .npc-result { display: block !important; }
}
