:root {
    --bg-color: #1a1c23;
    --card-bg: #212531;
    --card-border: #2d334a;
    --text-main: #d1d5db;
    --text-dim: #8e94a9;
    --accent-color: #94a3b8;
    --accent-hover: #cbd5e1;
    --success: #86efac;
    --danger: #fca5a5;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    display: block;
    padding: 40px 0;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 48px;
}

h1 {
    font-weight: 500;
    font-size: 2rem;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--text-main);
    opacity: 0.9;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 20px;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
    min-height: 82px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

.summary-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
    white-space: nowrap;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    max-width: 100%;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-main);
    white-space: normal;
    line-height: 1.25;
    text-align: center;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.status-pill {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.2);
    color: var(--text-main);
}

.status-pill.status-okay,
.status-pill.status-torn {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.25);
    color: #a7f3d0;
}

.status-pill.status-traveling,
.status-pill.status-travel {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
}

.status-pill.status-hospital,
.status-pill.status-hospitalized {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fecaca;
}

.location-pill {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
}

.location-pill.location-away {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.25);
    color: #fde68a;
}

.sync-pill {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.2);
    color: var(--text-main);
}

.sync-refresh-button {
    margin-top: 8px;
    padding: 4px 10px;
    color: var(--text-main);
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    font: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}

.sync-refresh-button:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.2);
}

.sync-refresh-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.investment-card {
    border-color: rgba(59, 130, 246, 0.45);
    background: linear-gradient(180deg, rgba(29, 78, 216, 0.12), rgba(33, 37, 49, 1));
}

.investment-status {
    margin-top: 12px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #bfdbfe;
    font-weight: 700;
}

.daily-checklist {
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-overall-count {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.checklist-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(17, 20, 27, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow);
}

.checklist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 2px 2px 10px;
    border: 0;
    background: transparent;
    color: var(--text-main);
    margin: 0;
    font-weight: 700;
    font-size: 1.02rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.checklist-header::after {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    flex-shrink: 0;
}

.checklist-group.collapsed .checklist-header::after {
    transform: rotate(-45deg);
}

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

.checklist-group.collapsed .checklist-items {
    display: none;
}

.stats-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: rgba(17, 20, 27, 0.7);
    padding: 10px 12px 12px;
    box-shadow: var(--shadow);
}

.stats-group-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    padding: 2px 4px;
    color: var(--text-dim);
}

.stats-group-header > span:first-child {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
}

.stats-group-header::after {
    position: absolute;
    right: 4px;
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    flex-shrink: 0;
}

.stats-group.is-collapsed .stats-group-header::after {
    transform: rotate(-45deg);
}

.stats-group-value {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.stats-group-body {
    display: grid;
    gap: 16px;
}

.stats-group.is-collapsed .stats-group-body {
    display: none;
}

.checklist-count {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: auto;
    white-space: nowrap;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    width: 100%;
    background: rgba(20, 25, 36, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-left: 3px solid var(--text-dim);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    text-align: left;
}

.checklist-item:hover {
    border-color: rgba(148, 163, 184, 0.4);
}

.checklist-item:disabled {
    cursor: default;
}

.checklist-item.completed {
    border-color: rgba(34, 197, 94, 0.9);
    border-left-color: rgba(34, 197, 94, 0.9);
    background: rgba(12, 27, 20, 0.8);
}

.checklist-item.incomplete {
    border-color: rgba(239, 68, 68, 0.9);
    border-left-color: rgba(239, 68, 68, 0.9);
    background: rgba(29, 17, 17, 0.35);
}

.checklist-toggle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: currentColor;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    position: relative;
}

.checklist-item.completed .checklist-toggle {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
}

.checklist-item.incomplete .checklist-toggle {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
}

.checklist-item.completed .checklist-toggle::before {
    content: '✓';
}

.checklist-item.incomplete .checklist-toggle::before {
    content: 'i';
    font-size: 0.78rem;
    font-weight: 700;
}

.checklist-text {
    font-size: 0.95rem;
    line-height: 1.35;
    flex: 1;
    overflow-wrap: anywhere;
}

.checklist-text strong {
    font-weight: 700;
}

.core-grid-single-line {
    display: flex !important;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: nowrap;
}

.core-grid-single-line .card {
    flex: 0 0 auto;
    min-width: 120px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.card:hover {
    border-color: var(--accent-hover);
    background: #242a3d;
}

.card-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    white-space: normal;
    line-height: 1.3;
}

.card-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    position: relative;
    z-index: 2;
    overflow-wrap: anywhere;
}

