/* colors.css */
:root {
    --bg: #111210;
    --bg-soft: #1a1b18;
    --surface: #1a1b18;
    --surface-soft: #22231f;
    --panel-bg: rgba(26, 27, 24, 0.97);
    --result-bg: #1a1b18;
    --result-soft: #22231f;
    --surface-ink: #f1f0eb;
    --surface-muted: #a9aca5;
    --input-bg: #20211e;
    --input-border-width: 2px;
    --ink: #f1f0eb;
    --muted: #a9aca5;
    --muted-strong: #d9dbd4;
    --line: rgba(235, 237, 230, 0.17);
    --line-dark: #42443d;
    --result-line: #34362f;
    --brand: #b4382f;
    --brand-dark: #e06a60;
    --brand-hover: #bd4036;
    --button-ink: #fffaf6;
    --placeholder-ink: #aeb2aa;
    --focus-ring: #e06a60;
    --focus-ring-shadow: rgba(224, 106, 96, 0.28);
    --accent: #d85b50;
    --secondary: #56616a;
    --secondary-dark: #2f3338;
    --table-head-bg: #303133;
    --table-head-bg-strong: #242527;
    --indigo: var(--secondary);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    --panel-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    --radius: 14px;
    --page-bg:
        radial-gradient(circle at 82% 0%, rgba(180, 56, 47, 0.10), transparent 28rem),
        linear-gradient(180deg, #10110f 0%, var(--bg) 64%, #171815 100%);
    --grid-line-y: rgba(255, 255, 248, 0.045);
    --grid-line-x: rgba(255, 255, 248, 0.035);
    --grid-mask: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 78%);
    --nav-bg: rgba(17, 18, 16, 0.88);
    --nav-menu-bg: rgba(17, 18, 16, 0.98);
    --nav-shadow: 0 4px 16px rgba(12, 10, 8, 0.16);
    --nav-line: rgba(235, 228, 204, 0.18);
    --soft-control-bg: rgba(241, 240, 235, 0.06);
    --home-card-bg:
        rgba(241, 240, 235, 0.055);
    --home-card-bg-strong:
        linear-gradient(145deg, rgba(180, 56, 47, 0.18), rgba(241, 240, 235, 0.045)),
        rgba(27, 28, 25, 0.92);
    --home-card-bg-alt:
        linear-gradient(145deg, rgba(98, 112, 132, 0.24), rgba(242, 234, 217, 0.05)),
        rgba(39, 37, 34, 0.84);
    --home-card-hover:
        linear-gradient(145deg, rgba(242, 234, 217, 0.18), rgba(242, 234, 217, 0.07)),
        rgba(43, 41, 38, 0.94);

    --element-fire: #f87171;
    --element-fire-rgb: 185, 28, 28;
    --element-water: #60a5fa;
    --element-water-rgb: 29, 78, 216;
    --element-wood: #4ade80;
    --element-wood-rgb: 21, 128, 61;
    --element-earth: #d69a5f;
    --element-earth-rgb: 138, 79, 29;
    --element-metal: #facc15;
    --element-metal-rgb: 212, 160, 23;

    --number-odd: #f87171;
    --number-even: #60a5fa;
    --number-neutral: #a9aca5;

    --mark-danger: #f87171;
    --mark-danger-dark: #fca5a5;
    --mark-danger-rgb: 185, 28, 28;
    --mark-info: #60a5fa;
    --mark-info-bright: #93c5fd;
    --mark-success: #2dd4bf;
    --mark-success-bright: #5eead4;
    --mark-warning: #fbbf24;
    --mark-warning-bright: #fcd34d;
    --mark-muted: #a9aca5;
    --qimen-palace-color: #7fb2c4;
    --qimen-horse-color: #38bdf8;

    --name-accent: var(--brand);
    --name-accent-strong: var(--brand-dark);
    --name-accent-soft: rgba(224, 106, 96, 0.18);
    --name-accent-wash: rgba(180, 56, 47, 0.14);
    --name-ink: var(--surface-ink);
    --name-text: #c9cbc4;
    --name-muted: var(--surface-muted);
    --name-line: var(--result-line);
    --name-line-strong: var(--line-dark);
    --name-surface: var(--input-bg);
    --name-surface-soft: var(--result-soft);
    --name-radius: var(--radius);
    --name-radius-sm: var(--control-radius);
    --name-shadow-soft: none;
    --name-shadow-accent: 0 3px 8px rgba(180, 56, 47, 0.22);

    --xk-ink: var(--surface-ink);
    --xk-text: #c9cbc4;
    --xk-muted: var(--surface-muted);
    --xk-line: var(--result-line);
    --xk-line-strong: var(--line-dark);
    --xk-surface-soft: var(--result-soft);
    --xk-shadow-soft: none;
}

[data-theme="light"] {
    --bg: #f1f0ec;
    --bg-soft: #e7e7e1;
    --surface: #faf9f6;
    --surface-soft: #eeeee8;
    --panel-bg: rgba(250, 249, 246, 0.97);
    --result-bg: #faf9f6;
    --result-soft: #f1f0ec;
    --surface-ink: #20211e;
    --surface-muted: #64675f;
    --input-bg: #fdfcf9;
    --ink: #20211e;
    --muted: #64675f;
    --muted-strong: #363832;
    --line: rgba(32, 33, 30, 0.16);
    --line-dark: #d3d4ce;
    --result-line: #e4ded3;
    --brand: #b4382f;
    --brand-dark: #8f2923;
    --brand-hover: #bd4036;
    --button-ink: #fffaf6;
    --placeholder-ink: #60645c;
    --focus-ring: #a62f28;
    --focus-ring-shadow: rgba(166, 47, 40, 0.22);
    --accent: #a62f28;
    --secondary: #56616a;
    --secondary-dark: #303133;
    --table-head-bg: #303133;
    --table-head-bg-strong: #242527;
    --indigo: var(--secondary);
    --shadow: 0 6px 20px rgba(31, 33, 30, 0.05);
    --panel-shadow: 0 6px 20px rgba(20, 22, 19, 0.045);
    --page-bg:
        radial-gradient(circle at 86% 0%, rgba(180, 56, 47, 0.055), transparent 30rem),
        linear-gradient(180deg, #f8f7f3 0%, var(--bg) 68%, #e8e8e2 100%);
    --grid-line-y: rgba(69, 63, 55, 0.052);
    --grid-line-x: rgba(69, 63, 55, 0.042);
    --grid-mask: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 76%);
    --nav-bg: rgba(248, 247, 243, 0.90);
    --nav-menu-bg: rgba(248, 247, 243, 0.98);
    --nav-shadow: 0 4px 16px rgba(44, 39, 28, 0.06);
    --nav-line: rgba(59, 66, 52, 0.14);
    --soft-control-bg: rgba(36, 35, 31, 0.045);
    --home-card-bg:
        rgba(250, 249, 246, 0.72);
    --home-card-bg-strong:
        linear-gradient(145deg, rgba(180, 56, 47, 0.10), rgba(250, 249, 246, 0.86)),
        #faf9f6;
    --home-card-bg-alt:
        linear-gradient(145deg, rgba(98, 112, 132, 0.12), rgba(255, 255, 255, 0.86)),
        #ffffff;
    --home-card-hover:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 246, 0.86)),
        #ffffff;
    --element-fire: #b91c1c;
    --element-water: #1d4ed8;
    --element-wood: #15803d;
    --element-earth: #8a4f1d;
    --element-metal: #d4a017;
    --number-odd: #b91c1c;
    --number-even: #1e40af;
    --number-neutral: #64748b;
    --mark-danger: #b91c1c;
    --mark-danger-dark: #7f1d1d;
    --mark-info: #1e40af;
    --mark-info-bright: #3b82f6;
    --mark-success: #0d9488;
    --mark-success-bright: #10b981;
    --mark-warning: #b45309;
    --mark-warning-bright: #f59e0b;
    --mark-muted: #64748b;
    --qimen-palace-color: #315f6f;
    --qimen-horse-color: #0284c7;
    --name-accent-soft: #f3d8d4;
    --name-accent-wash: #fbf2f0;
    --name-text: #444840;
    --name-shadow-soft: none;
    --xk-text: #444840;
    --xk-shadow-soft: none;
}

