/* ==========================================
   最大ダメージ計算 - Dark Theme with Neon Accents
   参考デザイン（ezmegrcc）のトーン・角丸・グロー効果を踏襲
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary Colors */
    --primary: #ff006e;
    --primary-dark: #cc0058;
    --primary-light: #ff4d9d;

    /* Accent Colors */
    --success: #00ff88;
    --success-light: #34ffaa;
    --danger: #ff006e;
    --danger-light: #ff4d9d;
    --warning: #ffd700;
    --warning-light: #ffe54d;
    --info: #00d9ff;

    /* Background */
    --bg-white: #13131d;
    --bg-gray: #1a1a28;
    --bg-light: rgba(255, 255, 255, 0.05);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;

    /* Border */
    --border-light: rgba(255, 255, 255, 0.08);
    --border-gray: rgba(255, 255, 255, 0.15);

    /* Shadow */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);

    /* Glow */
    --shadow-glow-pink: 0 0 20px rgba(255, 0, 110, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(0, 217, 255, 0.3);
    --shadow-glow-green: 0 0 20px rgba(0, 255, 136, 0.3);
    --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.3);

    /* Gradient */
    --gradient-primary: linear-gradient(135deg, #ff006e 0%, #8b5cf6 50%, #00d9ff 100%);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    background: #0a0a0f;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 0, 110, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 217, 255, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 50% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: hidden;
}

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

/* Header */
header {
    background: rgba(19, 19, 29, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 30px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 10px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-glow-pink);
}

.app-icon svg {
    width: 26px;
    height: 26px;
}

header h1 {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

/* Main */
main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Card (共通) */
.card {
    background: var(--bg-white);
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0.6;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    text-align: center;
}

.section-icon {
    width: 24px;
    height: 24px;
    stroke: var(--primary);
    flex-shrink: 0;
}

.subsection-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 28px 0 8px;
    color: var(--text-primary);
    border-left: 4px solid var(--primary);
    padding-left: 10px;
}

.section-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.6;
}

.section-note strong {
    color: var(--warning);
    font-weight: 700;
}

.condition-caption {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--info);
    background: rgba(0, 217, 255, 0.08);
    border: 1px solid rgba(0, 217, 255, 0.25);
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 20px;
}

/* Form */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 8px;
}

.form-group {
    flex: 1 1 220px;
    min-width: 0;
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-group label .hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-light);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 0, 110, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-group select option {
    background: #13131d;
    color: #ffffff;
}

.readout-box {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--info);
    box-sizing: border-box;
}

/* Bonus Table */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
}

.bonus-table th,
.bonus-table td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.92rem;
    white-space: nowrap;
}

.bonus-table thead th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.85rem;
}

.bonus-table td.col-label,
.bonus-table th.col-label {
    text-align: left;
    color: var(--text-primary);
    font-weight: 600;
    white-space: normal;
}

.bonus-table tbody tr:last-child td {
    border-bottom: none;
}

.bonus-table tr.row-total td {
    background: rgba(255, 0, 110, 0.06);
    font-weight: 800;
    color: var(--text-primary);
    border-top: 2px solid var(--border-gray);
}

.bonus-table tr.row-editable td {
    background: rgba(255, 215, 0, 0.06);
}

.bonus-table tr.row-editable td.col-label::after {
    content: '（入力可）';
    display: inline-block;
    margin-left: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--warning);
}

.bonus-table input.cell-input {
    width: 88px;
    max-width: 100%;
    padding: 8px 6px;
    text-align: right;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
}

.bonus-table input.cell-input:focus {
    outline: none;
    border-color: var(--warning);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
}

.bonus-table td.static-value {
    color: var(--text-secondary);
}

/* Bonus table: inline toggle row (beacon others Lv50/Lv45) */
.bonus-table tr.row-toggle td {
    background: rgba(0, 217, 255, 0.05);
}

.row-label-with-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.toggle-switch-sm {
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch-sm .toggle-slider::before {
    height: 18px;
    width: 18px;
}

.toggle-switch-sm input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* Global Toggles */
.global-toggle-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.global-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-light);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    flex-wrap: nowrap;
}

.global-toggle-item .toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.global-toggle-item .toggle-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.global-toggle-item .toggle-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.global-toggle-item-active {
    border-color: var(--border-gray);
    background: rgba(255, 255, 255, 0.06);
}