@keyframes wave {
    0% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    100% { transform: translateX(-10px); }
}

.card-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, var(--accent-color), var(--accent-hover));
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    border-radius: 0 0 12px 12px;
    opacity: 0.5;
    pointer-events: none;
}

.card-fill::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 200%;
    height: 20px;
    background: var(--fill-color, var(--accent-color));
    border-radius: 50%;
    opacity: 0.6;
    animation: wave 3s infinite ease-in-out;
}

.chart-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}

.chart-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-range {
    background: #1a1c23;
    color: var(--text-dim);
    border: 1px solid var(--card-border);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-range:hover {
    color: var(--text-main);
    border-color: var(--text-dim);
}

.btn-range.active {
    background: var(--card-border);
    color: #fff;
    border-color: var(--accent-color);
}

#chart-metric {
    background: #1a1c23;
    color: var(--text-main);
    border: 1px solid var(--card-border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.footer-info {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.travel-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
}

.travel-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.travel-date {
    color: var(--text-main);
    font-weight: 500;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.travel-countdown {
    color: var(--success);
    font-family: monospace;
    overflow-wrap: anywhere;
}

.efficiency-grid {
    grid-template-columns: repeat(2, 1fr) !important;
}

.waste-subtext {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.waste-high {
    color: var(--danger) !important;
}

.waste-low {
    color: var(--success) !important;
}

.sidebar-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    position: sticky;
    top: 20px;
}

.sidebar-title {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.cooldown-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cooldown-item {
    background: #1a1c23;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-left: 3px solid var(--accent-color);
    width: 100%;
    box-sizing: border-box;
}

.cd-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.cooldown-name {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cooldown-time {
    color: var(--success);
    font-family: monospace;
    font-size: 1.1rem;
}

.growth-indicator {
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: bold;
}

.growth-positive {
    color: var(--success);
}

.growth-negative {
    color: var(--danger);
}

.main-wrapper {
    display: block;
    width: 100%;
}

.main-wrapper.war-room-active {
    transform: none;
}

.panel {
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

#war-room-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 40px 20px;
    overflow-y: auto;
    background: var(--bg-color);
    visibility: hidden;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.5s;
}

.main-wrapper.war-room-active #war-room-panel {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
}

#education-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 40px 20px;
    overflow-y: auto;
    background: var(--bg-color);
    visibility: hidden;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.5s;
}

.main-wrapper.education-room-active #education-panel {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
}

.dashboard-layout {
    position: relative;
    display: block;
    width: calc(100vw - 40px);
    max-width: 1700px;
    left: 50%;
    transform: translateX(-50%);
}

.side-panel {
    position: absolute;
    top: 0;
    left: calc((100% - 100vw) / 2 + 20px);
    width: min(220px, calc((100vw - 1018px) / 2));
}

.checklist-side-panel {
    left: auto;
    right: calc((100% - 100vw) / 2 + 20px);
    width: min(308px, calc((100vw - 1018px) / 2 + 88px));
}

#dashboard {
    width: 100%;
    max-width: 930px;
    margin: 0 auto;
}

.side-panel .container {
    max-width: 100%;
}

.side-panel h1 {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 20px;
}

.cooldown-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 40px;
}

.travel-stocks-container {
    position: relative;
    margin-top: 28px;
    padding: 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-family: inherit;
}

.travel-stocks-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: start;
    gap: 8px;
    margin-bottom: 10px;
}

.travel-stocks-toggle {
    display: grid;
    width: 24px;
    height: 24px;
    grid-column: 2;
    grid-row: 1;
    place-items: center;
    margin: -3px -3px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}

.travel-stocks-toggle::after {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}

.travel-stocks-container.is-collapsed .travel-stocks-toggle::after {
    transform: rotate(-45deg);
}

