:root {
    color-scheme: light;
    --bg-canvas: #ffefe3;
    --bg-panel: rgba(255, 255, 255, 0.88);
    --bg-panel-strong: #ffffff;
    --bg-soft: #f6f8fb;
    --bg-selected: #e6f1ff;
    --bg-hover: #f7f9fc;
    --bg-danger: #fff0ef;
    --line-soft: rgba(18, 31, 53, 0.1);
    --line-strong: rgba(18, 31, 53, 0.18);
    --text-primary: #172033;
    --text-secondary: rgba(23, 32, 51, 0.74);
    --text-muted: rgba(23, 32, 51, 0.54);
    --shadow-panel: 0 14px 34px rgba(52, 67, 92, 0.1);
    --shadow-card: 0 8px 22px rgba(30, 42, 64, 0.07);
    --shadow-soft: 0 2px 8px rgba(41, 57, 82, 0.08);
    --shadow-focus: 0 0 0 4px rgba(88, 156, 255, 0.2);
    --accent: #0a6fe8;
    --red: #b02a37;
    --stack-gap: 10px;
    --card-gap: 8px;
    --page-gutter: clamp(1.5rem, 3vw, 2rem);
    --radius-panel: 18px;
    --radius-card: 12px;
    --radius-control: 10px;
    --radius-pill: 999px;
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "PingFang TC", "Hiragino Sans CNS",
        "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei UI",
        "Microsoft JhengHei", sans-serif;
}

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

html {
    background: var(--bg-canvas);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--bg-canvas);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
}

h1,
h2,
p {
    margin-top: 0;
}

.site-navbar {
    min-height: 38px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.78);
    border-bottom: 1px solid rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.site-navbar-inner {
    width: min(1180px, calc(100% - var(--page-gutter)));
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 3px 0;
}

.site-breadcrumb {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.38rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-breadcrumb-item {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
}

.site-breadcrumb-current {
    flex: 1 1 auto;
}

.site-separator {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 2px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0;
    text-decoration: none;
}

.site-page-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-brand:hover {
    color: var(--accent);
}

.site-brand:focus-visible,
.capsule-button:focus-visible,
.primary-site-button:focus-visible,
.histology-choice-row:focus-visible,
.lymph-node-button:focus-visible,
.measurement-input:focus-visible,
.tumor-involvement-select:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus);
}

.app-shell {
    width: min(1180px, calc(100% - var(--page-gutter)));
    margin: 0 auto;
    padding: 12px 0;
}

.page-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-bottom: var(--stack-gap);
}

.capsule-button {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: var(--radius-pill);
    background: var(--bg-panel);
    color: var(--accent);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.capsule-button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.capsule-button:hover {
    border-color: rgba(10, 111, 232, 0.18);
    background: var(--bg-hover);
}

.capsule-button:active {
    transform: scale(0.97);
}

.danger-button {
    color: var(--red);
}

.app-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--stack-gap);
    overflow: visible;
}

.input-column {
    position: relative;
    z-index: 2;
    min-width: 0;
    display: grid;
    gap: 8px;
}

.output-panel {
    position: relative;
    z-index: 1;
}

.panel {
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: var(--radius-panel);
    background: var(--bg-panel);
    box-shadow: var(--shadow-panel);
    padding: 14px;
    backdrop-filter: blur(22px);
}

.input-panel {
    display: grid;
    gap: 16px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.panel-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: 0;
}

.placeholder-card {
    min-height: 180px;
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-card);
    background: var(--bg-panel-strong);
    box-shadow: var(--shadow-card);
}

.placeholder-card {
    align-content: center;
}

.stage-result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.stage-result-card {
    min-width: 0;
    display: grid;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-card);
    background: var(--bg-panel-strong);
    box-shadow: var(--shadow-card);
}

.stage-result-title {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 780;
    line-height: 1.2;
    letter-spacing: 0;
}

.stage-result-placeholder {
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 7px 10px;
    border: 1px solid rgba(10, 111, 232, 0.08);
    border-radius: var(--radius-control);
    background: rgba(10, 111, 232, 0.045);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 760;
    line-height: 1.2;
}

.stage-result-blank-row {
    min-height: 36px;
}

.stage-result-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.35;
}

.figo-result-card {
    gap: 8px;
}

.figo-stage-value,
.tnm-stage-value {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid rgba(10, 111, 232, 0.18);
    border-radius: var(--radius-control);
    background: var(--bg-selected);
    color: var(--accent);
    font-size: 1.02rem;
    font-weight: 820;
    line-height: 1.2;
}

