:root {
  --ink: #0d3553;
  --muted: #444444;
  --paper: #f9f9f9;
  --white: #ffffff;
  --line: #dbdbdb;
  --green: #1d6ba6;
  --green-dark: #0d3553;
  --mint: #e6f6fb;
  --gold: #0095c8;
  --journey: #15eac4;
  --shadow: 0 22px 65px rgba(13, 53, 83, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Roboto", Arial, sans-serif; min-height: 100vh; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(215, 161, 59, .35); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.site-header { height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 5vw, 80px); border-bottom: 1px solid rgba(13,53,83,.12); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); position: relative; z-index: 2; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 18px; font-size: 14px; font-weight: 700; }
.brand img { display: block; height: 50px; width: auto; max-width: 225px; object-fit: contain; }
.brand span { border-left: 1px solid var(--line); padding-left: 18px; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.edition-pill { padding: 8px 13px; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--green); background: var(--white); }
.icon-button, .icon-action { border: 1px solid var(--line); background: var(--white); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
main { padding: 0 clamp(20px, 5vw, 80px) 90px; }
.hero { max-width: 760px; margin: 64px auto 43px; text-align: center; }
.eyebrow { text-transform: uppercase; font-size: 11px; letter-spacing: .15em; font-weight: 700; color: var(--green); display: inline-flex; align-items: center; gap: 8px; }
.eyebrow > span { width: 20px; height: 1px; background: var(--gold); }
.hero h1 { margin: 12px 0 14px; font-family: "Merriweather", serif; font-size: clamp(42px, 5.3vw, 64px); font-style: italic; font-weight: 900; line-height: 1.06; letter-spacing: -.035em; }
.hero h1 em { color: var(--green); font-weight: 900; }
.hero > p { color: var(--muted); max-width: 610px; margin: auto; font-size: 17px; line-height: 1.65; }
.workspace { max-width: 1260px; margin: auto; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .8fr); border: 1px solid var(--line); border-top: 5px solid var(--horizon, #0095c8); background: var(--white); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.input-panel { min-width: 0; }
.method-tabs { height: 66px; display: flex; padding: 0 30px; gap: 28px; border-bottom: 1px solid var(--line); }
.method-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0 2px; }
.method-tab svg { width: 18px; }
.method-tab.active { color: var(--green); border-bottom-color: var(--green); }
.tab-panel { padding: 32px 36px 36px; }
.panel-intro { display: flex; justify-content: space-between; align-items: center; margin-bottom: 27px; }
.panel-intro h2, .output-top h2 { font-family: "Merriweather", serif; font-style: italic; font-weight: 900; font-size: 25px; margin: 0 0 6px; }
.panel-intro p { margin: 0; color: var(--muted); font-size: 13px; }
.steps { display: flex; align-items: center; gap: 5px; }
.steps b, .steps i { width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-style: normal; border: 1px solid var(--line); color: #909891; }
.steps b { color: white; background: var(--green); border-color: var(--green); }
.steps span { width: 17px; height: 1px; background: var(--line); }
.steps span.done { background: var(--green); }
.lookup-form { display: flex; gap: 10px; }
.url-field { flex: 1; position: relative; }
.url-field svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; color: #89928c; }
input, select { border: 1px solid #d9ded8; border-radius: 8px; background: #fff; min-height: 46px; width: 100%; padding: 0 13px; color: var(--ink); transition: border .2s, box-shadow .2s; }
input::placeholder { color: #a0a7a2; }
input:hover, select:hover { border-color: #b8c2bb; }
input:focus, select:focus { border-color: var(--green); outline: 0; box-shadow: 0 0 0 3px rgba(40,95,74,.09); }
.url-field input { padding-left: 44px; height: 50px; }
.primary-button { height: 50px; padding: 0 21px; border: 0; border-radius: 8px; background: var(--journey); color: var(--green-dark); font-weight: 700; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 13px; transition: transform .15s, background .15s, box-shadow .15s; }
.primary-button:hover { background: #42f0d0; box-shadow: 0 6px 16px rgba(13,53,83,.18); transform: translateY(-1px); }
.primary-button svg { width: 17px; }
.lookup-status { min-height: 27px; margin-top: 11px; font-size: 12px; color: var(--muted); }
.lookup-status.error { color: #a54839; }
.lookup-status.loading { color: var(--green); }
.privacy-note { margin-top: 7px; padding: 12px 14px; color: var(--muted); background: #f5f7f3; border-radius: 8px; font-size: 11px; display: flex; align-items: center; gap: 8px; }
.privacy-note svg { width: 15px; color: var(--green); }
.try-examples { margin-top: 24px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.try-examples button { border: 1px solid var(--line); border-radius: 99px; background: transparent; padding: 6px 10px; cursor: pointer; font-size: 10px; color: var(--green); }
.output-panel { background: #eef8fc; border-left: 1px solid var(--line); padding: 31px; display: flex; flex-direction: column; }
.output-top { display: flex; justify-content: space-between; align-items: flex-start; }
.result-label { display: block; text-transform: uppercase; font-size: 10px; letter-spacing: .14em; color: var(--green); font-weight: 700; margin-bottom: 5px; }
.apa-badge { color: var(--green); background: var(--mint); border-radius: 4px; padding: 5px 8px; font-size: 10px; font-weight: 700; letter-spacing: .05em; }
.citation-paper { flex: 1; min-height: 245px; margin: 20px 0 14px; padding: 28px; background: white; border: 1px solid #e0e3de; border-radius: 4px; box-shadow: 0 8px 24px rgba(35,53,44,.06); display: grid; place-items: center; position: relative; overflow: hidden; }
.citation-paper::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0, transparent 29px, rgba(40,95,74,.025) 30px); }
.empty-result { text-align: center; position: relative; z-index: 1; }
.paper-icon { width: 48px; height: 59px; margin: 0 auto 14px; border: 1.5px solid #c5cdc7; border-radius: 3px; display: flex; flex-direction: column; gap: 6px; justify-content: center; padding: 10px; transform: rotate(-2deg); }
.paper-icon span { height: 1px; background: #c5cdc7; display: block; }
.paper-icon span:last-child { width: 65%; }
.empty-result h3 { font-family: "Merriweather", serif; font-style: italic; font-weight: 900; margin: 0 0 6px; font-size: 17px; }
.empty-result p { margin: 0; color: var(--muted); font-size: 11px; }
.citation-result { width: 100%; position: relative; z-index: 1; align-self: start; }
.citation-text { font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 2; padding-left: 30px; text-indent: -30px; overflow-wrap: anywhere; }
.citation-text em { font-style: italic; }
.edit-result { margin-top: 25px; border: 0; border-bottom: 1px solid var(--green); color: var(--green); background: transparent; padding: 2px 0; cursor: pointer; font-size: 11px; }
.result-actions { display: flex; gap: 8px; }
.copy-button { flex: 1; height: 42px; border: 0; border-radius: 7px; background: var(--journey); color: var(--green-dark); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.copy-button svg { width: 16px; }
.copy-button:disabled, .icon-action:disabled { opacity: .38; cursor: not-allowed; }
.icon-action { border-radius: 7px; height: 42px; width: 42px; }
.pro-tip { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 54px 1fr; gap: 8px; font-size: 10px; color: var(--muted); line-height: 1.55; }
.pro-tip b { color: var(--green); text-transform: uppercase; letter-spacing: .08em; font-size: 9px; }
.pro-tip p { margin: 0; }
.manual-intro { margin-bottom: 22px; }
.source-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-bottom: 27px; }
.source-type { min-width: 0; border: 1px solid var(--line); background: white; border-radius: 7px; padding: 10px 3px; color: var(--muted); font-size: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.source-type span { font-size: 18px; height: 21px; color: var(--green); }
.source-type.active { border-color: var(--green); color: var(--green); background: #f2f8f4; box-shadow: inset 0 0 0 1px var(--green); font-weight: 700; }
.form-section { padding: 22px 0; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.section-heading h3 { margin: 0; font-family: "Merriweather", serif; font-style: italic; font-weight: 900; font-size: 18px; }
.section-heading span { color: var(--muted); font-size: 10px; }
.author-row { display: grid; grid-template-columns: 1fr 1fr 32px; gap: 9px; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 10px; font-weight: 700; color: #4d5953; }
.field.full { grid-column: 1 / -1; }
.field.two-thirds { grid-column: span 2; }
.remove-author { width: 32px; height: 46px; margin-top: 16px; border: 0; background: transparent; color: #9a6358; cursor: pointer; font-size: 17px; }
.author-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 11px; font-weight: 600; padding: 3px 0; cursor: pointer; }
.check-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; cursor: pointer; }
.check-label input { min-height: 0; width: 15px; height: 15px; accent-color: var(--green); }
.corporate-field { margin-top: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px 10px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; }
.secondary-button { background: transparent; border: 1px solid var(--line); padding: 10px 14px; border-radius: 7px; color: var(--muted); font-size: 11px; cursor: pointer; }
.generate-button { height: 44px; }
.history-section { max-width: 1260px; margin: 60px auto 0; display: grid; grid-template-columns: 1fr auto; gap: 24px; }
.history-section h2 { font-family: "Merriweather", serif; font-style: italic; font-weight: 900; font-size: 28px; margin: 7px 0 0; }
.danger { color: #a54839; align-self: end; }
.history-list { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.history-card { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 13px; }
.history-card p { font-family: Georgia, serif; line-height: 1.55; font-size: 12px; margin: 0; padding-left: 18px; text-indent: -18px; flex: 1; }
.history-card div { display: flex; justify-content: space-between; align-items: center; }
.history-card span { text-transform: uppercase; font-size: 8px; letter-spacing: .1em; color: var(--muted); }
.history-card button { border: 0; background: transparent; color: var(--green); font-size: 10px; cursor: pointer; }
footer { border-top: 1px solid var(--line); padding: 22px clamp(24px,5vw,80px); color: var(--muted); font-size: 10px; display: flex; justify-content: space-between; }
.toast { position: fixed; left: 50%; bottom: 25px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: white; padding: 10px 16px; border-radius: 99px; font-size: 11px; pointer-events: none; transition: .25s; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 920px) {
  .workspace { grid-template-columns: 1fr; }
  .output-panel { border-left: 0; border-top: 1px solid var(--line); }
  .citation-paper { min-height: 210px; }
  .history-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .site-header { height: 64px; padding: 0 18px; }
  .brand img { height: 45px; max-width: 190px; }
  .brand span { display: none; }
  .edition-pill { display: none; }
  main { padding: 0 12px 60px; }
  .hero { margin: 42px auto 30px; padding: 0 12px; }
  .hero h1 { font-size: 43px; }
  .hero > p { font-size: 14px; }
  .workspace { border-radius: 12px; }
  .method-tabs { padding: 0 15px; gap: 14px; }
  .method-tab { flex: 1; justify-content: center; font-size: 11px; }
  .tab-panel, .output-panel { padding: 24px 18px; }
  .panel-intro { align-items: flex-start; }
  .steps { display: none; }
  .lookup-form { flex-direction: column; }
  .source-picker { grid-template-columns: repeat(5, 64px); overflow-x: auto; padding-bottom: 5px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field.two-thirds { grid-column: 1 / -1; }
  .author-row { grid-template-columns: 1fr 1fr 25px; }
  .author-actions { align-items: flex-start; gap: 12px; }
  .history-list { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 7px; }
}