.global-toggle-item-fixed .toggle-name {
    color: var(--text-primary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 58px;
    height: 32px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-gray);
    transition: 0.3s;
    border-radius: 18px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--gradient-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(26px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(255, 0, 110, 0.25);
}

/* Damage Result */
.damage-result-card {
    margin-top: 24px;
    padding: 28px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 0, 110, 0.08) 0%, rgba(139, 92, 246, 0.08) 50%, rgba(0, 217, 255, 0.08) 100%);
    border: 2px solid rgba(255, 0, 110, 0.3);
    border-radius: 16px;
}

.damage-result-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.damage-result-value {
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(255, 0, 110, 0.4);
    line-height: 1.2;
    word-break: break-all;
}

.damage-formula-note {
    margin-top: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Optimal Card */
.optimal-card {
    background: var(--bg-light);
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 22px;
}

.optimal-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--info);
    margin-bottom: 12px;
}

.optimal-card-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.optimal-stat-damage {
    grid-column: 1 / -1;
}

.optimal-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.optimal-stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.optimal-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
}

.optimal-stat-damage .optimal-stat-value {
    color: var(--primary);
    font-size: 1.4rem;
}

/* Equipment Grid (装備アイテム入力) */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}

.equip-card {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px 16px;
}

.equip-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.equip-card-title .equip-icon {
    width: 18px;
    height: 18px;
    stroke: var(--info);
    flex-shrink: 0;
}

.equip-slot-row {
    display: grid;
    grid-template-columns: 40px 1fr 90px;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border-light);
}

.equip-slot-row:last-child {
    border-bottom: none;
}

.equip-slot-no {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.equip-slot-row select.equip-type-select {
    width: 100%;
    padding: 8px 24px 8px 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.equip-slot-row select.equip-type-select:focus {
    outline: none;
    border-color: var(--primary);
}

.equip-slot-row input.equip-value-input {
    width: 100%;
    padding: 8px 8px;
    text-align: right;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}

.equip-slot-row input.equip-value-input:focus {
    outline: none;
    border-color: var(--warning);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
}

.equip-slot-row input.equip-value-input::placeholder {
    color: var(--text-muted);
}

.equip-slot-row .equip-value-disabled {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 8px 0;
}

/* Bonus table: auto-aggregated row (formerly manual refine row) */
.bonus-table tr.row-auto td {
    background: rgba(0, 217, 255, 0.06);
}

.bonus-table tr.row-auto td.col-label::after {
    content: '（装備入力から自動集計）';
    display: inline-block;
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--info);
}

/* Exchange Simulation Section */
.exchange-current-card {
    margin-top: 0;
    margin-bottom: 24px;
}

table.worst-table {
    min-width: 760px;
}

.worst-table th,
.worst-table td {
    padding: 11px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    white-space: nowrap;
}

.worst-table thead th {
    background: #1e1e2e;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.78rem;
}

.worst-table tbody tr.row-selected {
    background: rgba(255, 0, 110, 0.08);
}

.worst-table tbody tr.row-selected td {
    color: var(--text-primary);
    font-weight: 700;
}

.worst-table td.damage-col,
.worst-table td.contrib-col {
    color: var(--primary);
    font-weight: 700;
}

.worst-table td.contrib-zero {
    color: var(--text-muted);
    font-weight: 400;
}

.worst-radio {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.worst-table-wrapper {
    margin-bottom: 24px;
}

.exchange-sim-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.exchange-sim-card {
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exchange-sim-card.rank-1 {
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 0 0 16px rgba(0, 255, 136, 0.15);
}

.exchange-sim-card.rank-2 {
    border-color: rgba(0, 217, 255, 0.4);
}

.exchange-sim-card.rank-3 {
    border-color: rgba(255, 215, 0, 0.35);
}

.exchange-sim-card.custom-card {
    opacity: 0.6;
}

.exchange-sim-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.exchange-sim-custom-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.exchange-sim-custom-inputs select,
.exchange-sim-custom-inputs input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-family: inherit;
}

.exchange-sim-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.exchange-sim-row .value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.exchange-sim-row.damage .value {
    color: var(--primary);
}

.exchange-sim-row.increase .value.positive {
    color: var(--success);
}

.exchange-sim-row.increase .value.negative {
    color: var(--danger);
}

.exchange-sim-priority {
    text-align: center;
    margin-top: 4px;
    padding: 6px 0;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.exchange-sim-card.rank-1 .exchange-sim-priority {
    background: rgba(0, 255, 136, 0.15);
    color: var(--success);
}

.exchange-sim-card.rank-2 .exchange-sim-priority {
    background: rgba(0, 217, 255, 0.15);
    color: var(--info);
}

.exchange-sim-card.rank-3 .exchange-sim-priority {
    background: rgba(255, 215, 0, 0.15);
    color: var(--warning);
}

/* Pattern Table */
.pattern-table th,
.pattern-table td {
    padding: 11px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.86rem;
    white-space: nowrap;
}

.pattern-table thead th {
    background: #1e1e2e;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    text-align: right;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 2px solid var(--border-gray);
}

.pattern-table thead th:first-child,
.pattern-table td:first-child {
    text-align: center;
}

.pattern-table-wrapper {
    max-height: 520px;
    overflow-y: auto;
}

.pattern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.pattern-table tbody tr.row-rank-1 {
    background: rgba(0, 255, 136, 0.08);
}

.pattern-table tbody tr.row-rank-1 td {
    color: var(--success);
    font-weight: 700;
}

.pattern-table td.damage-col {
    color: var(--primary);
    font-weight: 700;
}

.pattern-table td.rank-col {
    font-weight: 700;
    color: var(--text-secondary);
}

/* Empty / Info message */
.empty-message {
    text-align: center;
    padding: 30px 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Footer */
footer {
    margin-top: 24px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-white);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    font-size: 0.85rem;
}

/* ===== Admin ===== */
.admin-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.admin-table thead th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow-pink);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-gray);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: rgba(255, 0, 110, 0.12);
    color: var(--danger);
    border: 2px solid rgba(255, 0, 110, 0.4);
}