.summary-result-card {
    grid-column: 1 / -1;
    align-content: start;
    justify-items: start;
    text-align: left;
    transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.description-result-card {
    grid-column: 1 / -1;
}

.summary-result-card.is-copyable {
    cursor: pointer;
}

.summary-result-card.is-copyable:hover {
    border-color: rgba(10, 111, 232, 0.28);
    background: var(--bg-hover);
}

.summary-result-card.is-copyable:active {
    transform: scale(0.995);
}

.summary-result-card.is-copyable:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus);
}

.summary-result-card.is-empty {
    cursor: default;
}

.summary-result-header {
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 6px;
}

.summary-copy-button {
    width: 0.95rem;
    height: 0.95rem;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--accent);
    line-height: 0;
}

.summary-copy-button:hover:not(:disabled) {
    background: var(--bg-hover);
}

.summary-copy-button svg {
    width: 0.82rem;
    height: 0.82rem;
}

.summary-copy-button:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.48;
}

.stage-description-copy {
    min-height: 1.35em;
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.35;
}

.stage-description-list {
    display: grid;
    gap: 5px;
}

.stage-description-row {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.stage-description-label {
    font-weight: 800;
}

.summary-result-copy {
    width: 100%;
    justify-self: start;
    min-height: 1.35em;
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.input-section {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.input-section-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
}

.primary-site-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.primary-site-grid.is-collapsed {
    grid-template-columns: 1fr;
}

.primary-site-button {
    min-width: 0;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-pill);
    background: var(--bg-soft);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 720;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
    white-space: normal;
}

.primary-site-button:hover {
    border-color: var(--line-strong);
    background: var(--bg-hover);
    color: var(--text-primary);
}

.primary-site-button.is-selected {
    border-color: rgba(10, 111, 232, 0.28);
    background: var(--bg-selected);
    color: var(--accent);
}

.primary-site-button.is-inactive,
.primary-site-button:disabled {
    cursor: not-allowed;
    border-color: var(--line-soft);
    background: var(--bg-soft);
    color: var(--text-muted);
    opacity: 0.58;
}

.primary-site-button.is-inactive:hover,
.primary-site-button:disabled:hover {
    border-color: var(--line-soft);
    background: var(--bg-soft);
    color: var(--text-muted);
}

.histopathology-section {
    gap: 8px;
}

.histology-placeholder {
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-card);
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 680;
    line-height: 1.25;
}

.histology-card-stack {
    display: grid;
    gap: 6px;
}

.histology-choice-card {
    position: relative;
    z-index: 5;
    min-width: 0;
    overflow: visible;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-card);
    background: var(--bg-panel-strong);
    box-shadow: var(--shadow-soft);
}

.histology-choice-card.is-expanded {
    z-index: 30;
}

.histology-choice-card.has-selection {
    border-color: var(--accent);
}

.histology-choice-card.is-collapsed {
    background: var(--bg-panel-strong);
    color: var(--accent);
}

.histology-choice-card-header {
    width: 100%;
    min-height: 38px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 8px 7px 10px;
    border-radius: calc(var(--radius-card) - 1px);
    color: inherit;
    text-align: center;
}

.histology-choice-card-header:hover {
    background: var(--bg-hover);
}

.histology-choice-card-header:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus);
}

.histology-choice-card-title {
    min-width: 0;
    overflow-wrap: anywhere;
    color: inherit;
    font-size: 0.84rem;
    font-weight: 760;
    line-height: 1.2;
    text-align: center;
}

.histology-fold-button {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: currentColor;
}

.histology-fold-button svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.histology-choice-list {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    overflow: hidden;
    border-top: 1px solid var(--line-soft);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-card);
    background: var(--bg-panel-strong);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(22px);
}

.histology-overlay-grid {
    display: grid;
    grid-template-columns: minmax(12rem, 0.92fr) minmax(0, 1.08fr);
    align-items: stretch;
}

.histology-overlay-grid:not(.has-active-group) {
    grid-template-columns: 1fr;
}

.histology-choice-group-list,
.histology-choice-sublist {
    min-width: 0;
}

.histology-choice-group-list {
    display: grid;
    align-content: start;
}

.histology-choice-sublist {
    max-height: 320px;
    overflow: auto;
    border-left: 1px solid var(--line-soft);
}

.histology-choice-group-button {
    min-width: 0;
    width: 100%;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 730;
    line-height: 1.2;
    text-align: left;
    overflow-wrap: anywhere;
}