/* base.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--surface-muted) 62%, transparent) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: var(--pill-radius);
    background: color-mix(in srgb, var(--surface-muted) 62%, transparent);
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--brand) 72%, transparent);
    background-clip: padding-box;
}

html {
    min-width: 320px;
}

body {
    min-height: 100vh;
    color: var(--ink);
    background: var(--page-bg);
    font-family: var(--site-font);
    font-size: var(--type-body);
    line-height: 1.55;
    overflow-x: auto;
    padding: 104px 24px 56px;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: linear-gradient(90deg, var(--grid-line-x) 1px, transparent 1px);
    background-size: 96px 96px;
    mask-image: var(--grid-mask);
}

a {
    color: inherit;
}

:where(a, summary):focus-visible {
    outline: none;
    text-decoration-color: var(--focus-ring);
    text-decoration-line: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
    border-radius: var(--control-radius);
    background: var(--surface);
    color: var(--surface-ink);
    padding: 10px 14px;
    text-decoration: none;
    transform: translateY(calc(-100% - 24px));
    transition: transform 0.16s ease;
}

.skip-link:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    transform: translateY(0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

input,
select {
    width: min(100%, 320px);
    min-height: 46px;
    border: 1px solid var(--line-dark);
    border-radius: var(--control-radius);
    background: var(--input-bg);
    color: var(--surface-ink);
    padding: 9px var(--space-compact);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px var(--focus-ring-shadow);
}

input::placeholder,
textarea::placeholder {
    color: var(--placeholder-ink);
    opacity: 1;
}

/* navigation.css */
header {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 9999;
    width: min(calc(100% - 32px), 1180px);
    min-height: 68px;
    padding: 10px 10px 10px 20px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    border: 1px solid var(--nav-line);
    border-radius: var(--radius);
    background: var(--nav-bg);
    box-shadow: var(--nav-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.logo {
    color: var(--ink);
    font-size: clamp(17px, 2vw, 21px);
    font-weight: 850;
    letter-spacing: -0.035em;
    text-decoration: none;
    white-space: nowrap;
}

.hamburger {
    display: none;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid var(--nav-line);
    border-radius: var(--radius);
    cursor: pointer;
    place-content: center;
    background: var(--soft-control-bg);
    box-shadow: none;
    color: var(--muted-strong);
    transform: translate3d(0, 0, 0);
    will-change: transform;
    transition: background 0.2s ease, border-color 0.2s ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hamburger:hover {
    border-color: color-mix(in srgb, var(--brand) 38%, var(--nav-line));
    background: rgba(180, 56, 47, 0.12);
    box-shadow: none;
    transform: translate3d(0, -2px, 0);
}

.hamburger:focus-visible,
.theme-toggle:focus-visible {
    border-color: color-mix(in srgb, var(--brand) 38%, var(--nav-line));
    background: rgba(180, 56, 47, 0.12);
    outline: none;
    box-shadow: none;
}

.hamburger:active {
    transform: translate3d(0, 0, 0) scale(0.98);
}

.theme-toggle {
    order: 3;
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--nav-line);
    border-radius: var(--radius);
    background: var(--soft-control-bg);
    color: var(--ink);
    padding: 0;
    box-shadow: none;
}

.theme-toggle:hover {
    background: rgba(180, 56, 47, 0.12);
    box-shadow: none;
}

.theme-toggle::before {
    content: "";
    width: 17px;
    height: 17px;
    border: 2px solid currentColor;
    border-radius: 999px;
    box-shadow: inset -6px -4px 0 currentColor;
}

[data-theme="light"] .theme-toggle::before {
    width: 18px;
    height: 18px;
    border-width: 2px;
    box-shadow:
        0 -8px 0 -6px currentColor,
        0 8px 0 -6px currentColor,
        8px 0 0 -6px currentColor,
        -8px 0 0 -6px currentColor,
        6px 6px 0 -6px currentColor,
        -6px -6px 0 -6px currentColor,
        6px -6px 0 -6px currentColor,
        -6px 6px 0 -6px currentColor;
}

.hamburger .line {
    display: block;
    width: 20px;
    height: 2px;
    margin: 3px auto;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
    will-change: transform, opacity;
    transition: opacity 220ms ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hamburger[aria-expanded="true"] .line:first-child {
    transform: translateY(5px) rotate(45deg);
}

.hamburger[aria-expanded="true"] .line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0.2);
}

.hamburger[aria-expanded="true"] .line:last-child {
    transform: translateY(-5px) rotate(-45deg);
}

.navbar ul {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
}

.navbar {
    order: 2;
    margin-left: auto;
}

.hamburger {
    order: 4;
}

.navbar ul li a {
    display: block;
    border-radius: var(--radius);
    color: var(--muted-strong);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 9px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar ul li a:hover,
.navbar ul li a:focus-visible {
    background: rgba(180, 56, 47, 0.12);
    color: #f08a80;
    transform: translate3d(0, -2px, 0);
}

.navbar ul li a.active {
    background: rgba(180, 56, 47, 0.12);
    color: #f08a80;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .hamburger,
    .hamburger .line,
    .navbar ul li a {
        transform: none !important;
        transition-duration: 0.01ms !important;
    }
}

[data-theme="light"] .navbar ul li a:hover,
[data-theme="light"] .navbar ul li a:focus-visible,
[data-theme="light"] .navbar ul li a.active {
    color: var(--brand-dark);
}

/* home.css */
.home-shell,
.page-shell {
    width: min(1160px, 100%);
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 0.78fr) minmax(400px, 1.22fr);
    gap: clamp(36px, 6vw, 88px);
    align-items: center;
    min-height: calc(100dvh - 152px);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 0 36px;
}

.eyebrow {
    width: fit-content;
    margin-bottom: 20px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.025em;
}

h1 {
    max-width: 9ch;
    color: var(--ink);
    font-size: var(--type-hero-title);
    font-weight: 850;
    letter-spacing: -0.075em;
    line-height: 1.03;
}

.hero-copy h1 {
    width: max-content;
    max-width: none;
    white-space: nowrap;
}

.hero-copy p,
.section-heading p {
    max-width: min(100%, 62ch);
    color: var(--muted);
    font-size: var(--type-body-large);
    margin-top: 24px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.primary-action,
.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: var(--radius);
    padding: 11px 18px;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.primary-action {
    background: var(--brand);
    color: var(--button-ink);
    box-shadow: var(--control-shadow);
}

.secondary-action {
    border: 1px solid var(--line);
    background: var(--soft-control-bg);
    color: var(--ink);
    font-weight: 500;
}

.primary-action:hover,
.secondary-action:hover {
    transform: translateY(-2px);
}

.primary-action:active,
.secondary-action:active {
    transform: translateY(1px);
}

.hero-visual {
    --landscape-ink: #a6aca1;
    --landscape-gold: #bba271;
    --landscape-copper: #be765b;
    --landscape-bronze: #79603b;
    --landscape-pearl: #f0dfb3;
    position: relative;
    min-width: 0;
    margin: 0;
    pointer-events: none;
}

[data-theme="light"] .hero-visual {
    --landscape-ink: #62685e;
    --landscape-gold: #b2945e;
    --landscape-copper: #bc7252;
    --landscape-bronze: #8a693c;
    --landscape-pearl: #f8edce;
}

.hero-landscape {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

@media (max-width: 920px) {
    .hero-landscape {
        max-width: 620px;
        margin: 0 auto;
    }
}

.home-name-story {
    display: grid;
    min-height: 460px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: 1fr auto;
    overflow: hidden;
    margin-top: clamp(72px, 10vw, 128px);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.home-name-heading {
    grid-column: 1 / 8;
    align-self: end;
    padding: clamp(52px, 7vw, 88px) clamp(24px, 5vw, 64px) 30px 0;
}

.home-name-heading > span {
    color: var(--accent);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.home-name-heading h2 {
    max-width: 8.5em;
    margin-top: 18px;
    color: var(--ink);
    font-size: clamp(44px, 6.3vw, 76px);
    font-weight: 900;
    letter-spacing: -0.075em;
    line-height: 1;
}

.home-name-heading h2 strong {
    color: var(--accent);
}

.home-name-content {
    display: grid;
    grid-column: 1 / 7;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 26px;
    padding: 0 clamp(24px, 5vw, 64px) clamp(48px, 6vw, 72px) 0;
}

.home-name-content p {
    max-width: 31em;
    color: var(--muted);
    font-size: var(--type-body-large);
}

.home-name-content a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    border-bottom: 1px solid var(--accent);
    color: var(--ink);
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.18s ease, transform 0.18s ease;
}

.home-name-content a:hover {
    color: var(--accent);
    transform: translateX(3px);
}

.home-name-composition {
    position: relative;
    display: grid;
    grid-column: 8 / -1;
    grid-row: 1 / 3;
    place-items: center;
    overflow: hidden;
    border-left: 1px solid var(--line);
    background:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px),
        rgba(180, 56, 47, 0.035);
    background-size: 25% 25%;
}

.home-name-composition::before {
    content: "";
    position: absolute;
    width: min(72%, 280px);
    aspect-ratio: 1;
    border: 1px solid rgba(180, 56, 47, 0.30);
    border-radius: 50%;
}

.name-composition-glyph {
    position: relative;
    color: var(--accent);
    font-size: clamp(120px, 16vw, 190px);
    font-weight: 900;
    line-height: 1;
}

.name-composition-axis {
    position: absolute;
    right: 24px;
    bottom: 22px;
    left: 24px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.tool-catalog {
    scroll-margin-top: 110px;
    margin-top: clamp(72px, 10vw, 128px);
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

.section-heading {
    max-width: 720px;
    margin-bottom: 34px;
}

.section-heading h2 {
    color: var(--ink);
    font-size: var(--type-display-section);
    letter-spacing: -0.055em;
    line-height: 1.04;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 10px;
}

.tool-card {
    position: relative;
    display: grid;
    align-content: start;
    min-height: 184px;
    grid-column: span 2;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--home-card-bg);
    color: var(--ink);
    padding: 24px;
    text-decoration: none;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
    will-change: transform;
    transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tool-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(145deg, rgba(180, 56, 47, 0.15), rgba(86, 97, 106, 0.08)),
        var(--home-card-bg-strong);
    opacity: 0;
    will-change: opacity;
    transition: opacity 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-card::after {
    content: "";
    position: absolute;
    inset: -45% -28%;
    z-index: 0;
    background: linear-gradient(120deg, transparent 38%, rgba(255, 250, 246, 0.22) 49%, transparent 60%);
    opacity: 0;
    transform: translate3d(-34%, 0, 0) rotate(7deg);
    will-change: transform, opacity;
    transition: transform 680ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease;
}

.tool-card:hover,
.tool-card:focus-visible {
    border-color: rgba(180, 56, 47, 0.50);
    box-shadow: 0 4px 12px rgba(17, 18, 16, 0.07);
    transform: translate3d(0, -4px, 0);
}

.tool-card:hover::before,
.tool-card:focus-visible::before {
    opacity: 1;
}

.tool-card:hover::after,
.tool-card:focus-visible::after {
    opacity: 1;
    transform: translate3d(34%, 0, 0) rotate(7deg);
}

.tool-card:active {
    transform: translate3d(0, -3px, 0);
}

.tool-card h2,
.tool-card p {
    position: relative;
    z-index: 1;
    transform: translate3d(0, 0, 0);
    transition: color 220ms ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1), opacity 320ms ease;
}

.tool-card h2 {
    margin-top: 22px;
    color: var(--ink);
    font-size: var(--type-result-title);
    line-height: 1.2;
}

.tool-card:hover h2,
.tool-card:focus-visible h2 {
    transform: translate3d(0, -3px, 0);
}

.tool-card p {
    color: var(--muted);
    font-size: var(--type-body-small);
    margin-top: 10px;
    max-width: 30ch;
    opacity: 1;
}

.tool-card:hover p,
.tool-card:focus-visible p {
    color: var(--muted-strong);
    opacity: 1;
    transform: translate3d(0, -1px, 0);
}

.site-footer {
    display: flex;
    width: min(1160px, 100%);
    margin: 48px auto 0;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 14px;
}

.site-footer a {
    color: var(--ink);
    font-weight: 850;
    text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
    html:has(.home-shell) {
        scroll-behavior: smooth;
    }

    .hero-copy,
    .hero-visual,
    .home-name-story {
        animation: home-enter 0.72s cubic-bezier(.16, 1, .3, 1) both;
    }

    .hero-visual {
        animation-delay: 0.08s;
    }

    .home-name-story {
        animation-delay: 0.12s;
    }

    @keyframes home-enter {
        from { opacity: 0; transform: translate3d(0, 28px, 0); }
        to { opacity: 1; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .primary-action,
    .secondary-action,
    .tool-card,
    .tool-card::before,
    .tool-card::after,
    .tool-card h2,
    .tool-card p,
    .hero-visual,
    .home-name-story,
    .home-name-content a {
        transition: none;
        animation: none;
        transform: none !important;
    }
}

@media (max-width: 720px) {
    .home-name-story {
        min-height: 0;
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        padding: 0;
    }

    .home-name-heading,
    .home-name-content,
    .home-name-composition {
        grid-column: 1;
        grid-row: auto;
    }

    .home-name-heading {
        padding: 42px 0 22px;
    }

    .home-name-heading h2 {
        font-size: clamp(40px, 12vw, 56px);
    }

    .home-name-content {
        grid-template-columns: 1fr;
        align-items: start;
        padding: 0 0 38px;
    }

    .home-name-content a {
        width: fit-content;
    }

    .home-name-composition {
        min-height: 270px;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .name-composition-glyph {
        font-size: 120px;
    }
}

/* responsive.css */
@media (max-width: 1320px) {
    .qimen-result-layout {
        grid-template-columns: 1fr;
        justify-items: center;
        width: 100%;
    }

    .qimen-main-column {
        justify-items: center;
        width: 100%;
    }

    .qimen-board-card {
        justify-self: center;
        width: 100%;
        padding: 20px;
    }

    .qimen-container {
        width: fit-content;
        max-width: 100%;
        margin-inline: auto;
    }

    .qimen-reference-card {
        position: static;
        top: auto;
        justify-self: center;
        width: 100%;
        padding: 20px;
    }

    .qimen-empty-note,
    .qimen-reference-card .text-box-container {
        padding: 12px;
        font-size: 13.5px;
    }
}

@media (max-width: 1120px) {
    .liu-ren-layout {
        grid-template-columns: 1fr;
    }

    .liu-ren-combined-card {
        width: 100%;
        max-width: 328px;
    }

    .liu-ren-reference-card {
        width: 100%;
        max-width: 100%;
    }

    .liu-ren-reference-card {
        position: static;
    }
}

@media (max-width: 1024px) {
    .theme-toggle {
        margin-left: auto;
    }

    .hamburger {
        display: grid;
    }

    .navbar {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        width: 100%;
        margin-left: 0;
        max-height: 0;
        overflow: hidden;
        border: 1px solid transparent;
        border-radius: var(--radius);
        background: var(--nav-menu-bg);
        opacity: 0;
        transform: translate3d(0, 14px, 0);
        will-change: max-height, transform, opacity;
        transition:
            max-height 520ms cubic-bezier(0.16, 1, 0.3, 1),
            border-color 0.2s ease,
            opacity 320ms ease,
            transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
    }

    .navbar.active {
        max-height: min(680px, calc(100dvh - 112px));
        overflow-y: auto;
        border-color: var(--nav-line);
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }

    .navbar ul {
        display: grid;
        gap: 4px;
        padding: 12px;
        opacity: 0;
        transform: translate3d(0, 8px, 0);
        will-change: transform, opacity;
        transition: opacity 360ms ease, transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
    }

    .navbar.active ul {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }

    .navbar ul li a {
        padding: 12px;
    }

    .navbar > ul {
        gap: 16px;
    }

    .navbar .navigation-group h2 {
        padding: 4px 12px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
    }

    .navbar .navigation-group ul {
        gap: 2px;
        padding: 0;
    }

    @media (prefers-reduced-motion: reduce) {
        .navbar,
        .navbar ul {
            opacity: 1;
            transform: none !important;
            transition-duration: 0.01ms !important;
        }
    }

}

@media (max-width: 920px) {
    body {
        padding: 92px 16px 32px;
    }

    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
        gap: 24px;
    }

    .hero-copy {
        min-height: 44vh;
        padding: 20px 0 0;
    }

    .hero-visual {
        transform: none;
    }

    .hero-visual img {
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 10;
    }

    .tool-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tool-card,
    .tool-card:nth-child(2),
    .tool-card:nth-child(4),
    .tool-card:nth-child(5) {
        grid-column: span 1;
    }

    .qimen-result-layout {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        justify-content: stretch;
    }

    .qimen-result,
    .qimen-summary,
    .qimen-main-column,
    .qimen-board-card,
    .qimen-reference-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin-left: 0;
        display: block;
        flex: none;
        margin-bottom: 20px;
    }

    .qimen-summary {
        display: grid;
    }

    .qimen-reference-card {
        position: static;
        top: auto;
        width: 100%;
        margin-inline: auto;
    }

    .qimen-board-card {
        width: 100%;
        margin-inline: auto;
    }

    .qimen-container {
        width: fit-content;
        max-width: 100%;
        margin-inline: auto;
    }

    .qimen-container,
    .name-analysis-container {
        flex-direction: column;
    }

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

    .liu-ren-reference-card {
        position: static;
    }

    .liu-ren-four-ke-section,
    .liu-ren-three-transmission-section,
    .liu-ren-plate-section {
        width: 100%;
    }

    #liu-ren-form {
        grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    }

    #qimen-form {
        grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    }

    #liu-ren-form .field:nth-of-type(3) {
        grid-column: 1;
    }

    #liu-ren-form .field:nth-of-type(4) {
        grid-column: 2;
    }

    #liu-ren-form button[type="submit"] {
        grid-column: 3;
    }

    #qimen-form .field:nth-of-type(1) {
        grid-column: 1;
    }

    #qimen-form .field:nth-of-type(2) {
        grid-column: 2;
    }

    #qimen-form .field:nth-of-type(3) {
        grid-column: 1;
    }

    #qimen-form .field:nth-of-type(4) {
        grid-column: 2;
    }

    #qimen-form button[type="submit"] {
        grid-column: 3;
    }

    .qimen-text-box-container,
    .name-table-container,
    .text-box-container {
        max-width: 100%;
    }
}