.btn-danger:hover {
    background: rgba(255, 0, 110, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.admin-form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}

.admin-form-grid .form-group {
    flex: 1 1 160px;
    margin-bottom: 0;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 0;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-on {
    background: rgba(0, 255, 136, 0.15);
    color: var(--success);
}

.badge-off {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.admin-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.6;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 14px 22px;
    border-radius: 10px;
    background: var(--bg-gray);
    border: 2px solid var(--success);
    color: var(--success);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 999;
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
    body {
        padding: 12px;
    }

    header {
        padding: 16px 18px;
        border-radius: 12px;
    }

    header h1 {
        font-size: 1.15rem;
    }

    .app-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .app-icon svg {
        width: 20px;
        height: 20px;
    }

    .card {
        padding: 18px 14px;
        border-radius: 14px;
    }

    .section-title {
        font-size: 1.05rem;
    }

    .form-row {
        flex-direction: column;
        gap: 12px;
    }

    .global-toggle-item {
        padding: 12px;
        gap: 8px;
    }

    .global-toggle-item .toggle-name {
        font-size: 0.85rem;
    }

    .global-toggle-item .toggle-desc {
        font-size: 0.72rem;
    }

    .toggle-switch {
        width: 46px;
        height: 26px;
    }

    .toggle-slider::before {
        height: 18px;
        width: 18px;
    }

    .toggle-switch input:checked + .toggle-slider::before {
        transform: translateX(20px);
    }

    .form-group {
        flex: 1 1 auto;
    }

    .damage-result-value {
        font-size: 2rem;
    }

    .optimal-card-body {
        grid-template-columns: repeat(3, 1fr);
    }

    table {
        min-width: 420px;
    }

    .pattern-table-wrapper {
        max-height: 420px;
    }
}

@media (max-width: 420px) {
    .optimal-card-body {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .optimal-stat {
        padding: 8px 4px;
    }

    .optimal-stat-label {
        font-size: 0.68rem;
    }

    .optimal-stat-value {
        font-size: 1.1rem;
    }

    .damage-result-value {
        font-size: 1.7rem;
    }

    .global-toggle-item {
        flex-direction: row;
    }
}

@media (max-width: 720px) {
    .equip-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .exchange-sim-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .worst-table th,
    .worst-table td {
        padding: 8px 8px;
        font-size: 0.76rem;
    }

    table.worst-table {
        min-width: 640px;
    }
}

@media (max-width: 420px) {
    .exchange-sim-grid {
        grid-template-columns: 1fr;
    }

    .equip-slot-row {
        grid-template-columns: 34px 1fr 70px;
    }
}
