:root {
    --ink: #1e2522;
    --muted: #60716a;
    --line: #d9e3de;
    --paper: #f8fbf7;
    --panel: #ffffff;
    --accent: #2f6f64;
    --accent-dark: #244f48;
    --green: #2f7d46;
    --red: #bc2f2c;
    --earth: #b98a2e;
    --metal: #d6d0bf;
    --water: #1f2024;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(248, 251, 247, 0.96), rgba(238, 246, 247, 0.94)),
        radial-gradient(circle at 18% 18%, rgba(188, 47, 44, 0.1), transparent 28%);
    color: var(--ink);
    font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei", serif;
}

button,
select,
input {
    font: inherit;
}

a {
    color: inherit;
}

.home-page {
    display: grid;
    place-items: center;
}

.home-shell,
.detail-shell {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 32px 18px 56px;
}

.hero-panel,
.notice-panel,
.plate-section,
.info-section,
.analysis-section {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 60px rgba(31, 51, 46, 0.12);
}

.hero-panel {
    max-width: 620px;
    margin: auto;
    padding: 42px 30px;
    text-align: center;
}

.brand-mark {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(32px, 6vw, 54px);
    line-height: 1.08;
}

h2 {
    font-size: 24px;
    line-height: 1.25;
}

.hero-panel p,
.subline {
    margin: 14px auto 0;
    color: var(--muted);
    line-height: 1.8;
}

.date-form {
    margin-top: 32px;
}

.select-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

label {
    display: grid;
    gap: 8px;
    text-align: left;
    color: var(--muted);
    font-size: 14px;
}

select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: var(--paper);
    color: var(--ink);
}

.primary-button {
    width: 100%;
    min-height: 50px;
    margin-top: 18px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-weight: 800;
    cursor: pointer;
}

.primary-button:hover,
.primary-button:focus-visible {
    background: var(--accent-dark);
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 700;
}

.detail-shell {
    display: grid;
    gap: 18px;
}

.plate-section,
.info-section,
.analysis-section,
.notice-panel {
    padding: 26px;
}

.page-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.plate-section {
    text-align: center;
}

.cross-plate {
    width: min(100%, 520px);
    aspect-ratio: 1 / 1;
    margin: 28px auto 6px;
    display: grid;
    grid-template-columns: 1fr 48px 1fr 48px 1fr;
    grid-template-rows: 1fr 42px 1fr 42px 1fr;
    align-items: center;
    justify-items: center;
}

.plate-cell {
    min-width: 96px;
    min-height: 96px;
    display: grid;
    place-items: center;
}

.plate-top {
    grid-column: 3;
    grid-row: 1;
}

.plate-left {
    grid-column: 1;
    grid-row: 3;
}

.plate-center {
    grid-column: 3;
    grid-row: 3;
}

.plate-right {
    grid-column: 5;
    grid-row: 3;
}

.plate-bottom {
    grid-column: 3;
    grid-row: 5;
}

.arrow {
    color: #171717;
    font-family: Arial, sans-serif;
    font-size: 34px;
    font-weight: 900;
    line-height: 1;
}

.arrow-top-to-center {
    grid-column: 3;
    grid-row: 2;
}

.arrow-left-to-center {
    grid-column: 2;
    grid-row: 3;
}

.arrow-center-to-right {
    grid-column: 4;
    grid-row: 3;
}

.arrow-center-to-bottom {
    grid-column: 3;
    grid-row: 4;
}

.element-node {
    position: relative;
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 12px 28px rgba(0, 0, 0, 0.16);
}

.element-text {
    font-size: 34px;
    font-weight: 900;
}

.element-木 {
    background: var(--green);
}

.element-火 {
    background: var(--red);
}

.element-土 {
    background: var(--earth);
}

.element-金 {
    background: var(--metal);
    color: #3b332b;
}

.element-水 {
    background: var(--water);
}

.badges {
    position: absolute;
    top: -8px;
    right: -12px;
    display: flex;
    gap: 4px;
}

.status-badge {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    font-family: Arial, sans-serif;
    font-weight: 900;
    line-height: 1;
}

.status-plus {
    color: #d3352f;
}

.status-minus {
    color: #238046;
}

.info-section,
.analysis-section {
    text-align: left;
}

.info-list {
    display: grid;
    gap: 2px;
    margin: 0;
}

.info-list div {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    min-height: 24px;
    line-height: 1.45;
}

dt {
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
}

dd {
    margin: 0;
    font-weight: 800;
    line-height: 1.45;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}

.tab-button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.tab-button.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.tab-panel {
    display: none;
    padding-top: 18px;
}

.tab-panel.active {
    display: block;
}

.analysis-content {
    min-height: 180px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.9;
    white-space: pre-wrap;
}

.analysis-heading {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 900;
}

.analysis-line {
    margin: 0 0 8px;
}

.analysis-line strong {
    font-weight: 900;
}

.analysis-spacer {
    height: 8px;
}

.analysis-content.loading {
    color: var(--muted);
}

.notice-panel {
    text-align: center;
}

@media (max-width: 680px) {
    .home-shell,
    .detail-shell {
        padding: 18px 12px 38px;
    }

    .hero-panel,
    .plate-section,
    .info-section,
    .analysis-section,
    .notice-panel {
        padding: 22px 16px;
    }

    .select-row,
    .tabs {
        grid-template-columns: 1fr;
    }


    .cross-plate {
        grid-template-columns: 1fr 30px 1fr 30px 1fr;
        grid-template-rows: 1fr 32px 1fr 32px 1fr;
    }

    .plate-cell {
        min-width: 74px;
        min-height: 74px;
    }

    .element-node {
        width: 70px;
        height: 70px;
    }

    .element-text {
        font-size: 26px;
    }

    .arrow {
        font-size: 26px;
    }

    .status-badge {
        width: 20px;
        height: 20px;
        font-size: 13px;
    }
}
