/* ---- テーマ（Bootstrap 5.3 の data-bs-theme に合わせる） ---- */
:root,
[data-bs-theme="light"] {
    --app-body-bg: #f6f7f9;
    --app-card-border: #d9dde3;
    --app-input-border: #8d97a3;
    --app-muted: #5c6670;
    --app-panel-bg: #eef1f4;
    --app-note-bg: #fff8c5;
    --app-note-border: #e3c200;
}

[data-bs-theme="dark"] {
    --app-body-bg: #161a1f;
    --app-card-border: #343a40;
    --app-input-border: #6c757d;
    --app-muted: #adb5bd;
    --app-panel-bg: #23282e;
    --app-note-bg: #3b3600;
    --app-note-border: #c9ad00;
}

body {
    background: var(--app-body-bg);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* 入力欄の枠をはっきりさせる */
.form-control,
.form-select {
    border-color: var(--app-input-border);
}

.form-control:disabled,
.form-select:disabled {
    opacity: 0.8;
}

.searchable-select {
    position: relative;
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bs-body-bg);
    border: 1px solid var(--app-input-border);
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.searchable-select-item {
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.searchable-select-item:hover {
    background-color: var(--bs-tertiary-bg);
}

.split-row {
    display: flex;
    gap: 1rem;
}

.split-half {
    flex: 1;
    min-width: 0;
}

.stat-up {
    color: #dc3545;
    font-weight: bold;
}

.stat-down {
    color: #0d6efd;
    font-weight: bold;
}

#blazor-error-ui {
    background: lightyellow;
    color: #212529;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 767.98px) {
    .split-row {
        flex-direction: column;
    }
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 1rem;
}

/* ---- 努力値・ランク ---- */
.ev-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ev-cell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 6.5rem;
}

.ev-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-muted);
    text-align: center;
}

.ev-buttons {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.ev-buttons .btn {
    flex: 1;
    padding: 0.05rem 0.3rem;
    font-size: 0.75rem;
}

/* ---- タイプ相性表 ---- */
.type-chart {
    width: auto;
    font-size: 1rem;
    text-align: center;
}

.type-chart .type-head,
.type-chart .type-corner {
    white-space: nowrap;
    font-weight: 600;
    background: var(--app-panel-bg);
    width: 2.6rem;
    padding: 0.2rem;
}

.type-chart .type-corner {
    font-size: 0.7rem;
}

.type-chart td {
    width: 2.6rem;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0;
    vertical-align: middle;
    font-weight: 700;
    cursor: default;
}

/* 記号で区別し、色は控えめな補助にする */
.type-weak {
    background: rgba(220, 53, 69, 0.18) !important;
    color: #c81e2f;
}

.type-resist {
    background: rgba(13, 110, 253, 0.14) !important;
    color: #0a58ca;
}

.type-immune {
    background: rgba(108, 117, 125, 0.35) !important;
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .type-weak {
    color: #ff8a95;
}

[data-bs-theme="dark"] .type-resist {
    color: #8fb8ff;
}

.type-chart .type-hover {
    outline: 2px solid #f0b400;
    outline-offset: -2px;
}

.type-chart-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}

.type-chart-main {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.matchup-panel {
    flex: 1 1 320px;
    min-width: 0;
}

.matchup-list {
    list-style: none;
    padding: 0;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--app-card-border);
    border-radius: 0.25rem;
}

.matchup-list li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}

.matchup-list li + li {
    border-top: 1px solid var(--app-card-border);
}

.type-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
}

.type-mark {
    display: inline-block;
    width: 1.6rem;
    height: 1.6rem;
    line-height: 1.6rem;
    text-align: center;
    font-weight: 700;
    border: 1px solid var(--app-card-border);
    border-radius: 0.25rem;
    margin-right: 0.25rem;
}

.type-icon {
    width: 32px;
    height: 32px;
    vertical-align: middle;
}

.type-icon-sm {
    width: 26px;
    height: 26px;
}

.type-icons {
    display: inline-flex;
    gap: 2px;
    align-items: center;
    margin-left: 0.25rem;
}

/* ---- ポケモンの画像 ---- */
.poke-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    vertical-align: middle;
    image-rendering: pixelated;
}

.poke-icon-sm {
    width: 44px;
    height: 44px;
}

.poke-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* ---- ヘルプ（Excel のコメント風） ---- */
.help-wrap {
    position: relative;
    display: inline-block;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.help-btn {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    border: 1px solid var(--app-input-border);
    background: var(--bs-body-bg);
    color: var(--app-muted);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.help-btn:hover {
    background: var(--bs-tertiary-bg);
}

.help-note {
    position: absolute;
    left: 1.4rem;
    top: -0.4rem;
    z-index: 1100;
    width: 18rem;
    max-width: 80vw;
    padding: 0.5rem 1.4rem 0.5rem 0.6rem;
    background: var(--app-note-bg);
    border: 1px solid var(--app-note-border);
    border-radius: 0.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-body-color);
    white-space: normal;
    text-align: left;
}

.help-note::before {
    content: "";
    position: absolute;
    left: -0.5rem;
    top: 0.5rem;
    border: 0.25rem solid transparent;
    border-right-color: var(--app-note-border);
}

.help-close {
    position: absolute;
    right: 0.25rem;
    top: 0.15rem;
    border: none;
    background: transparent;
    color: var(--app-muted);
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}

/* ---- 全体の見やすさ ---- */
.content {
    max-width: 1280px;
}

.page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--app-card-border);
}

.page-header h1,
.page-header h3 {
    margin-bottom: 0.25rem;
}

.card {
    border: 1px solid var(--app-card-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-header {
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--app-card-border);
}

.card-header h5,
.card-header h6 {
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 600;
}

.form-group label,
.form-label,
.side-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin-bottom: 0.2rem;
}

.form-group {
    margin-bottom: 0.75rem !important;
}

.stats-summary {
    font-size: 0.9rem;
    line-height: 1.6;
    background: var(--app-panel-bg);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
}

.result-card {
    border-left: 4px solid #1b6ec2;
}

.result-main {
    font-size: 1.6rem;
    line-height: 1.3;
}

.result-main .badge {
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-sm td,
.table-sm th {
    vertical-align: middle;
}

.chat-output {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

.cmd-table code {
    white-space: nowrap;
}

.cmd-example {
    font-size: 0.8rem;
    color: var(--app-muted);
}

.text-muted {
    color: var(--app-muted) !important;
}

@media (max-width: 767.98px) {
    .result-main {
        font-size: 1.25rem;
    }
}

/* ---- サイドバー（テーマに関係なく濃い背景なので文字は明るくする） ---- */
.sidebar .side-settings {
    position: relative;
    color: #f1f3f5;
}

.sidebar .side-label {
    color: #f1f3f5;
}

.sidebar .side-note {
    font-size: 0.75rem;
    color: rgba(241, 243, 245, 0.8);
    margin-top: 0.25rem;
    line-height: 1.3;
}

.sidebar .help-btn {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.6);
    color: #f1f3f5;
}

.sidebar .help-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* サイドバー内の吹き出しはサイドバーの幅に収める（横にはみ出すと切れるため） */
.sidebar .help-wrap {
    position: static;
}

.sidebar .help-note {
    left: 0.75rem;
    right: 0.75rem;
    top: auto;
    width: auto;
    margin-top: 0.4rem;
}

.sidebar .help-note::before {
    display: none;
}

.sidebar .form-select {
    border-color: rgba(255, 255, 255, 0.5);
}

/* ---- 素早さ比較 ---- */
.speed-vs {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
}

.speed-value {
    font-size: 1.8rem;
    font-weight: 700;
}