.travel-stocks-heading {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.travel-stocks-container.is-collapsed .travel-stocks-body {
    display: none;
}

.travel-stocks-container.is-collapsed {
    padding-top: 10px;
    padding-bottom: 10px;
}

.travel-stocks-container.is-collapsed .travel-stocks-header {
    margin-bottom: 0;
}

.travel-stocks-toggle:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

.travel-stocks-container.is-collapsed .travel-stock-country,
.travel-stocks-container.is-collapsed .travel-capacity-control {
    display: none;
}

.travel-stocks-heading .card-label {
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}

.travel-stock-country {
    margin-top: 4px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
}

.travel-capacity-control {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding-top: 8px;
    border-top: 1px solid var(--card-border);
    color: var(--text-dim);
    font-size: 0.72rem;
    white-space: nowrap;
}

.travel-capacity-control input {
    width: 42px;
    min-height: 28px;
    padding: 3px 4px;
    color: var(--text-main);
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    font: inherit;
    font-size: 0.82rem;
    text-align: center;
}

.travel-stock-status,
.travel-stock-updated {
    color: var(--text-dim);
    font-size: 0.76rem;
    line-height: 1.4;
}

.travel-stock-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 9px;
}

.travel-stock-item {
    padding: 8px;
    background: rgba(17, 20, 27, 0.72);
    border: 1px solid var(--card-border);
    border-radius: 6px;
}

.travel-stock-item-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
}

.travel-stock-item-name {
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.travel-stock-quantity {
    flex-shrink: 0;
    padding: 3px 6px;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.travel-stock-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 7px;
}

.travel-stock-metric-label {
    display: block;
    color: var(--text-dim);
    font-size: 0.64rem;
    line-height: 1.25;
}

.travel-stock-metric-value {
    display: block;
    margin-top: 2px;
    color: var(--text-main);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.travel-stock-metric-value.profit-positive {
    color: var(--success);
}

.travel-stock-updated {
    margin-top: 9px;
}

.checklist-panel-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 40px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.checklist-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
}

.checklist-panel-toggle::after {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    flex-shrink: 0;
}

.checklist-panel-container.is-collapsed .checklist-panel-toggle::after {
    transform: rotate(-45deg);
}

.checklist-panel-container.is-collapsed .daily-checklist {
    display: none;
}

.checklist-panel-container .checklist-group {
    padding: 10px;
    gap: 8px;
}

.checklist-panel-container .checklist-header {
    gap: 6px;
    padding: 0 0 6px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.checklist-panel-container .checklist-count {
    font-size: 0.68rem;
}

.checklist-panel-container .checklist-item {
    min-height: 38px;
    gap: 8px;
    padding: 8px;
    border-radius: 7px;
}

.checklist-panel-container .checklist-text {
    font-size: 0.78rem;
}

@media (min-width: 1378px) {
    #dashboard {
        max-width: 850px;
    }

    .side-panel {
        width: min(300px, calc((100vw - 914px) / 2));
    }

    .core-grid-single-line {
        gap: 10px;
    }
}

@media (max-width: 1377px) {
    .dashboard-layout {
        width: 100%;
        max-width: 1100px;
        left: auto;
        transform: none;
        margin: 0 auto;
    }

    .side-panel {
        position: static;
        width: auto;
        margin-bottom: 24px;
    }

    .checklist-panel-container {
        position: static;
        max-height: none;
    }
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-button,
.settings-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-main);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.settings-button:hover,
.settings-close:hover {
    background: var(--card-border);
    border-color: var(--accent-color);
}

.settings-button svg {
    display: block;
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.settings-dialog {
    width: min(460px, calc(100% - 32px));
    max-width: none;
    padding: 0;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    background: var(--bg-color);
    color: var(--text-main);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.settings-dialog::backdrop {
    background: rgba(5, 7, 12, 0.74);
    backdrop-filter: blur(3px);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 24px;
}

.settings-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.settings-dialog-header h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.settings-dialog-header p {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.84rem;
    line-height: 1.5;
}

.settings-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    font-size: 1.5rem;
    line-height: 1;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 9px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
}

.settings-field > input {
    box-sizing: border-box;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    outline: none;
    background: var(--card-bg);
    color: var(--text-main);
    font: inherit;
}

.settings-field > input:focus {
    border-color: var(--accent-color);
}

.settings-field > input::placeholder {
    color: var(--text-dim);
    font-size: 0.76rem;
    font-weight: 400;
}

.settings-key-status,
.settings-optional,
.settings-hint {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 400;
}

.settings-clear-option {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 400;
    cursor: pointer;
}

.settings-clear-option input {
    margin: 0;
    accent-color: var(--accent-color);
}

.settings-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
}

.settings-message {
    margin: 0;
    color: var(--success);
    font-size: 0.82rem;
}

.settings-message.is-error {
    color: var(--danger);
}

.settings-dialog-footer button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-war-room {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.btn-war-room:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.war-section {
    max-width: 920px;
    margin: 0 auto 32px;
}

.education-room-status {
    max-width: 920px;
    margin: 0 auto 24px;
    color: var(--text-dim);
    text-align: center;
}

.education-path-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto 32px;
}

.education-path-button {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    min-width: 0;
    min-height: 190px;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 14px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-main);
    font: inherit;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

.education-path-button::before {
    position: absolute;
    z-index: 0;
    inset: auto 0 0;
    width: 100%;
    height: var(--path-progress, 0%);
    background: rgba(129, 140, 248, 0.32);
    content: '';
    pointer-events: none;
    transition: height 0.5s ease;
}

.education-path-button > * {
    position: relative;
    z-index: 1;
}

.education-path-button:hover,
.education-path-button[aria-expanded="true"] {
    border-color: var(--accent-color);
    background: #282d3a;
    transform: translateY(-2px);
}

.education-path-button[aria-expanded="true"] {
    border-color: #818cf8;
}

.education-path-button:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 3px;
}