.histology-choice-group-button + .histology-choice-group-button {
    border-top: 1px solid var(--line-soft);
}

.histology-choice-group-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.histology-choice-group-button.is-selected {
    background: var(--bg-selected);
    color: var(--accent);
}

.histology-choice-group-title {
    padding: 7px 10px 5px;
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 760;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.histology-choice-row {
    min-width: 0;
    width: 100%;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    color: var(--text-secondary);
    line-height: 1.2;
    text-align: left;
}

.histology-choice-row + .histology-choice-row {
    border-top: 1px solid var(--line-soft);
}

.histology-choice-row:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.histology-choice-row.is-selected {
    background: var(--bg-selected);
    color: var(--accent);
}

.histology-radio {
    width: 0.86rem;
    height: 0.86rem;
    flex: 0 0 auto;
    border: 1px solid currentColor;
    border-radius: 999px;
    opacity: 0.62;
}

.histology-choice-row.is-selected .histology-radio {
    background: currentColor;
    box-shadow: inset 0 0 0 3px var(--bg-selected);
    opacity: 1;
}

.histology-label {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.82rem;
    font-weight: 720;
}

.lymph-node-section {
    gap: 12px;
}

.tumor-involvement-section {
    gap: 12px;
}

.tumor-involvement-items {
    display: grid;
    gap: 8px;
}

.tumor-involvement-item-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(7rem, 0.55fr) minmax(12rem, 1fr);
    align-items: center;
    gap: 10px;
}

.tumor-involvement-item-label {
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 740;
    line-height: 1.2;
}

.tumor-involvement-item-control {
    justify-self: end;
    max-width: 320px;
}

.tumor-involvement-item-control.degree-segmented-control {
    width: fit-content;
    max-width: 100%;
    min-height: 32px;
    padding: 2px;
}

.tumor-involvement-item-control.cervix-segmented-control {
    width: fit-content;
    max-width: 100%;
}

.tumor-involvement-item-control .degree-segment-button {
    min-height: 26px;
    padding: 4px 10px;
}

.cervix-segmented-control .degree-option-label {
    overflow-wrap: normal;
    white-space: nowrap;
}

.tumor-involvement-select-wrap {
    position: relative;
    min-width: 0;
    width: min(100%, 320px);
    justify-self: end;
}

.tumor-involvement-select-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    width: 7px;
    height: 7px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    color: var(--text-muted);
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
}

.tumor-involvement-select {
    width: 100%;
    min-height: 32px;
    appearance: none;
    padding: 4px 32px 4px 32px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-control);
    background: var(--bg-panel-strong);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-align-last: center;
}

.tumor-involvement-select option {
    text-align: center;
}

.tumor-involvement-select:hover {
    border-color: var(--line-strong);
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tumor-involvement-select.has-selection {
    border-color: rgba(10, 111, 232, 0.28);
    color: var(--accent);
}

.lymph-node-list,
.tumor-involvement-list {
    display: grid;
    gap: 7px;
}

.lymph-node-row,
.tumor-involvement-row {
    min-width: 0;
}

.lymph-node-card,
.tumor-involvement-card {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-card);
    background: var(--bg-panel-strong);
    box-shadow: var(--shadow-soft);
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tumor-involvement-card {
    align-items: stretch;
}

.lymph-node-card.is-folded-option,
.tumor-involvement-card.is-folded-option {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.lymph-node-card.is-simple {
    grid-template-columns: minmax(0, 1fr);
}

.tumor-involvement-card.is-simple {
    grid-template-columns: minmax(0, 1fr);
}

.lymph-node-card:hover,
.tumor-involvement-card:hover {
    border-color: var(--line-strong);
    background: var(--bg-hover);
}

.lymph-node-card:focus-within,
.tumor-involvement-card:focus-within {
    box-shadow: var(--shadow-focus);
}

.lymph-node-card.is-selected,
.tumor-involvement-card.is-selected {
    border-color: var(--accent);
    background: var(--bg-selected);
}

.lymph-node-button,
.tumor-involvement-toggle {
    min-width: 0;
    width: 100%;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 6px;
    border-radius: calc(var(--radius-control) - 2px);
    color: var(--text-secondary);
    text-align: left;
}

.lymph-node-button:hover,
.tumor-involvement-toggle:hover {
    color: var(--text-primary);
}

.lymph-node-button:focus-visible,
.tumor-involvement-toggle:focus-visible {
    box-shadow: none;
}

.lymph-node-card.is-selected .lymph-node-button,
.tumor-involvement-card.is-selected .tumor-involvement-toggle {
    color: var(--accent);
}

.lymph-node-check,
.selection-card-check {
    width: 0.86rem;
    height: 0.86rem;
    flex: 0 0 auto;
    border: 1px solid currentColor;
    border-radius: 4px;
    opacity: 0.62;
}

.lymph-node-card.is-selected .lymph-node-check,
.tumor-involvement-card.is-selected .selection-card-check {
    background: currentColor;
    box-shadow: inset 0 0 0 2px var(--bg-selected);
    opacity: 1;
}

.lymph-node-copy,
.selection-card-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.lymph-node-label,
.selection-card-label {
    font-size: 0.86rem;
    font-weight: 740;
    line-height: 1.2;
}

.lymph-node-note,
.selection-card-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 660;
    line-height: 1.2;
}

.lymph-node-card.is-selected .lymph-node-note,
.tumor-involvement-card.is-selected .selection-card-note {
    color: var(--accent);
}

.lymph-node-card.is-selected .measurement-input-wrap {
    border-color: var(--accent);
}

.selection-card-hint {
    align-self: center;
    max-width: min(42vw, 14rem);
    padding: 0 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 720;
    line-height: 1.2;
    text-align: right;
    overflow-wrap: anywhere;
}

.selection-card-segment-stack {
    grid-column: 1 / -1;
    display: grid;
    gap: 0;
    padding: 7px 6px 0;
    border-top: 1px solid var(--line-soft);
}

.degree-field {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 4px;
}

.selection-card-segment-stack .degree-field + .degree-field {
    margin-top: 5px;
}

.degree-field.is-disabled {
    opacity: 0.52;
}

.degree-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 680;
    line-height: 1.25;
}