@media (max-width: 700px) {
    .bazi-page .control-row[data-bazi-controls="birth"]:not([hidden]) {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bazi-page .control-row[data-bazi-controls="birth"] button {
        padding-right: 8px;
        padding-left: 8px;
        font-size: 14px;
        white-space: nowrap;
    }

    .bazi-page .control-row[data-bazi-controls="birth"] button[type="submit"] {
        grid-column: 1 / -1;
        grid-row: 1;
        font-size: 16px;
    }

    .liu-ren-three-transmission-section .liu-ren-table th,
    .liu-ren-four-ke-section .liu-ren-table th {
        width: 52px;
        padding-right: 5px;
        padding-left: 5px;
        white-space: nowrap;
    }

    header {
        top: 10px;
        width: min(calc(100% - 20px), 1180px);
        padding: 8px 10px 8px 14px;
    }

    .logo {
        max-width: calc(100vw - 152px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hero-copy {
        min-height: 0;
        padding-top: 26px;
    }

    .tool-intro {
        grid-template-columns: 1fr;
        margin-bottom: 12px;
        padding: 10px 0 6px;
    }

    .tool-intro p {
        margin-top: 10px;
    }

    .tool-intro h1 {
        font-size: var(--type-page-title-mobile);
    }

    .hero-copy h1 {
        font-size: clamp(36px, 12vw, 52px);
    }

    .hero-copy p,
    .tool-intro p,
    .section-heading p {
        font-size: var(--type-body);
    }

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

    .primary-action,
    .secondary-action {
        width: 100%;
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        min-height: 156px;
        grid-column: span 1;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .tool-card-panel,
    .output-panel,
    .container,
    .time-range-form {
        padding: 18px;
    }

    .form-grid,
    .field,
    .field input,
    .field select {
        min-width: 0;
    }

    .field input[type="date"],
    .field input[type="time"] {
        overflow: hidden;
        padding-right: 10px;
        padding-left: 10px;
        font-size: 16px;
        text-align: left;
        text-overflow: ellipsis;
    }

    .field input[type="date"]::-webkit-date-and-time-value,
    .field input[type="time"]::-webkit-date-and-time-value {
        min-width: 0;
        text-align: left;
    }

    .field input[type="date"]::-webkit-calendar-picker-indicator,
    .field input[type="time"]::-webkit-calendar-picker-indicator {
        flex: 0 0 auto;
        margin-left: 2px;
    }

    .control-row {
        align-items: stretch;
    }

    .time-range-form .control-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }

    .time-range-form .control-row button {
        width: auto;
        min-width: 58px;
        padding-right: 12px;
        padding-left: 12px;
        white-space: nowrap;
    }

    #liu-ren-form {
        grid-template-columns: 1fr;
    }

    #qimen-form {
        grid-template-columns: 1fr;
    }

    #liu-ren-form .field:nth-of-type(3),
    #liu-ren-form .field:nth-of-type(4),
    #liu-ren-form button[type="submit"],
    #qimen-form .field:nth-of-type(1),
    #qimen-form .field:nth-of-type(2),
    #qimen-form .field:nth-of-type(3),
    #qimen-form .field:nth-of-type(4),
    #qimen-form button[type="submit"] {
        grid-column: auto;
    }

    .control-row button {
        flex: 1 1 180px;
    }

    .ten-gods-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
        align-items: end;
    }

    .ten-gods-controls button {
        width: 100%;
        height: 46px;
        min-height: 46px;
        padding: 9px 12px;
        align-self: end;
    }

    .qimen-time-controls {
        display: grid;
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr) minmax(0, 0.9fr);
        gap: 10px;
    }

    .qimen-time-controls button {
        width: 100%;
        min-width: 0;
        height: 46px;
        min-height: 46px;
        padding: 6px;
        font-size: clamp(12px, 3.5vw, 14px);
        line-height: 1.18;
        white-space: nowrap;
    }

    .input-group,
    .born-year-input-group {
        grid-template-columns: 1fr;
    }

    .phone-number-form-grid {
        grid-template-columns: 1fr;
    }

    .phone-number-form-grid .input-group {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .phone-number-form-grid .born-year-input-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .phone-number-form-grid .born-year-input-group button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .phone-number-form-grid button {
        min-width: 58px;
        padding-right: 12px;
        padding-left: 12px;
        white-space: nowrap;
    }

    .born-year-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .born-year-result-grid {
        grid-template-columns: 1fr;
    }

    .custom-table,
    .calendar-table {
        font-size: 12px;
    }

    .custom-table th,
    .custom-table td,
    .calendar-table th,
    .calendar-table td {
        padding: 7px;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .energy-text {
        font-size: 11px;
        line-height: 1.4;
        white-space: normal;
    }

    .phone-analysis-section {
        overflow: visible;
    }

    .phone-analysis-section.container {
        border: 0;
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    .phone-analysis-section #combinedTableContainer {
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .combined-phone-table {
        width: max(100%, 640px);
        min-width: 640px;
        table-layout: fixed;
    }

    .combined-phone-table .row-label-col,
    .combined-phone-table th:first-child {
        width: 76px;
        min-width: 76px;
    }

    .combined-phone-table th,
    .combined-phone-table td {
        height: 54px;
        padding: 8px 6px;
        line-height: 1.22;
        overflow-wrap: normal;
    }

    .combined-phone-table th:first-child {
        font-size: 12px;
        line-height: 1.2;
    }

    .combined-phone-row-palace td {
        padding-right: 4px;
        padding-left: 4px;
        font-size: 12px;
        line-height: 1.2;
        white-space: nowrap;
    }

    .combined-phone-row-number td {
        font-size: 18px;
    }

    .combined-phone-row-element td {
        height: 54px;
        padding-top: 4px;
        padding-bottom: 4px;
        white-space: normal;
    }

    .element-mark {
        font-size: 14px;
    }

    .eight-house-stack {
        gap: 2px;
        min-height: 36px;
    }

    .qimen-slot {
        min-height: 54px;
    }

    .qimen-slot-label,
    .qimen-element,
    .eight-house-energy {
        font-size: 11px;
        line-height: 1.15;
        white-space: nowrap;
    }

    .qimen-symbol,
    .eight-house-name {
        font-size: 12px;
        line-height: 1.15;
        white-space: nowrap;
    }

    .qimen-symbol {
        white-space: normal;
    }

    .analysis-item {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .phone-tips-section .analysis-item {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 5px 0;
    }

    .born-year-reference-list .analysis-item {
        grid-template-columns: auto 1fr;
        gap: 8px;
    }

    .palace-analysis-item {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
    }

    .palace-analysis-header,
    .palace-analysis-cell {
        border-bottom: 0;
    }

    .palace-analysis-cell {
        border-left: 0;
        padding-left: 0;
    }

    .palace-analysis-warnings {
        grid-column: 1;
        margin-top: 0;
    }

    .palace-analysis-header strong {
        flex-wrap: wrap;
        font-size: 15px;
        line-height: 1.35;
        white-space: normal;
    }

    .palace-analysis-digit {
        min-width: 23px;
        height: 23px;
        font-size: 13.5px;
    }

    .qimen-analysis-symbol {
        min-width: 0;
        width: auto;
        height: auto;
        min-height: 23px;
        padding: 4px 8px;
    }

    .palace-analysis-cell > span,
    .palace-analysis-warning span {
        font-size: 11.5px;
        line-height: 1.35;
    }

    .palace-analysis-cell p {
        font-size: var(--type-reading-body);
        font-weight: var(--type-reading-weight);
        line-height: var(--type-reading-line-height);
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .palace-analysis-warning p {
        font-size: 14px;
        font-weight: 600;
        line-height: 1.6;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .phone-tips-section {
        padding: 14px;
    }

    .phone-tips-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
        gap: 10px;
        min-width: 0;
    }

    .phone-tips-tabs {
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .phone-tips-section h3 {
        font-size: 17px;
    }

    .phone-tips-tabs {
        gap: 4px;
    }

    .phone-tips-tab {
        min-height: 34px;
        padding: 7px 10px;
        font-size: inherit;
    }

    .qimen-palace-diagram {
        grid-template-columns: 21.739% 53.623% 24.638%;
        grid-template-rows: repeat(3, 1fr);
        width: 100%;
    }

    .qimen-phone-palace-diagram {
        grid-template-columns: 28% 44% 28%;
        width: min(138px, 100%);
        max-width: 138px;
        aspect-ratio: 1;
    }

    .qimen-palace-cell {
        font-size: 11px;
    }

    .qimen-palace-main {
        font-size: 12px;
    }

    .qimen-element-summary {
        width: 100%;
    }

    .qimen-element-summary-row {
        grid-template-columns: 21.739% 53.623% 24.638%;
    }

    .qimen-element-summary-label,
    .qimen-element-summary-symbol,
    .qimen-element-summary-row strong {
        padding: 0 5px;
        font-size: 11px;
    }

    .qimen-element-summary-label {
        font-size: 10px;
    }

    .qimen-annual-branch-summary {
        width: 100%;
    }

    .qimen-annual-branch-row {
        grid-template-columns: 31.884% 1fr;
    }

    .qimen-annual-branch-row span,
    .qimen-annual-branch-row strong {
        padding: 0 5px;
        font-size: 11px;
    }

    .qimen-annual-branch-row span {
        font-size: 10px;
    }

    .qimen-knowledge-title {
        padding: 9px 10px;
        font-size: 13px;
    }

    .qimen-knowledge-body {
        gap: 10px;
        padding: 10px;
    }

    .qimen-knowledge-body p,
    .qimen-knowledge-body li,
    .qimen-knowledge-table {
        font-size: var(--type-reading-body);
    }

    .qimen-knowledge-table th,
    .qimen-knowledge-table td {
        padding: 6px;
    }

}

@media (max-width: 340px) {
    .qimen-time-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .qimen-time-controls button[type="submit"] {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}

@media (max-width: 430px) {
    .qimen-single-palace-scale {
        overflow: visible;
    }

    .qimen-single-palace-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .qimen-palace-fit {
        width: min(138px, 100%);
        overflow: visible;
    }

    .tool-card-panel,
    .output-panel,
    .container,
    .time-range-form {
        padding: 14px;
    }

    .field input[type="date"],
    .field input[type="time"] {
        padding-right: 8px;
        padding-left: 8px;
    }

    .phone-analysis-section #combinedTableContainer {
        margin-right: -6px;
        margin-left: -6px;
    }

    .combined-phone-table {
        width: max(100%, 620px);
        min-width: 620px;
    }

    .combined-phone-table .row-label-col,
    .combined-phone-table th:first-child {
        width: 70px;
        min-width: 70px;
    }

    .combined-phone-table th,
    .combined-phone-table td {
        height: 50px;
        padding: 7px 5px;
    }

    .combined-phone-table th:first-child {
        font-size: 12px;
    }

    .combined-phone-row-palace td {
        font-size: 11.5px;
    }

    .combined-phone-row-number td {
        font-size: 17px;
    }

    .phone-analysis-subsection {
        padding: 12px;
    }

    .analysis-item {
        padding: 8px;
    }

    .phone-tips-section .analysis-item {
        padding: 5px 0;
    }

    .palace-analysis-header strong {
        font-size: 14.5px;
    }

    .palace-analysis-digit {
        min-width: 22px;
        height: 22px;
        font-size: 13px;
    }

    .qimen-analysis-symbol {
        min-width: 0;
        width: auto;
        height: auto;
        min-height: 22px;
        padding: 4px 7px;
    }

    .palace-analysis-cell p {
        font-size: var(--type-reading-body);
        line-height: var(--type-reading-line-height);
    }

    .palace-analysis-warning p {
        font-size: 14px;
        line-height: 1.6;
    }

    .phone-tips-header {
        gap: 8px;
    }

    .phone-tips-section h3 {
        font-size: 16px;
    }

    .phone-tips-tab {
        min-height: 34px;
        padding: 7px 10px;
        font-size: inherit;
    }

    .qimen-time-controls {
        gap: 6px;
    }

    .qimen-time-controls button {
        height: 46px;
        min-height: 46px;
        padding: 5px 4px;
        font-size: clamp(10.5px, 3.2vw, 13px);
        line-height: 1.15;
        white-space: nowrap;
    }

}

@media (min-width: 701px) and (max-width: 900px) {
    .palace-analysis-item {
        grid-template-columns: minmax(90px, max-content) minmax(0, 1fr);
        gap: 12px 14px;
    }

    .palace-analysis-header {
        grid-row: 1 / span 2;
    }

    .palace-analysis-cell {
        border-left: 1px solid var(--result-line);
        padding-left: 14px;
    }

    .palace-analysis-warnings {
        grid-column: 1 / -1;
    }

    .combined-phone-row-element td {
        height: 54px;
        padding-top: 4px;
        padding-bottom: 4px;
        white-space: normal;
    }
}

/* 超窄屏必須讓整個奇門盤縮入卡片，避免橫向捲動起點造成視覺偏右。 */
@media (max-width: 600px) {
    .qimen-table {
        position: relative;
        overflow: visible;
    }

    .qimen-table td:first-child,
    .qimen-table td:last-child {
        width: 18px;
        min-width: 18px;
        max-width: 18px;
        overflow: visible;
        text-overflow: clip;
    }
}

@media (max-width: 380px) {
    .qimen-board-card {
        padding-right: 4px;
        padding-left: 4px;
    }

    .qimen-container {
        margin-right: auto;
        margin-left: auto;
    }

    .qimen-container.qimen-life-palace-mode {
        padding-right: 12px;
        padding-left: 12px;
    }

    .qimen-table td,
    .qimen-table .td,
    .qimen-table .small-text,
    .qimen-table .kong-text,
    .qimen-table .horse-text,
    .qimen-table .yin-text,
    .qimen-table .remarks {
        font-size: 10.5px;
    }

    .qimen-table td,
    .qimen-table .td {
        min-width: 11px;
        padding-right: 0;
        padding-left: 0;
    }

    .qimen-table td:nth-child(3),
    .qimen-table td:nth-child(7),
    .qimen-table td:nth-child(11) {
        min-width: 26px;
        text-indent: 0;
    }

    .qimen-table td:nth-child(4),
    .qimen-table td:nth-child(5),
    .qimen-table td:nth-child(8),
    .qimen-table td:nth-child(9),
    .qimen-table td:nth-child(12),
    .qimen-table td:nth-child(13) {
        min-width: 7px;
    }
}

/* typography.css */
:root {
    --site-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    --mono-font: var(--site-font);
    --type-weight-regular: 400;
    --type-weight-medium: 500;
    --type-weight-label: 700;
    --type-weight-heading: 800;
    --type-line-height: 1.55;
    --type-title-line-height: 1.2;
    --type-hero-title: clamp(48px, 7vw, 84px);
    --type-page-title: clamp(48px, 4vw, 52px);
    --type-page-title-mobile: clamp(36px, 10vw, 40px);
    --type-display-section: clamp(32px, 5vw, 52px);
    --type-result-title: 24px;
    --type-card-title: 20px;
    --type-subsection-title: 18px;
    --type-section-title: 16px;
    --type-body: 16px;
    --type-body-large: 17px;
    --type-body-small: 14px;
    --type-reading-body: 15px;
    --type-reading-weight: 400;
    --type-reading-line-height: 1.7;
    --reading-ink: var(--surface-muted);
    --type-label: 13px;
    --type-meta: 12.5px;
    --space-field-gap: 14px;
    --space-card-gap: 18px;
    --space-section-gap: 22px;
    --space-panel: clamp(22px, 3vw, 34px);
    --space-card: 18px;
    --space-compact: 12px;
    --control-height: 42px;
    --control-radius: 10px;
    --data-radius: 8px;
    --pill-radius: 999px;
    --control-padding-x: 16px;
    --control-bg: var(--brand);
    --control-bg-hover: var(--brand-hover);
    --control-text: var(--button-ink);
    --control-shadow: 0 3px 8px rgba(137, 35, 29, 0.10);
    --control-shadow-hover: 0 4px 12px rgba(137, 35, 29, 0.14);
    --control-soft-bg: var(--soft-control-bg);
    --control-soft-hover-bg: rgba(180, 56, 47, 0.12);
    --control-soft-border: var(--line-dark);
    --control-card-bg: var(--home-card-bg);
    --control-card-bg-hover:
        linear-gradient(145deg, rgba(180, 56, 47, 0.14), rgba(86, 97, 106, 0.08)),
        var(--home-card-bg-strong);
}

html,
body {
    font-family: var(--site-font);
    font-synthesis: none;
    line-height: var(--type-line-height);
}

body,
button,
input,
select,
textarea,
table {
    font-family: var(--site-font);
}

:where(
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p,
    a,
    label,
    span,
    strong,
    small,
    li,
    td,
    th,
    div,
    section,
    article,
    nav,
    header,
    footer,
    main
):not(.fa):not([class^="fa-"]):not([class*=" fa-"]) {
    font-family: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: var(--type-title-line-height);
}

h1 {
    font-weight: var(--type-weight-heading);
}

h2 {
    font-size: var(--type-result-title);
    font-weight: var(--type-weight-heading);
}

h3 {
    font-size: var(--type-subsection-title);
    font-weight: var(--type-weight-heading);
}

h4 {
    font-size: var(--type-section-title);
    font-weight: var(--type-weight-heading);
}

h5,
h6 {
    font-size: var(--type-body-small);
    font-weight: var(--type-weight-heading);
}

.result-card-heading {
    display: grid;
    gap: 5px;
    justify-items: start;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line-dark);
    padding-bottom: 13px;
}

.result-card-heading > span {
    color: var(--surface-muted);
    font-size: var(--type-label);
    font-weight: var(--type-weight-label);
    line-height: 1.25;
}

.result-card-heading > h2 {
    margin: 0;
    color: var(--surface-ink);
    font-size: var(--type-card-title);
    font-weight: var(--type-weight-heading);
    line-height: 1.25;
}

button:not(.theme-toggle):not(.hamburger),
button.name-info-tab-button,
button.palace-jump-button,
button.phone-tips-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    border-radius: var(--control-radius);
    font-family: var(--site-font);
    font-size: 16px;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition:
        transform 0.16s ease,
        background 0.16s ease,
        background-color 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease;
}

button:not(.theme-toggle):not(.hamburger) {
    border: 0;
    background: var(--control-bg);
    color: var(--control-text);
    font-weight: 750;
    padding: 10px var(--control-padding-x);
    box-shadow: var(--control-shadow);
}

button:not(.theme-toggle):not(.hamburger):hover,
button:not(.theme-toggle):not(.hamburger):focus-visible {
    background: var(--control-bg-hover);
    color: var(--control-text);
    transform: translateY(-1px);
    box-shadow: var(--control-shadow-hover);
    outline: none;
}

button:not(.theme-toggle):not(.hamburger):active {
    transform: translateY(1px);
}

button:not(.theme-toggle):not(.hamburger):disabled {
    background: var(--result-line);
    color: var(--button-ink);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.name-info-tab-list,
.palace-button-list,
.phone-tips-tabs {
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 5px 0 4px;
}

button.name-info-tab-button,
button.palace-jump-button,
button.phone-tips-tab {
    position: relative;
    min-height: 46px;
    border: 1px solid var(--line);
    background: var(--control-card-bg);
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    box-shadow: none;
    overflow: hidden;
    white-space: nowrap;
}

button.name-info-tab-button:hover,
button.name-info-tab-button:focus-visible,
button.palace-jump-button:hover,
button.palace-jump-button:focus-visible,
button.phone-tips-tab:hover,
button.phone-tips-tab:focus-visible {
    border-color: rgba(214, 168, 111, 0.58);
    background: var(--control-card-bg-hover);
    color: var(--ink);
    transform: translateY(-3px);
    box-shadow: none;
    outline: none;
}

button.name-info-tab-button.is-active,
button.palace-jump-button.is-active,
button.phone-tips-tab.active {
    border-color: rgba(214, 168, 111, 0.72);
    background: var(--control-card-bg-hover);
    color: var(--ink);
    box-shadow: none;
}

button.name-info-tab-button:active,
button.palace-jump-button:active,
button.phone-tips-tab:active {
    transform: translateY(1px);
}

input,
select,
textarea {
    font-family: var(--site-font);
    font-size: 16px;
    line-height: var(--type-line-height);
}

/* theme-unification.css */
/* Shared result surfaces and input control presentation. */

:is(
  .tool-card-panel,
  .output-panel,
  .container,
  .time-range-form,
  .liu-ren-card,
  .liu-ren-summary,
  .phone-analysis-section,
  .life-number-output,
  .life-number-reference,
  .info-card,
  .name-chart-wrapper,
  .name-chart-info-panel,
  .five-element-section,
  .xuan-kong-card
) {
  font-family: var(--site-font);
  color: var(--surface-ink);
  border-color: var(--result-line);
  background-color: var(--result-bg);
  box-shadow: var(--panel-shadow);
}

.output-panel :is(.liu-ren-card, .liu-ren-summary, .info-card, .name-chart-wrapper, .name-chart-info-panel, .five-element-section, .xuan-kong-card) {
  box-shadow: none;
}

button.secondary-control,
.control-row button.secondary-control,
button.secondary-control:not(.theme-toggle):not(.hamburger) {
  font-weight: 500;
  border: 1px solid var(--line-dark);
  background: transparent;
  color: var(--surface-ink);
  box-shadow: none;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

button.secondary-control:hover,
.control-row button.secondary-control:hover,
button.secondary-control:not(.theme-toggle):not(.hamburger):is(:hover, :focus-visible) {
  border-color: var(--brand);
  background: rgba(180, 56, 47, 0.08);
  color: var(--brand-dark);
  box-shadow: none;
  transform: translate3d(0, -2px, 0);
}

.tool-input-panel .tool-input-form > button:not(.theme-toggle):not(.hamburger),
.tool-input-panel .tool-input-form > .generator-action-row button:not(.theme-toggle):not(.hamburger),
.tool-input-panel .tool-input-form > .name-form-action button:not(.theme-toggle):not(.hamburger),
.one-sec-controls.tool-input-panel > button:not(.theme-toggle):not(.hamburger) {
  min-height: 46px;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-input-panel .tool-input-form > button:not(.theme-toggle):not(.hamburger):is(:hover, :focus-visible),
.tool-input-panel .tool-input-form > .generator-action-row button:not(.theme-toggle):not(.hamburger):is(:hover, :focus-visible),
.tool-input-panel .tool-input-form > .name-form-action button:not(.theme-toggle):not(.hamburger):is(:hover, :focus-visible),
.one-sec-controls.tool-input-panel > button:not(.theme-toggle):not(.hamburger):is(:hover, :focus-visible) {
  transform: translate3d(0, -2px, 0);
}

:is(
  .result-card-heading,
  .info-part-header,
  .life-number-reference-header,
  .liu-ren-card-header,
  .xuan-kong-card-header,
  .interpret-header
) {
  border-color: var(--result-line);
}

:is(
  .result-card-heading h2,
  .info-part-title,
  .life-number-output h2,
  .life-number-reference h2,
  .liu-ren-card h2,
  .xuan-kong-card h2,
  .info-card h2,
  .info-card h3,
  .info-card h4
) {
  color: var(--surface-ink);
  font-family: var(--site-font);
}

:is(
  .result-card-heading > span,
  .section-desc,
  .info-subtitle,
  .life-number-meta-notes,
  .qimen-slot-label,
  .qimen-element,
  .liu-ren-summary-item span
) {
  color: var(--surface-muted);
}

:is(
  .qimen-table,
  .liu-ren-table,
  .custom-table,
  .combined-phone-table,
  .life-number-grid,
  .name-chart-grid,
  .xuan-kong-grid
) {
  color: var(--surface-ink);
  background: var(--result-bg);
  border-color: var(--result-line);
  font-family: var(--site-font);
}

:is(
  .qimen-table th,
  .qimen-table td,
  .liu-ren-table th,
  .liu-ren-table td,
  .custom-table th,
  .custom-table td,
  .combined-phone-table th,
  .combined-phone-table td,
  .life-number-grid > *,
  .xuan-kong-grid > *
) {
  border-color: var(--result-line);
}

:is(
  .info-section-grid,
  .cai-logic-item,
  .cai-result-line,
  .interpret-section,
  .life-number-missing-card,
  .life-number-meta-card,
  .born-year-card,
  .born-year-result,
  .qimen-analysis-guide,
  .qimen-empty-note
) {
  border-color: var(--result-line);
  background-color: transparent;
}

/* Nested result blocks sit directly on the paper surface instead of making grey cards inside cards. */
:is(
  .liu-ren-summary-item,
  .liu-ren-table td,
  .life-number-meta-card,
  .life-number-cell,
  .life-number-missing-card,
  .life-number-reference-card,
  .phone-analysis-subsection,
  .analysis-item,
  .born-year-card,
  .born-year-result,
  .xk-notes,
  .xk-primary-board-card,
  .xk-inner-board,
  .xk-board-meta span,
  .qimen-reference-card .text-box-container,
  .qimen-empty-note,
  .info-section,
  .info-section-grid,
  .cai-logic-item,
  .cai-result-line,
  .interpret-section
) {
  background: var(--result-bg);
  box-shadow: none;
}

.qimen-analysis-guide {
  background: transparent;
}

.phone-tips-section,
.phone-tips-section .phone-analysis-subsection,
.phone-tips-section .analysis-item {
  background: transparent;
  box-shadow: none;
}

.liu-ren-plate .plate-cell,
.liu-ren-plate .plate-center {
  background: var(--result-bg);
}

/* Dense chart row headers stay legible without overpowering the actual values. */
.liu-ren-table th,
.combined-phone-table th:first-child,
.combined-phone-row-number th:first-child {
  background: var(--result-bg);
  color: var(--surface-ink);
  font-size: 13px;
  font-weight: 650;
  border-right: 1px solid var(--result-line);
  box-shadow: none;
}

.liu-ren-three-transmission-section .liu-ren-table th,
.liu-ren-four-ke-section .liu-ren-table th {
  background: var(--result-bg);
  color: var(--surface-ink);
  font-size: 13px;
  font-weight: 650;
  border-right: 1px solid var(--result-line);
  box-shadow: none;
}

/* Name chart: one continuous paper surface. Only semantic/current states keep a fill. */
.name-page #output :is(
  .name-chart-container,
  .name-chart-wrapper,
  .name-chart-info-panel,
  .name-chart-side-panel,
  .right-matrix-zone,
  .changsheng-radar-container,
  .radar-center-core,
  .space-time-evolution-zone,
  .space-time-title,
  .info-card,
  .five-element-section,
  .info-meta-list,
  .info-section-grid,
  .cai-logic-item,
  .cai-result-line,
  .interpret-section
) {
  background-color: transparent;
  background-image: none;
  box-shadow: none;
}

.name-page #output .matrix-cell:not(.is-current),
.name-page #output .fortune-label,
.name-page #output .name-chart-board-meta span,
.name-page #output .cai-result-line > span {
  background: transparent;
  box-shadow: none;
}

.name-page #output .matrix-cell.is-current {
  background: linear-gradient(145deg, var(--name-accent-strong), var(--name-accent)) !important;
  box-shadow: 0 8px 18px rgba(180, 56, 47, 0.24) !important;
}

.name-page #output .matrix-cell.is-current :is(.m-star, .m-key-month) {
  color: #ffffff !important;
}

.name-page #output .matrix-cell.is-current .m-period {
  color: rgba(255, 255, 255, 0.9) !important;
}

.name-page #output .changsheng-card :is(
  .section-title,
  .info-subtitle,
  .section-desc,
  .phenomenon-list,
  .phenomenon-list li
) {
  color: var(--surface-ink);
}