.education-path-name {
    font-weight: 700;
    line-height: 1.35;
}

.education-path-percentage {
    font-size: 1.5rem;
    font-weight: 700;
}

.education-path-count {
    color: var(--text-dim);
    font-size: 0.82rem;
}

.education-path-active-progress {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    margin: 0;
    padding: 8px 0 0;
    border-top: 1px solid rgba(129, 140, 248, 0.2);
    text-align: left;
}

.education-path-active-progress-label {
    color: #c4b5fd;
    font-size: 0.68rem;
}

.education-path-active-progress-track {
    display: block;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(129, 140, 248, 0.16);
}

.education-path-active-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #818cf8;
    transition: width 0.5s ease;
}

.education-course-tree {
    max-width: 920px;
    margin: 0 auto 32px;
    padding: 20px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: rgba(17, 20, 27, 0.7);
    box-shadow: var(--shadow);
    scroll-margin-top: 20px;
}

.education-course-tree[hidden] {
    display: none;
}

.education-tree-heading {
    margin-bottom: 16px;
}

.education-tree-heading h2 {
    margin: 0 0 6px;
    font-size: 1.3rem;
}

.education-tree-heading p {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.88rem;
}

.education-course-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.education-course-item {
    position: relative;
    padding: 12px 14px;
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--text-dim);
    border-radius: 8px;
    background: var(--card-bg);
}

.education-course-item::before {
    position: absolute;
    top: 50%;
    left: -13px;
    width: 10px;
    border-top: 1px solid var(--card-border);
    content: '';
}

.education-course-item.is-completed {
    border-left-color: var(--success);
}

.education-course-item.is-current {
    border-left-color: #93c5fd;
    overflow: hidden;
}

.education-course-progress {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--course-progress, 0%);
    background: rgba(129, 140, 248, 0.32);
    pointer-events: none;
    transition: width 0.5s ease;
}

.education-course-item.is-available {
    border-left-color: var(--accent-color);
}

.education-course-item.is-locked {
    opacity: 0.72;
}

.education-course-main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.education-course-name {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.education-course-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.education-course-name strong {
    color: var(--text-main);
}

.education-course-name small {
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.4;
}

.education-course-reward {
    display: block;
    color: var(--success) !important;
}

.education-course-code {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.education-course-duration {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 400;
}

.education-course-status {
    flex: 0 0 auto;
    padding: 4px 8px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 700;
}

.is-completed .education-course-status {
    border-color: rgba(134, 239, 172, 0.25);
    color: var(--success);
}

.is-current .education-course-status {
    border-color: rgba(147, 197, 253, 0.25);
    color: #bfdbfe;
}

.section-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: left;
    letter-spacing: 0.04em;
}

.war-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    color: var(--text-main);
    text-align: center;
    box-shadow: var(--shadow);
}