.degree-segmented-control {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    display: inline-flex;
    align-items: stretch;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-control);
    background: var(--bg-soft);
}

.selection-card-segment-stack .degree-segmented-control {
    width: 100%;
    display: flex;
}

.degree-segment-button {
    min-width: 0;
    min-height: 34px;
    max-width: 100%;
    flex: 0 1 auto;
    display: grid;
    align-content: center;
    gap: 1px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-control) - 3px);
    color: var(--text-secondary);
    line-height: 1.12;
    text-align: center;
}

.selection-card-segment-stack .degree-segment-button {
    flex: 1 1 0;
}

.degree-segment-button:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.degree-segment-button:focus-visible {
    outline: 0;
    box-shadow: inset 0 0 0 1px var(--accent);
}

.degree-segment-button.is-selected {
    border-color: var(--accent);
    background: var(--bg-panel-strong);
    color: var(--accent);
}

.degree-segment-button:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.degree-option-label {
    overflow-wrap: normal;
    font-size: 0.76rem;
    font-weight: 730;
    white-space: nowrap;
}

.selection-card-segment-stack .degree-option-label {
    overflow-wrap: anywhere;
    white-space: normal;
}

.degree-option-detail {
    overflow-wrap: anywhere;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 680;
}

.degree-segment-button.is-selected .degree-option-detail {
    color: var(--accent);
}

.selection-card-condition-row {
    grid-column: 1 / -1;
    display: block;
    padding: 5px 6px 0;
    border-top: 1px solid var(--line-soft);
}

.selection-card-condition-row.is-disabled {
    opacity: 0.52;
}

.condition-checkbox-grid {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.condition-checkbox {
    min-width: 0;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 4px;
    border-radius: 6px;
    color: var(--text-secondary);
    text-align: left;
}

.condition-checkbox:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.condition-checkbox:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus);
}

.condition-checkbox.is-selected {
    color: var(--accent);
}

.condition-checkbox:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.condition-checkbox-mark {
    width: 0.72rem;
    height: 0.72rem;
    flex: 0 0 auto;
    border: 1px solid currentColor;
    border-radius: 4px;
    opacity: 0.62;
}

.condition-checkbox.is-selected .condition-checkbox-mark {
    background: currentColor;
    box-shadow: inset 0 0 0 2px var(--bg-panel-strong);
    opacity: 1;
}

.condition-checkbox-label {
    overflow-wrap: anywhere;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.12;
}

.cervix-primary-detail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 6px 0;
    border-top: 1px solid var(--line-soft);
}

.cervix-primary-detail.is-disabled {
    opacity: 0.52;
}

.invasion-pattern-field {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 7px;
}

.cervix-measurement-field {
    min-width: 172px;
}

