:root {
    color-scheme: light;
    font-size: 16px;
    --bg: #fefdfb;
    --panel: rgba(255, 255, 255, 0.82);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.35);
    --ink: #202124;
    --muted: #6f7175;
    --accent: #ff7043;
    --accent-soft: rgba(255, 112, 67, 0.12);
    --accent-strong: #d84315;
    --border: rgba(32, 33, 36, 0.08);
    --radius-lg: 26px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow-md: 0 24px 48px rgba(40, 40, 50, 0.14);
    --shadow-sm: 0 10px 26px rgba(40, 40, 50, 0.08);
    --chip-bg: rgba(255, 255, 255, 0.65);
    --chip-active: rgba(255, 112, 67, 0.18);
    --hero-grad-a: rgba(255, 244, 231, 0.95);
    --hero-grad-b: rgba(255, 222, 194, 0.82);
    --hero-glow: rgba(255, 166, 112, 0.36);
    --hero-viz-overlay: rgba(168, 229, 207, 0.22);
    --journey-bg: rgba(255, 255, 255, 0.72);
    --journey-border: rgba(255, 255, 255, 0.28);
}

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

body {
    margin: 0;
    padding: 32px;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: radial-gradient(120% 160% at 0% 10%, rgba(255, 193, 7, 0.12), rgba(255, 112, 67, 0) 58%),
        radial-gradient(120% 150% at 100% 0%, rgba(255, 138, 101, 0.22), rgba(255, 255, 255, 0) 60%), var(--bg);
    color: var(--ink);
    overflow-x: hidden;
}

.app-shell {
    max-width: 1240px;
    margin: 0 auto;
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 32px;
    padding: 40px;
    border-radius: 34px;
    background: linear-gradient(135deg, var(--hero-grad-a), var(--hero-grad-b));
    box-shadow: var(--shadow-md), 0 0 120px var(--hero-glow);
    overflow: hidden;
    animation: heroBreath 16s ease-in-out infinite alternate;
}

.hero-layer {
    position: relative;
    z-index: 2;
}

.hero-copy h1 {
    margin: 14px 0 10px;
    font-size: clamp(2.4rem, 4vw, 3.5rem);
    letter-spacing: -0.02em;
}

.hero-lede {
    margin: 0;
    max-width: 520px;
    color: rgba(32, 33, 36, 0.76);
    line-height: 1.68;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 112, 67, 0.14);
    color: var(--accent-strong);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 24px 0 12px;
}

.hero-microcopy {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.micro-card {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: 0 12px 24px rgba(255, 112, 67, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.micro-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(32, 33, 36, 0.55);
}

.micro-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-strong);
}

.hero-viz {
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 1;
}

.hero-viz canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.hero-radar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.32);
    border-radius: 28px;
    padding: 22px 22px 24px;
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 18px 38px rgba(32, 33, 36, 0.12);
    overflow: hidden;
}

#radarCanvas {
    width: 92%;
    max-width: 260px;
    aspect-ratio: 1 / 0.9;
    border-radius: 20px;
    filter: drop-shadow(0 12px 22px rgba(32, 33, 36, 0.12));
    display: block;
    margin: 0 auto;
    position: absolute;
    top: 57px;
}

.hero-radar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 22px;
}

.radar-label {
    display: inline-flex;
    justify-content: space-between;
    align-items: baseline;
    color: rgba(32, 33, 36, 0.72);
    width: 100%;
}

.radar-title {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.radar-meta {
    font-size: 0.85rem;
    color: rgba(32, 33, 36, 0.55);
}

.radar-legends {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    margin-top: 6px;
    position: absolute;
    bottom: 16px;
}

.legend-bubble {
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    color: rgba(32, 33, 36, 0.7);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-spark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.control-layout {
    margin-top: 36px;
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
}

.panel {
    padding: 30px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
}

.control-tower h2,
.panel-heading h2 {
    margin: 0;
    font-size: 1.6rem;
    white-space: nowrap;
    word-break: keep-all;
}

.control-tower .panel-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.control-tower .panel-heading p {
    color: var(--muted);
}

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

.field-group h3 {
    margin: 0;
    font-size: 1.05rem;
}

.field-two-column {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.field-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    color: var(--muted);
    font-size: 0.95rem;
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    border: 1px solid rgba(32, 33, 36, 0.09);
    padding: 10px 18px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    backdrop-filter: blur(10px);
}

.chip.active {
    background: var(--chip-active);
    border-color: rgba(255, 112, 67, 0.35);
    color: var(--accent-strong);
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(255, 112, 67, 0.18);
    transform: translateY(-2px);
}

.radio-grid .chip.active {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.select-group select,
textarea {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(250, 250, 250, 0.9);
    font-family: inherit;
    font-size: 0.95rem;
}

textarea {
    resize: vertical;
}

input[type="range"] {
    width: 100%;
}

.field-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    border: none;
    border-radius: 999px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #ff8a65);
    color: #fff;
    box-shadow: 0 14px 28px rgba(255, 112, 67, 0.28);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(255, 112, 67, 0.32);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 112, 67, 0.32);
    color: var(--accent-strong);
}

.btn-ghost:hover {
    background: rgba(255, 112, 67, 0.12);
    transform: translateY(-1px);
}

.btn-translucent {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.42);
    color: var(--ink);
}

.btn-text {
    background: transparent;
    color: var(--muted);
    padding: 8px 12px;
}

.btn-text:hover {
    color: var(--accent-strong);
}

.btn-icon {
    border: none;
    background: rgba(255, 255, 255, 0.7);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 112, 67, 0.22);
    transform: translateY(-2px);
}