.war-card.highlight {
    border-color: var(--accent-color);
    background: linear-gradient(120deg, #252d3a, #1d222d);
    text-align: left;
}

.war-target-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.war-target-heading .section-label {
    margin-bottom: 4px;
}

.war-target-context {
    margin: 0 0 12px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.war-source-link {
    flex-shrink: 0;
    color: var(--accent-hover);
    font-size: 0.75rem;
}

.war-target-status {
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.war-target-list {
    max-height: min(58vh, 680px);
    overflow: auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.war-target-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 58px minmax(140px, 1fr) 88px minmax(150px, 1.3fr) 44px;
    align-items: center;
    gap: 14px;
    min-height: 56px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--card-border);
}

.war-target-row:last-child {
    border-bottom: 0;
}

.war-target-next-strongest {
    background: rgba(148, 163, 184, 0.07);
}

.war-target-header {
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: 40px;
    background: #292f3d;
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}

.war-target-member {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
}

.war-target-member a {
    width: fit-content;
    max-width: 100%;
    color: var(--text-main);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.war-target-member small {
    color: var(--text-dim);
    font-size: 0.65rem;
}

.war-target-badge {
    align-self: flex-start;
    padding: 3px 6px;
    color: var(--accent-hover);
    background: rgba(148, 163, 184, 0.12);
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
}

.war-target-level,
.war-target-fair-fight,
.war-target-status-value {
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.war-target-status-value.is-hospital {
    color: var(--danger);
}

.war-target-status-value.is-okay {
    color: #a7f3d0;
}

.war-target-status-value.is-traveling {
    color: #bfdbfe;
}

.war-target-estimate strong {
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.war-target-header > :last-child {
    text-align: center;
}

.war-target-attack {
    display: inline-grid;
    place-items: center;
    justify-self: center;
    width: 32px;
    height: 32px;
    color: var(--text-dim);
    background: #1a1c23;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.war-target-attack:hover {
    color: var(--text-main);
    background: #2a3040;
    border-color: var(--accent-color);
}

.war-target-attack.is-disabled,
.war-target-attack.is-disabled:hover {
    color: var(--text-dim);
    background: #1a1c23;
    border-color: var(--card-border);
    cursor: not-allowed;
    opacity: 0.45;
}

.war-target-attack:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

.war-target-attack svg {
    width: 17px;
    height: 17px;
}

.upcoming-opponent {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.upcoming-start {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.war-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.war-record {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.war-record-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 12px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.war-record-metric span {
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}

.war-record-metric strong {
    color: var(--text-main);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.war-result {
    min-width: 0;
    padding: 16px 18px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--danger);
    border-radius: 8px;
}

.war-result.win {
    border-left-color: var(--success);
}

.war-result-heading,
.war-winner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.war-result-heading h3 {
    min-width: 0;
    margin: 0;
    color: var(--text-main);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.war-outcome {
    flex-shrink: 0;
    padding: 4px 8px;
    color: var(--danger);
    background: rgba(252, 165, 165, 0.1);
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.war-result.win .war-outcome {
    color: var(--success);
    background: rgba(134, 239, 172, 0.1);
}

.war-winner {
    justify-content: flex-start;
    gap: 8px;
    margin-top: 5px;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.war-winner strong {
    color: var(--text-main);
    font-weight: 500;
}

.war-hit-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.war-hit-stats .war-record-metric {
    padding: 10px 12px;
}

.war-hit-error {
    grid-column: 1 / -1;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.war-scoreboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.war-score-side {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.war-score-side.enemy {
    text-align: right;
}

.war-score-side span {
    color: var(--text-dim);
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.war-score-side strong {
    color: var(--text-main);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

.war-score-bar {
    display: flex;
    gap: 3px;
    height: 6px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--card-border);
}

.war-score-ours,
.war-score-enemy {
    min-width: 2px;
    transition: width 0.4s ease;
}

.war-score-ours {
    background: var(--success);
}

.war-score-enemy {
    background: var(--danger);
}

@media (max-width: 600px) {
    .war-record {
        gap: 6px;
    }

    .war-record-metric {
        padding: 10px;
    }

    .war-record-metric strong {
        font-size: 0.95rem;
    }

    .war-result {
        padding: 14px;
    }

    .war-target-row {
        grid-template-columns: minmax(0, 1fr) 48px minmax(90px, auto);
        gap: 8px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .war-target-row > :nth-child(n + 4) {
        display: none;
    }
}

.cooldown-finished {
    opacity: 0.6;
    border-left-color: var(--success);
}
