@import url('fonts/phosphor.css');

/* ==========================================================================
   Omamori — Apple Health · dark glassmorphism
   --------------------------------------------------------------------------
   Pure-black canvas, frosted glass cards, pill buttons, soft ambient glows.
   Typography: LXGW WenKai (local) + WenKai Mono for numerals.
   Icons: Phosphor (regular, self-hosted) — https://phosphoricons.com
   ========================================================================== */

/* ---------- Fonts (local, served from /static/fonts) ---------- */
@font-face {
    font-family: 'WenKai';
    src: url('fonts/WenKai-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'WenKai';
    src: url('fonts/WenKai-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'WenKai';
    src: url('fonts/WenKai-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'WenKaiMono';
    src: url('fonts/WenKaiMono-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'WenKaiMono';
    src: url('fonts/WenKaiMono-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'WenKaiMono';
    src: url('fonts/WenKaiMono-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
    --bg: #000000;

    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;

    --glass: rgba(255, 255, 255, 0.055);
    --glass-strong: rgba(255, 255, 255, 0.10);
    --glass-border: rgba(255, 255, 255, 0.09);
    --glass-highlight: rgba(255, 255, 255, 0.16);

    --accent: #ff375f;
    --accent-2: #ff9f0a;
    --accent-soft: rgba(255, 55, 95, 0.14);
    --accent-grad: linear-gradient(135deg, #ff2d55 0%, #ff375f 40%, #ff9f0a 130%);

    --radius-lg: 28px;
    --radius-md: 20px;
    --radius-sm: 14px;
    --radius-pill: 999px;

    --blur: 26px;
    --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.85);

    --font: 'WenKai', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-mono: 'WenKaiMono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html,
body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-weight: 400;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

img { display: block; max-width: 100%; }

/* ---------- Ambient background glows ---------- */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(60% 46% at 12% 8%, rgba(255, 55, 95, 0.16), transparent 62%),
        radial-gradient(48% 42% at 88% 18%, rgba(255, 159, 10, 0.10), transparent 60%),
        radial-gradient(58% 52% at 50% 104%, rgba(10, 132, 255, 0.13), transparent 66%);
}

/* ---------- Layout ---------- */
.page {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: clamp(28px, 7vw, 72px) 18px 48px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ---------- Hero ---------- */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
}

.logo {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    border: 1.5px solid transparent;
    background:
        linear-gradient(var(--bg), var(--bg)) padding-box,
        linear-gradient(135deg, rgba(255, 55, 95, 0.85), rgba(255, 159, 10, 0.7)) border-box;
    box-shadow: 0 14px 44px -10px rgba(255, 55, 95, 0.55);
}

.logo i {
    font-size: 38px;
    line-height: 1;
    background: linear-gradient(135deg, #ff375f, #ff9f0a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.title {
    margin: 0;
    font-size: clamp(34px, 7vw, 48px);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

.subtitle {
    margin: 0;
    font-size: 16px;
    font-weight: 300;
    color: var(--text-2);
    letter-spacing: 0.02em;
}

/* ---------- Glass card ---------- */
.card {
    position: relative;
    background: var(--glass);
    backdrop-filter: blur(var(--blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: clamp(22px, 4vw, 32px);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* thin top highlight for the "glass" catch-light */
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 26%);
}

/* ---------- Card header ---------- */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.card-head-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-chip {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent);
}

.icon-chip i { font-size: 20px; line-height: 1; }

.card-head h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.step-count {
    font-size: 14px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.step-count .mono {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
}

/* ---------- Segmented progress ---------- */
.progress {
    display: flex;
    gap: 6px;
    width: 100%;
}

.progress-seg {
    flex: 1;
    height: 6px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.progress-seg.active {
    background: var(--accent-grad);
    box-shadow: 0 0 14px rgba(255, 55, 95, 0.45);
}

/* ---------- Stage (icon + copy) ---------- */
/* Mobile-first: stacked & centered; adapts to a row on larger screens. */
.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
}

.stage-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text);
}

.stage-icon i { font-size: 28px; line-height: 1; }

.stage-copy {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stage-desc {
    margin: 0;
    font-size: 15.5px;
    color: var(--text-2);
    line-height: 1.8;
}

/* ---------- Media ---------- */
.media {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    display: grid;
    place-items: center;
    padding: 12px;
}

.media img {
    border-radius: var(--radius-sm);
    width: auto;
    height: auto;
    max-height: 260px;
    object-fit: contain;
}

/* ---------- Controls ---------- */
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.01em;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn i { font-size: 16px; line-height: 1; }

.btn:hover {
    background: var(--glass-strong);
    border-color: var(--glass-highlight);
}

.btn:active { transform: scale(0.97); }

.btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- CTA ---------- */
.cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 17px 24px;
    border-radius: var(--radius-pill);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #fff;
    background: var(--accent-grad);
    box-shadow: 0 16px 40px -12px rgba(255, 55, 95, 0.65);
    transition: transform 0.18s ease, box-shadow 0.25s ease, filter 0.2s ease;
}

.cta i { font-size: 20px; line-height: 1; }

.cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 50px -12px rgba(255, 55, 95, 0.75);
    filter: brightness(1.05);
}

.cta:active { transform: translateY(0) scale(0.99); }

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
    letter-spacing: 0.02em;
}

/* ---------- Vue transitions ---------- */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.28s ease, transform 0.28s ease;
}
.fade-enter,
.fade-leave-to {
    opacity: 0;
    transform: translateY(8px);
}
.fade-enter { transform: translateY(8px); }
.fade-leave-to { transform: translateY(-8px); }

/* ---------- Responsive: larger screens (desktop gets a light adaptation) ---------- */
@media (min-width: 640px) {
    .page { padding-top: clamp(48px, 8vw, 88px); gap: 32px; }

    .stage {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 18px;
    }

    .stage-copy { min-height: 60px; }

    .media img { max-height: 340px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Application components — forms, tables, triage badges, callouts, markdown
   ========================================================================== */

/* dark native controls (datetime-local, number spinners) */
:root { color-scheme: dark; }

/* links */
a { color: inherit; text-decoration: none; }

[hidden] { display: none !important; }

/* ---------- Logo image (SVG) ---------- */
.logo img {
    width: 38px;
    height: 38px;
    display: block;
    filter: drop-shadow(0 0 12px rgba(255, 55, 95, 0.45));
}

/* ---------- Section title ---------- */
.section-title {
    margin: 0;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    flex-shrink: 0;
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--accent-grad);
}

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 22px; }

fieldset {
    margin: 0;
    padding: 18px 16px 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

legend {
    padding: 0 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: 0.02em;
}

.field { display: flex; flex-direction: column; gap: 8px; }

.field > label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: 0.01em;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="datetime-local"],
.field textarea {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-family: inherit;
    font-size: 15.5px;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(255, 55, 95, 0.6);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }

.field textarea { min-height: 96px; resize: vertical; }

/* number input with inline unit */
.input-group { display: flex; align-items: center; gap: 10px; }
.input-group input { flex: 1; }
.unit {
    font-size: 13px;
    color: var(--text-3);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* submit button rendered as <input> */
input[type="submit"] {
    font-family: inherit;
    border: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

/* radio / checkbox choice groups */
.choice-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid transparent;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.choice-list li:hover { border-color: var(--glass-border); }

.choice-list label {
    flex: 1;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
}

.choice-list input[type="radio"],
.choice-list input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.choice-list input[type="radio"] { border-radius: 50%; }
.choice-list input[type="checkbox"] { border-radius: 6px; }

.choice-list input[type="radio"]:checked {
    border-color: transparent;
    background: var(--accent-grad);
}

.choice-list input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: #fff;
}

.choice-list input[type="checkbox"]:checked {
    border-color: transparent;
    background: var(--accent-grad);
}

.choice-list input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ---------- Field error ---------- */
.field-error { font-size: 13px; color: var(--accent); }

/* ---------- Tables ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.table th,
.table td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: top;
}

.table tr:last-child th,
.table tr:last-child td { border-bottom: none; }

.table th {
    font-weight: 500;
    color: var(--text-2);
    font-size: 14px;
    white-space: nowrap;
    width: 42%;
}

.table td { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Triage badge ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 7px;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 22px -8px rgba(0, 0, 0, 0.6);
}

.badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.9;
}

/* ---------- Reason list ---------- */
.reason-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reason-list li {
    position: relative;
    padding-left: 18px;
    font-size: 14.5px;
    color: var(--text-2);
}

.reason-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-grad);
}

/* ---------- Callout (time reminder) ---------- */
.callout {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    border: 1px solid rgba(255, 55, 95, 0.25);
}

.callout .line {
    font-size: 15px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ---------- AI report (rendered Markdown) ---------- */
.ai-report { line-height: 1.8; word-break: break-word; font-size: 15.5px; }
.ai-report h1, .ai-report h2, .ai-report h3, .ai-report h4 {
    margin: 1.1em 0 0.4em;
    line-height: 1.3;
    font-weight: 500;
}
.ai-report h1 { font-size: 1.45em; }
.ai-report h2 { font-size: 1.28em; }
.ai-report h3 { font-size: 1.14em; }
.ai-report h4 { font-size: 1.05em; }
.ai-report p { margin: 0.5em 0; }
.ai-report ul, .ai-report ol { margin: 0.4em 0; padding-left: 1.5em; }
.ai-report li { margin: 0.2em 0; }
.ai-report strong { color: var(--accent); }
.ai-report em { color: var(--accent-2); }
.ai-report code {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}
.ai-report pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}
.ai-report pre code { background: none; padding: 0; }
.ai-report table { border-collapse: collapse; margin: 0.6em 0; width: 100%; }
.ai-report th, .ai-report td {
    border: 1px solid var(--glass-border);
    padding: 6px 10px;
    text-align: left;
}
.ai-report blockquote {
    margin: 0.6em 0;
    padding-left: 1em;
    border-left: 3px solid var(--accent);
    color: var(--text-2);
}

.ai-error { color: var(--accent-2); }

/* ---------- Muted helpers ---------- */
.hint {
    margin: 0;
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.7;
}

.muted { color: var(--text-3); }

/* record card id */
.record-id {
    font-size: 14px;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- Compact hero (in-flow pages: detection / symptoms / report / records) ---------- */
.hero--sm { gap: 12px; }

.hero--sm .logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
}

.hero--sm .logo img { width: 28px; height: 28px; }

.hero--sm .title { font-size: clamp(26px, 5.5vw, 34px); }

.hero--sm .subtitle { font-size: 14px; }

/* ---------- Inline tag (e.g. 极高危 in a fieldset legend) ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    vertical-align: middle;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(255, 55, 95, 0.28);
}

/* ---------- Empty state ---------- */
.empty {
    margin: 0;
    padding: 24px 12px;
    text-align: center;
    color: var(--text-2);
    font-size: 15px;
}

.empty i {
    display: block;
    font-size: 30px;
    line-height: 1;
    margin-bottom: 10px;
    color: var(--text-3);
}

/* ---------- Selection & scrollbar polish ---------- */
::selection {
    background: rgba(255, 55, 95, 0.35);
    color: #fff;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-pill);
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
    background-clip: padding-box;
}
