:root {
  --paper: #f5f1e8;
  --paper-deep: #ece5d7;
  --ink: #1d2925;
  --muted: #718078;
  --line: rgba(29, 41, 37, .13);
  --green: #1e4d46;
  --green-deep: #163d37;
  --moss: #c9d9b5;
  --sun: #f0c95d;
  --coral: #e9a086;
  --white: #fffdf9;
  --shadow: 0 20px 50px rgba(35, 51, 45, .07);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 920px); margin: 0 auto; padding: 22px 18px 32px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; background: var(--green); color: var(--paper); font-size: 22px; font-weight: 800; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 18px; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: clamp(22px, 4vw, 30px); letter-spacing: -.05em; line-height: 1.05; }
em { color: var(--green); font-family: Georgia, serif; font-weight: 400; }
.icon-button { margin-left: auto; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--green); font-size: 24px; line-height: 1; }
.icon-button:hover { background: var(--white); }
.intro-card { position: relative; display: flex; justify-content: space-between; align-items: center; min-height: 218px; overflow: hidden; margin-bottom: 18px; padding: 30px; border-radius: var(--radius); background: var(--green); color: var(--paper); box-shadow: var(--shadow); }
.intro-card .eyebrow { color: rgba(245,241,232,.6); }
.intro-card h2 { margin: 12px 0 14px; font-size: clamp(32px, 8vw, 56px); }
.intro-card em { color: var(--sun); }
.intro-copy { max-width: 420px; margin: 0; color: rgba(245,241,232,.75); font-size: 14px; }
.orbit-art { position: relative; width: 150px; height: 150px; flex: 0 0 150px; margin-right: 8px; border: 1px solid rgba(245,241,232,.26); border-radius: 50%; transform: rotate(-18deg); }
.orbit-art::before, .orbit-art::after { content: ""; position: absolute; inset: 18px; border: 1px solid rgba(245,241,232,.22); border-radius: 50%; }
.orbit-art::after { inset: 48px; border-color: rgba(240,201,93,.65); }
.orbit-art span { position: absolute; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--sun); color: var(--green); font-weight: 800; transform: rotate(18deg); }
.orbit-art span:nth-child(1) { top: 7px; left: 58px; }
.orbit-art span:nth-child(2) { right: 9px; bottom: 45px; background: var(--coral); }
.orbit-art span:nth-child(3) { bottom: 7px; left: 53px; background: var(--moss); }
.card { margin-bottom: 18px; padding: 24px; border: 1px solid rgba(29,41,37,.06); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-heading h2 { margin-top: 7px; }
.section-heading-tight { margin-bottom: 14px; }
.status-dot { width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: #62b18e; box-shadow: 0 0 0 5px rgba(98,177,142,.13); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field span { color: var(--ink); font-size: 13px; font-weight: 700; }
.field input { width: 100%; min-height: 52px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; outline: none; background: #fbf9f3; color: var(--ink); font-size: 17px; font-weight: 700; transition: border .2s, box-shadow .2s, background .2s; }
.field input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(30,77,70,.10); }
.field small { color: var(--muted); font-size: 11px; }
.form-message { min-height: 20px; margin-top: 12px; color: #aa5546; font-size: 12px; font-weight: 600; }
.results-section { margin: 26px 0 18px; }
.section-note, .matrix-date { padding-top: 9px; color: var(--muted); font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.metric-card { min-height: 142px; padding: 18px; border-radius: 20px; }
.accent-moss { background: var(--moss); }
.accent-sun { background: var(--sun); }
.accent-coral { background: var(--coral); }
.metric-label { display: block; font-size: 12px; font-weight: 800; }
.metric-card strong { display: block; margin: 23px 0 15px; color: var(--green-deep); font-size: 56px; line-height: .75; letter-spacing: -.08em; }
.matrix-wrap { display: block; }
.matrix-grid { display: grid; width: min(100%, 300px); aspect-ratio: 1; margin: 0 auto; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.matrix-cell { position: relative; display: grid; place-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 22px; font-weight: 800; letter-spacing: 2px; }
.matrix-cell:nth-child(3n) { border-right: 0; }
.matrix-cell:nth-child(n+7) { border-bottom: 0; }
.matrix-cell.has-number { color: var(--green); background: rgba(201,217,181,.38); }
.matrix-cell.has-number::after { content: attr(data-label); position: absolute; right: 7px; bottom: 5px; color: var(--muted); font-size: 9px; letter-spacing: 0; font-weight: 700; }
.matrix-cell.empty::before { content: "·"; color: #c5cbc3; font-size: 25px; }
.matrix-date { color: var(--green); font-weight: 800; }
.name-result { display: grid; justify-items: end; text-align: right; }
.name-result span { color: var(--green); font-size: 38px; font-weight: 800; line-height: .9; }
.name-result small { max-width: 150px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.meaning-callout { margin: 14px 0; padding: 14px 16px; border-left: 3px solid var(--sun); border-radius: 0 14px 14px 0; background: #fcf6df; color: var(--green-deep); font-size: 14px; font-weight: 800; }
.mapping-details { margin: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mapping-details summary { padding: 15px 0; color: var(--green); cursor: pointer; font-size: 13px; font-weight: 800; list-style-position: inside; }
.mapping-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 0 0 16px; }
.mapping-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 11px; background: var(--paper); font-size: 12px; }
.mapping-item strong { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; background: var(--green); color: var(--paper); }
.mapping-item span { color: var(--muted); letter-spacing: .08em; font-weight: 700; }
.meaning-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.meaning-details { margin-top: 16px; }
.meaning-item { padding: 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 11px; }
.meaning-item strong { color: var(--green); margin-right: 4px; }
.offline-note { display: flex; gap: 12px; align-items: flex-start; margin: 22px 2px; padding: 17px 18px; border: 1px dashed rgba(30,77,70,.28); border-radius: 18px; color: var(--green); }
.offline-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--sun); font-size: 14px; }
.offline-note strong { display: block; margin-bottom: 3px; font-size: 13px; }
.offline-note p { margin: 0; color: var(--muted); font-size: 12px; }
.footer { padding: 4px 2px; color: var(--muted); font-size: 11px; }
.footer span { float: right; }
.activation-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(22,61,55,.72); backdrop-filter: blur(10px); }
.activation-backdrop.hidden { display: none; }
.activation-panel { width: min(100%, 410px); padding: 32px; border-radius: 28px; background: var(--paper); box-shadow: 0 30px 80px rgba(0,0,0,.22); }
.activation-panel h2 { margin: 12px 0 14px; font-size: 42px; }
.activation-panel > p:not(.eyebrow):not(.activation-error):not(.activation-footnote) { margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 54px; margin-top: 16px; padding: 0 18px; border: 0; border-radius: 15px; background: var(--green); color: var(--paper); font-weight: 800; }
.primary-button:hover { background: var(--green-deep); }
.primary-button span { font-size: 22px; }
.activation-link { display: block; width: 100%; margin-top: 10px; padding: 4px; border: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.activation-link:hover { color: var(--green-deep); }
.activation-error { min-height: 18px; margin: 10px 0 0; color: #aa5546; font-size: 12px; font-weight: 700; }
.activation-footnote { display: block; margin-top: 16px; color: var(--muted); font-size: 10px; }

.admin-page { min-height: 100vh; }
.admin-shell { width: min(100%, 980px); margin: 0 auto; padding: 28px 18px 44px; }
.admin-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.admin-header h1 { margin: 0; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.06em; }
.admin-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.admin-header .brand-mark { flex: 0 0 44px; }
.admin-security-note { margin: 0 0 18px; padding: 14px 16px; border: 1px dashed rgba(30,77,70,.28); border-radius: 16px; color: var(--green); font-size: 12px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.admin-card { margin: 0; }
.admin-card-wide { grid-column: 1 / -1; }
.admin-form { display: grid; gap: 14px; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.admin-form-grid .wide-field { grid-column: 1 / -1; }
.secondary-button { min-height: 46px; padding: 0 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: var(--green); font-weight: 800; }
.secondary-button:hover { border-color: var(--green); background: var(--white); }
.admin-output { min-height: 24px; margin: 0; padding: 13px; overflow: auto; border-radius: 13px; background: var(--paper); color: var(--green-deep); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-output:empty { display: none; }
.admin-error { color: #aa5546; }
.admin-back { display: inline-block; margin-top: 20px; color: var(--green); font-size: 12px; font-weight: 800; }
.admin-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.admin-requests { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.admin-overview-grid h3, .admin-requests h3 { margin: 0 0 9px; color: var(--green); font-size: 16px; }
.admin-hint { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.admin-list { display: grid; gap: 9px; }
.admin-list-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.admin-list-info { display: grid; gap: 3px; min-width: 0; }
.admin-list-info strong { color: var(--green-deep); font-size: 13px; overflow-wrap: anywhere; }
.admin-list-info span, .admin-list-info small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.admin-list-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.compact-button { width: auto; min-height: 36px; margin: 0; padding: 0 11px; border-radius: 10px; font-size: 11px; }
.primary-button.compact-button { display: inline-flex; justify-content: center; }
.danger-button { min-height: 36px; padding: 0 11px; border: 1px solid rgba(170,85,70,.35); border-radius: 10px; background: transparent; color: #aa5546; font-size: 11px; font-weight: 800; }
.danger-button:hover { background: #fff0ec; }
.admin-inline-token { min-width: 230px; padding: 8px; border-radius: 9px; background: var(--white); color: var(--green-deep); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-empty { margin: 0; padding: 12px; border-radius: 12px; background: var(--paper); color: var(--muted); font-size: 11px; }

@media (max-width: 700px) {
  .admin-grid, .admin-form-grid, .admin-overview-grid { grid-template-columns: 1fr; }
  .admin-card-wide, .admin-form-grid .wide-field { grid-column: auto; }
  .admin-list-row { flex-direction: column; }
  .admin-list-actions { justify-content: flex-start; width: 100%; }
}

@media (max-width: 640px) {
  .app-shell { padding: 16px 14px 28px; }
  .intro-card { min-height: 245px; padding: 24px; }
  .intro-card h2 { font-size: 39px; }
  .orbit-art { position: absolute; right: -28px; bottom: -25px; opacity: .72; transform: scale(.78) rotate(-18deg); }
  .card { padding: 20px; border-radius: 20px; }
  .field-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .metric-card { min-height: 112px; padding: 13px 10px; border-radius: 16px; }
  .metric-label { font-size: 10px; line-height: 1.15; }
  .metric-card strong { margin: 18px 0 0; font-size: clamp(36px, 11vw, 50px); }
  .matrix-grid { margin: 4px auto 4px; }
  .meaning-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .activation-panel { padding: 26px 22px; }
}

@media (min-width: 641px) {
  .wide-field { grid-column: span 2; }
}