.measurement-field {
    display: grid;
    grid-template-columns: auto minmax(92px, 140px);
    align-items: center;
    justify-content: end;
    gap: 7px;
    padding: 1px 0 0;
}

.measurement-field.is-disabled {
    opacity: 0.52;
}

.measurement-field.is-disabled .measurement-input-wrap {
    border-color: var(--line-soft);
    background: var(--bg-soft);
}

.measurement-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 680;
    line-height: 1.25;
    white-space: nowrap;
}

.measurement-input-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: calc(var(--radius-control) - 2px);
    background: var(--bg-panel-strong);
}

.measurement-input {
    min-width: 0;
    width: 100%;
    height: 32px;
    padding: 6px 8px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
}

.measurement-input:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.measurement-unit {
    padding: 0 9px 0 2px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.field-label {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
}

.placeholder-label {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.placeholder-copy {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.96rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.site-footer {
    margin: var(--stack-gap) auto 0;
    padding: 0 2px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: center;
}

.site-footer .footer-grid {
    display: grid;
    gap: 0;
    justify-content: center;
    align-items: center;
}

.screen-only {
    display: flex;
}

@media (min-width: 1024px) {
    .app-grid {
        grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
        align-items: start;
    }

    .output-panel {
        position: sticky;
        top: 12px;
    }
}

@media (max-width: 640px) {
    :root {
        --page-gutter: 1rem;
    }

    .panel {
        padding: 12px;
    }

    .primary-site-grid {
        grid-template-columns: 1fr;
    }

    .histology-overlay-grid {
        grid-template-columns: 1fr;
    }

    .histology-choice-sublist {
        max-height: 260px;
        border-top: 1px solid var(--line-soft);
        border-left: 0;
    }

    .lymph-node-card,
    .tumor-involvement-card {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 7px;
    }

    .tumor-involvement-card {
        gap: 2px;
    }

    .tumor-involvement-card.is-folded-option {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px;
    }

    .tumor-involvement-card .tumor-involvement-toggle {
        min-height: 28px;
        padding: 2px 4px;
    }

    .tumor-involvement-item-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .tumor-involvement-item-control {
        justify-self: stretch;
        max-width: none;
    }

    .tumor-involvement-item-control.degree-segmented-control {
        width: 100%;
    }

    .tumor-involvement-item-control.degree-segmented-control .degree-segment-button {
        flex: 1 1 0;
    }

    .tumor-involvement-select-wrap {
        width: 100%;
        justify-self: stretch;
    }

    .degree-field {
        grid-template-columns: 1fr;
    }

    .selection-card-segment-stack .degree-segmented-control {
        flex-direction: column;
    }

    .selection-card-segment-stack .degree-segment-button {
        flex: 0 1 auto;
        width: 100%;
    }

    .condition-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .cervix-primary-detail {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .invasion-pattern-field {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .measurement-field {
        grid-template-columns: auto minmax(92px, 1fr);
        justify-content: stretch;
    }

    .cervix-measurement-field {
        min-width: 0;
    }

    .placeholder-card {
        min-height: 150px;
        padding: 14px;
    }

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

@media (max-width: 420px) {
    .degree-segmented-control {
        width: 100%;
        flex-direction: column;
    }

    .tumor-involvement-item-control.degree-segmented-control {
        width: 100%;
    }

    .tumor-involvement-item-control.degree-segmented-control .degree-segment-button {
        flex: 0 1 auto;
        width: 100%;
    }

    .tumor-involvement-item-control .degree-option-label {
        overflow-wrap: anywhere;
        white-space: normal;
    }
}

@media print {
    :root {
        color-scheme: light;
    }

    html,
    body {
        background: #ffffff;
        color: #111827;
    }

    .screen-only,
    .site-brand,
    .site-separator,
    .theme-switcher {
        display: none !important;
    }

    .site-navbar {
        min-height: auto;
        display: block;
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    .site-navbar-inner,
    .app-shell {
        width: 100%;
        padding: 0;
    }

    .site-page-title {
        white-space: normal;
    }

    .app-grid {
        display: block;
    }

    .input-panel {
        display: none;
    }

    .panel,
    .placeholder-card {
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    .panel {
        padding: 0;
    }

    .site-footer {
        color: #4b5563;
    }
}

.measurement-field {
    grid-template-columns: auto minmax(92px, 140px);
    align-items: center;
    justify-content: end;
}

@media (max-width: 380px) {
    .measurement-field {
        grid-template-columns: 1fr;
        align-items: stretch;
        justify-content: stretch;
    }
}