.name-page #output .changsheng-card .interpret-section {
  border-left-color: var(--result-line);
}

.name-page #output .changsheng-card .phenomenon-list li::marker {
  color: var(--surface-muted);
}

/* Name information typography uses one hierarchy and one neutral remark colour. */
.name-page #output :is(
  .name-info-panel-heading h2,
  .info-card h3,
  .info-card h4,
  .section-title,
  .structured-heading
) {
  color: var(--surface-ink);
}

.name-page #output .name-info-tab-panel .info-card h3 {
  font-size: 18px;
  font-weight: 750;
  line-height: 1.3;
}

.name-page #output .name-info-tab-panel :is(
  .info-card h4,
  .section-title,
  .structured-heading
) {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: 0;
}

.name-page #output .name-info-tab-panel .changsheng-intro-section :is(
  .structured-heading,
  .structured-paragraph
) {
  font-weight: 400;
}

.name-page #output :is(
  .info-subtitle,
  .info-meta-label,
  .cai-logic-label,
  .pattern-info-section > span,
  .marriage-info-row > span
) {
  color: var(--surface-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

/* Phone analysis: one paper background; element meaning is carried by text color only. */
.phone-analysis-section .combined-phone-table td,
.phone-analysis-section .combined-phone-table td:empty,
.phone-analysis-section .combined-phone-table .pair-cell,
.phone-analysis-section .combined-phone-row-palace td,
.phone-analysis-section .combined-phone-row-number td,
.phone-analysis-section .combined-phone-row-qimen td {
  background: var(--result-bg) !important;
}

.phone-analysis-section :is(
  .palace-analysis-item,
  .qimen-palace-diagram,
  .qimen-palace-cell,
  .palace-analysis-warning
) {
  background: var(--result-bg);
  background-image: none;
  box-shadow: none;
}

.phone-analysis-section .palace-analysis-digit {
  background: transparent;
}

.phone-analysis-section :is(
  .qimen-element-summary,
  .qimen-element-summary-row,
  .qimen-annual-branch-summary,
  .qimen-annual-branch-row
) {
  background: var(--result-bg);
  box-shadow: none;
}

/* Shared analysis segmented control: name opportunity points + phone analysis. */
:is(.annual-info-tab-list, .palace-button-list) {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 34px;
  padding: 0;
  scrollbar-width: none;
}

:is(.annual-info-tab-list, .palace-button-list)::-webkit-scrollbar {
  display: none;
}

:is(.annual-info-tab-list, .palace-button-list) button:is(.annual-info-tab-button, .palace-jump-button) {
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 1px solid var(--line-dark);
  border-radius: var(--control-radius);
  background: transparent;
  min-height: 34px !important;
  padding: 7px 11px;
  color: var(--surface-ink);
  font-family: var(--site-font);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: none;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.annual-info-tab-list > .annual-info-tab-button {
  height: 34px;
}

:is(.annual-info-tab-list, .palace-button-list) button:is(.annual-info-tab-button, .palace-jump-button):is(:hover, :focus-visible) {
  border: 1px solid var(--brand);
  background: rgba(180, 56, 47, 0.08);
  color: var(--brand-dark);
  box-shadow: none;
  outline: none;
  transform: translate3d(0, -2px, 0);
}

:is(.annual-info-tab-list, .palace-button-list) button:is(.annual-info-tab-button.is-active, .palace-jump-button.is-active) {
  border: 1px solid var(--brand);
  background: rgba(180, 56, 47, 0.08);
  color: var(--brand-dark);
  box-shadow: none;
  transform: translate3d(0, -2px, 0);
}

:is(.annual-info-tab-list, .palace-button-list) button:is(.annual-info-tab-button, .palace-jump-button):active {
  transform: translate3d(0, 0, 0);
  transition-duration: 140ms;
}

@media (prefers-reduced-motion: reduce) {
  :is(.annual-info-tab-list, .palace-button-list) button:is(.annual-info-tab-button, .palace-jump-button) {
    transform: none !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 601px) {
  :is(.annual-info-tab-list, .palace-button-list) {
    overflow: visible;
  }

  .annual-info-tab-list {
    display: none;
  }
}

button.name-info-tab-button,
button.name-info-tab-button:hover,
button.name-info-tab-button:focus-visible,
button.name-info-tab-button.is-active {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  justify-content: flex-start !important;
  text-align: left !important;
}

button.name-info-tab-button {
  color: var(--surface-muted) !important;
}

button.name-info-tab-button.is-active {
  color: var(--brand-dark) !important;
}

@media (max-width: 600px) {
  button.name-info-tab-button.is-active {
    text-decoration: underline;
    text-decoration-color: var(--brand);
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
  }
}

.name-info-tab-button:hover {
  border-color: transparent;
}

:is(.info-part-title, .relationship-combo-kicker, .space-time-title) {
  color: var(--brand-dark);
}

:is(.output-panel, .container, .liu-ren-card, .info-card, .life-number-reference-card) a {
  text-decoration-color: rgba(180, 56, 47, 0.5);
}

/* Final surface lock: page-specific modules may define layout, not a second colour system. */
.qimen-calendar-page .qimen-calendar-results:not(:has(> .output-empty)) {
  border-color: var(--result-line) !important;
  background: var(--result-bg) !important;
  box-shadow: var(--panel-shadow) !important;
}

:is(
  .combined-phone-table,
  .qimen-palace-diagram,
  .life-number-reference-card,
  .right-matrix-zone,
  .space-time-evolution-zone
) {
  border-color: var(--result-line) !important;
}

@media (prefers-reduced-motion: reduce) {
  :is(.output-panel, .container, .liu-ren-card, .info-card) {
    scroll-behavior: auto;
  }
}
/* Phone analysis follows the numbered 01-04 information viewer used by name analysis. */
.phone-tips-section {
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 32px;
  margin-top: 0;
  border: 0;
  border-top: 1px solid var(--name-line);
  border-radius: 0;
  background: transparent;
  padding: 24px 0 0;
  box-shadow: none;
}

.phone-tips-section .phone-tips-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 18px;
}

/* The shared name-information tab module gives selection a clear, tactile lift. */
:is(.name-page #output, .phone-tips-section) .name-info-tab-button {
  position: relative;
  transform-origin: left center;
  will-change: transform;
  transition: color 220ms ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 601px) {
  :is(.name-page #output, .phone-tips-section) .name-info-tab-button:is(:hover, :focus-visible) {
    transform: translate3d(0, -2px, 0);
  }

  :is(.name-page #output, .phone-tips-section) .name-info-tab-button.is-active {
    transform: translate3d(0, -2px, 0);
  }

  :is(.name-page #output, .phone-tips-section) .name-info-tab-button.is-active:active {
    transform: translate3d(0, 0, 0);
    transition-duration: 140ms;
  }
}

:is(.name-page #output, .phone-tips-section) .name-info-tab-button.is-active .name-info-tab-label {
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  :is(.name-page #output, .phone-tips-section) .name-info-tab-button,
  :is(.name-page #output, .phone-tips-section) .name-info-tab-button::after {
    transition-duration: 0.01ms !important;
  }
}

.phone-tips-panel-heading :is(h2, h3) {
  flex: none;
  font-size: 24px;
}

/* Match the flatter paper-and-rule hierarchy of the name analysis result. */
.phone-analysis-section {
  gap: 20px;
  border-color: var(--name-line);
  border-radius: var(--name-radius);
  background: var(--result-bg);
  box-shadow: var(--name-shadow-soft);
}

.phone-analysis-section > h2 {
  margin-bottom: 0;
  color: var(--name-ink);
  font-weight: 800;
  line-height: 1.2;
}

.phone-analysis-section #combinedTableContainer {
  padding-bottom: 0;
}

.phone-analysis-section .combined-phone-table {
  border: 1px solid var(--name-line);
  border-radius: var(--name-radius);
  background: var(--result-bg);
  box-shadow: var(--name-shadow-soft);
}

.phone-analysis-section .combined-phone-table th,
.phone-analysis-section .combined-phone-table td {
  border-color: var(--name-line);
}

.phone-analysis-section .combined-phone-table th:first-child {
  color: var(--name-muted);
  font-size: 12px;
  font-weight: 700;
}

.phone-analysis-section .combined-phone-row-number td {
  color: var(--name-ink);
  font-size: 20px;
  font-weight: 800;
}

.phone-tips-panel {
  gap: 22px;
}

.phone-tips-panel-heading > span {
  color: var(--name-accent);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.phone-tips-panel-heading :is(h2, h3) {
  color: var(--name-ink);
  font-weight: 800;
  line-height: 1.2;
}

.phone-tips-section .phone-analysis-subsection {
  gap: 14px;
}

.phone-tips-section .phone-analysis-subsection > h4 {
  display: none;
}

.phone-tips-section .phone-analysis-block {
  border-top: 1px solid var(--name-line);
  padding-top: 18px;
}

.phone-tips-section .phone-analysis-subsection > .phone-analysis-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.phone-tips-section .phone-analysis-block h5 {
  margin-bottom: 10px;
  color: var(--name-ink);
  font-size: 15px;
  font-weight: 800;
}

.phone-tips-section .analysis-list {
  gap: 8px;
}

.phone-tips-section .analysis-item {
  grid-template-columns: minmax(150px, .32fr) minmax(0, 1fr);
  gap: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 5px 0;
}

.phone-tips-section .analysis-item strong {
  color: var(--name-ink);
  font-weight: 700;
}

.phone-tips-section .analysis-item span,
.phone-tips-section .analysis-empty {
  color: var(--name-muted);
}

.phone-tips-section .name81-detail-block .analysis-item span {
  white-space: pre-line;
}

@media (max-width: 700px) {
  .phone-tips-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding-top: 16px;
  }

  .phone-tips-section .phone-tips-header { gap: 10px; }

  .phone-tips-section .phone-tips-tabs {
    display: flex;
    margin-inline: -2px;
    width: auto;
    padding: 0 2px 7px;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .phone-tips-section .phone-tips-tabs button.phone-tips-tab {
    flex: 0 0 auto;
    width: auto;
    min-width: 70px;
    min-height: 36px !important;
    padding: 7px 10px;
    border-bottom: 2px solid transparent;
  }

  .phone-tips-section .phone-tips-tabs button.phone-tips-tab:is(:hover, :focus-visible, .active) {
    border-bottom: 2px solid var(--brand);
  }

  .phone-tips-section .analysis-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
}

/* Quiet semantic palette for phone-number outcomes. Element colours remain separate. */
.phone-analysis-section {
  --phone-tone-good: #667d6a;
  --phone-tone-neutral: #7a746a;
  --phone-tone-bad: #946b66;
}

.phone-analysis-section :is(.analysis-tone-good, .green-remark) {
  color: var(--phone-tone-good);
}

.phone-analysis-section :is(.analysis-tone-neutral, .orange-remark) {
  color: var(--phone-tone-neutral);
}

.phone-analysis-section :is(.analysis-tone-bad, .red-remark) {
  color: var(--phone-tone-bad);
}

.phone-analysis-section .analysis-item:is(.analysis-tone-good, .analysis-tone-neutral, .analysis-tone-bad) span {
  color: inherit;
  font-weight: 700;
}

.phone-analysis-section .combination-results :is(.red-remark, .orange-remark, .green-remark) {
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .phone-analysis-section {
    --phone-tone-good: #8da591;
    --phone-tone-neutral: #aaa397;
    --phone-tone-bad: #b88d87;
  }
}

/* Primary actions share a compact desktop size and a full-width mobile row. */
.primary-action,
.tool-page .tool-input-panel button.primary-control {
  box-sizing: border-box;
  width: auto;
  min-width: 160px;
  min-height: 46px;
  height: auto;
  padding: 12px 20px;
  border-radius: var(--control-radius);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--control-shadow);
}

.tool-page .tool-input-panel button.primary-control:is(:hover, :focus-visible) {
  box-shadow: var(--control-shadow-hover);
}

.tool-input-form > .primary-control,
.one-sec-controls.tool-input-panel > .primary-control {
  justify-self: end;
}

.tool-input-form > :is(.generator-action-row, .name-form-action) {
  display: flex;
  justify-content: flex-end;
}

.tool-input-panel > .control-row:has(> .primary-control) {
  justify-content: flex-end;
}

.bazi-page .tool-input-panel > .control-row button {
  width: auto;
  flex: 0 1 auto;
}

/* Form groups retain the existing field order and submit behavior. */
.tool-input-form > .input-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-field-gap);
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.input-section > legend {
  margin-bottom: 12px;
  padding: 0;
  color: var(--surface-ink);
  font-size: var(--type-section-title);
  font-weight: 700;
}

.tool-input-form > .input-section + .input-section {
  margin-top: 8px;
}

.phone-number-form-grid .input-section > .input-group {
  grid-column: 1 / -1;
}

@media (max-width: 920px) {
  .tool-input-form > .input-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .tool-page .tool-input-panel button.primary-control {
    width: 100%;
    min-width: 0;
  }

  .tool-input-panel > .control-row:has(> .primary-control):not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-input-panel > .control-row > .primary-control {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .tool-input-panel > .control-row:has(> .primary-control) > button {
    width: 100%;
  }

  .phone-number-form-grid .input-section > .input-group:has(> .primary-control) {
    grid-template-columns: minmax(0, 1fr);
  }

  .xuan-kong-form > .input-section {
    grid-template-columns: minmax(0, 1fr);
  }
}