.result-panel {
    position: relative;
    overflow: hidden;
}

.result-halo {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.32) 0%, transparent 60%),
        radial-gradient(circle at 80% 10%, rgba(255, 179, 128, 0.24) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
    animation: haloDrift 18s linear infinite;
}

.result-ripple-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.result-ripple {
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 112, 67, 0.3) 0%, rgba(255, 112, 67, 0) 70%);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
}

.result-card {
    position: relative;
    z-index: 2;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 112, 67, 0.18);
    padding: 26px;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 225, 0.55));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 18px 36px rgba(32, 33, 36, 0.08);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
}

.result-card.empty {
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-style: italic;
}

.result-card h3 {
    margin: 0;
    font-size: 1.7rem;
}

.match-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--accent-strong);
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.9rem;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.result-tag {
    background: rgba(255, 112, 67, 0.16);
    color: var(--accent-strong);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.result-actions {
    margin-top: auto;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.result-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.match-score {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--accent-strong);
}

.history {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item {
    list-style: none;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.55);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(32, 33, 36, 0.12);
}

.history-meta {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.tips {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tips ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.tips li {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(32, 33, 36, 0.05);
    border: 1px dashed rgba(255, 112, 67, 0.28);
    font-size: 0.92rem;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
}

.tips li::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 60%, rgba(255, 255, 255, 0.35) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tips li:hover::after {
    opacity: 1;
}

.journey-panel {
    margin-top: 36px;
    background: var(--journey-bg);
    border: 1px solid var(--journey-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.journey-header h2 {
    margin: 0 0 8px;
    font-size: 1.7rem;
}

.journey-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.journey-canvas {
    position: relative;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.55);
    overflow: hidden;
}

#journeySvg {
    width: 100%;
    height: 320px;
}

#journeySvg .journey-label {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    fill: rgba(32, 33, 36, 0.72);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#journeyNodes circle {
    filter: drop-shadow(0 4px 10px rgba(32, 33, 36, 0.18));
}

.journey-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-style: italic;
    letter-spacing: 0.02em;
}

.journey-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--muted);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.mood {
    background: #ff8a65;
}

.legend-dot.weather {
    background: #ffd54f;
}

.legend-dot.pantry {
    background: #6dd5c9;
}

.legend-dot.highlight {
    background: #8d6bef;
}

.mood-burst {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.05) 65%);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
    opacity: 0;
    animation: moodBurst 1.1s ease-out forwards;
}

.floating-dock {
    position: fixed;
    bottom: 32px;
    left: 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 28px;
    padding: 16px 14px;
    box-shadow: 0 20px 40px rgba(32, 33, 36, 0.18);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    z-index: 40;
}

.dock-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.6));
    box-shadow: 0 10px 22px rgba(32, 33, 36, 0.15);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.dock-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 16px 28px rgba(32, 33, 36, 0.2);
}

.floating-history {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 220px;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 22px;
    box-shadow: 0 18px 36px rgba(32, 33, 36, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(20px);
    overflow: hidden;
    z-index: 40;
}

.history-mini-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.btn-mini {
    border: none;
    background: rgba(255, 112, 67, 0.18);
    color: var(--accent-strong);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
}

.history-mini-body {
    max-height: 0;
    overflow: hidden;
    display: grid;
    gap: 8px;
    padding: 0 16px 0;
    transition: max-height 0.35s ease;
}

.history-mini-body.open {
    padding-bottom: 16px;
}

.mini-card {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 112, 67, 0.22);
    box-shadow: 0 8px 16px rgba(32, 33, 36, 0.12);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

.mini-title {
    font-weight: 600;
}

.mini-time {
    color: var(--muted);
    font-size: 0.75rem;
}

@keyframes heroBreath {
    from {
        box-shadow: var(--shadow-md), 0 0 90px rgba(255, 183, 77, 0.28);
    }
    to {
        box-shadow: var(--shadow-md), 0 0 140px rgba(109, 213, 201, 0.4);
    }
}

@keyframes haloDrift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(20px, -12px, 0) scale(1.06);
    }
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes rippleBurst {
    0% {
        opacity: 0.45;
        transform: translate(-50%, -50%) scale(0.35);
    }
    60% {
        opacity: 0.25;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.8);
    }
}

@keyframes moodBurst {
    0% {
        opacity: 0.85;
        transform: scale(0.35);
    }
    60% {
        opacity: 0.45;
        transform: scale(1.3);
    }
    100% {
        opacity: 0;
        transform: scale(2.1);
    }
}

@media (max-width: 1080px) {
    body {
        padding: 24px;
    }

    .hero {
        grid-template-columns: 1fr;
        padding: 32px;
    }

    .hero-radar {
        max-width: 360px;
        margin: 0 auto;
    }

    .control-layout {
        grid-template-columns: 1fr;
    }

    .floating-dock {
        bottom: 24px;
        left: 24px;
    }

    .floating-history {
        bottom: 24px;
        right: 24px;
    }
}

@media (max-width: 680px) {
    body {
        padding: 18px;
    }

    .hero {
        padding: 26px;
        gap: 24px;
    }

    .panel {
        padding: 24px;
    }

    .hero-actions {
        gap: 10px;
    }

    .hero-microcopy {
        grid-template-columns: 1fr;
    }

    .floating-dock {
        left: 16px;
        right: 16px;
        bottom: 16px;
        flex-direction: row;
        justify-content: center;
        padding: 12px;
        backdrop-filter: blur(14px);
    }

    .floating-history {
        right: 16px;
        left: 16px;
        bottom: 86px;
        width: auto;
    }
}
