/* ========================================
   World Map Tool - Digital Gene Style
   ======================================== */

/* CSS Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gradient-start: #0feeb4;
    --gradient-end: #0372d8;
    --text-primary: #3f4a4f;
    --text-secondary: #495057;
    --text-white: #ffffff;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-page: #f5f7fa;
    --border-light: #e9ecef;
    --border-medium: #dee2e6;
    --accent-blue: #3498db;
    --accent-blue-dark: #2980b9;
    --accent-green: #28a745;
    --accent-green-dark: #218838;
    --accent-red: #dc3545;
    --accent-red-dark: #c82333;
    --border-radius: 6px;
    --container-width: 1400px;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, メイリオ, Meiryo, sans-serif;
    /* 吹き出しの文字サイズ */
    --bubble-title-size: 14px;
    --bubble-desc-size: 12px;
}

/* 初期状態でコンテンツを非表示（用紙の向きダイアログ表示中） */
.main-content-hidden {
    display: none !important;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-page);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* ========================================
   Title Banner (Digital Gene Style)
   Full width, outside container
   ======================================== */
.title-banner {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    padding: 50px 30px;
    text-align: center;
    width: 100%;
}

.title-banner h2 {
    color: var(--text-white);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.title-banner p {
    color: var(--text-white);
    font-size: 16px;
    opacity: 0.9;
}

/* ========================================
   Container
   ======================================== */
.container {
    max-width: var(--container-width);
    margin: 20px auto 20px auto;
    background: var(--bg-white);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Controls
   ======================================== */
.controls {
    padding: 15px 25px;
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-light);
    border-radius: 15px 15px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
}

.control-section {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-white);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    flex: 1;
    min-width: 300px;
}

/* タブレットサイズでコントロールセクションの幅を調整 */
@media (min-width: 768px) and (max-width: 1200px) {
    .control-section {
        flex: 0 1 auto;
        max-width: 500px;
    }
    
    .control-section:first-of-type {
        max-width: 450px;
    }
    
    .control-section-right {
        flex-shrink: 0;
    }
}

.control-section-label {
    width: 100%;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.control-group input[type="color"] {
    width: 36px;
    height: 28px;
    min-height: 28px;
    border: 2px solid var(--border-medium);
    border-radius: 5px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
    padding: 0;
    box-sizing: border-box;
}

.control-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 3px;
}

.control-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.control-group input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

.control-group input[type="color"]:focus,
.control-group input[type="color"]:active {
    height: 28px;
    min-height: 28px;
    outline: none;
}

.control-group select {
    padding: 6px 12px;
    border: 2px solid var(--border-medium);
    border-radius: 5px;
    font-size: 13px;
    background: var(--bg-white);
    cursor: pointer;
}

.control-group input[type="text"] {
    padding: 6px 12px;
    border: 2px solid var(--border-medium);
    border-radius: 5px;
    font-size: 13px;
    width: 180px;
}

.control-group-vertical {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.control-group-vertical label {
    margin-bottom: 0;
}

.control-group-vertical select {
    min-width: 120px;
}

.control-group-bulk-add {
    flex-wrap: wrap;
    margin-top: 4px;
}

.control-group-bulk-add .btn-secondary {
    font-size: 12px;
    padding: 6px 12px;
}

.control-group-bulk-buttons {
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.control-group-bulk-buttons .btn-bulk-action {
    font-size: 12px;
    padding: 5px 10px;
}

/* ========================================
   Color Presets（一括設定・吹き出し共通: プリセットは○、カスタム色は□）
   ======================================== */
.color-presets {
    display: flex;
    gap: 5px;
    align-items: center;
}

.color-preset {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-preset:hover {
    transform: scale(1.1);
}

.color-preset.selected {
    border-color: #333;
}


/* ========================================
   Buttons
   ======================================== */
button {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-blue);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--accent-blue-dark);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-green);
    color: var(--text-white);
}

.btn-success:hover {
    background: var(--accent-green-dark);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--accent-red);
    color: var(--text-white);
}

.btn-danger:hover {
    background: var(--accent-red-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--border-light);
    border-color: var(--border-medium);
}

.btn-large {
    padding: 12px 30px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* ========================================
   Download Icon
   ======================================== */
.icon-download {
    display: inline-block;
    width: 20px;
    height: 20px;
    position: relative;
}

.icon-download::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 12px;
    background: currentColor;
}

.icon-download .arrow {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-top: none;
    border-left: none;
}

.icon-download::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 20px;
    height: 6px;
    border: 2px solid currentColor;
    border-top: none;
    border-radius: 0 0 3px 3px;
    box-sizing: border-box;
}

/* ========================================
   Export Area
   ======================================== */
.export-area {
    padding: 20px 25px 30px 25px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 15px 15px;
    text-align: center;
}

/* ========================================
   Selected Countries List
   ======================================== */
.selected-countries {
    padding: 10px 25px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: none;
}

.selected-countries.active {
    display: block;
}

.selected-countries h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-light);
    border-radius: 5px;
    font-size: 12px;
}

.selected-item .color-dot {
    border-radius: 3px;
    cursor: default;
    border: 1px solid #ccc;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* スマートフォンでタップしやすくする */
@media (max-width: 768px) {
    .selected-item .color-dot {
        min-width: 24px;
        min-height: 24px;
        width: 24px;
        height: 24px;
    }
}

.selected-item .color-dot.has-pattern {
    width: 50px;
    height: 25px;
}

.selected-item .color-dot svg {
    width: 100%;
    height: 100%;
    display: block;
}

.selected-item .country-name {
    font-weight: 500;
}

.selected-item .remove-btn {
    cursor: pointer;
    color: var(--accent-red);
    font-weight: bold;
    margin-left: 4px;
}

.selected-item .remove-btn:hover {
    color: #a71d2a;
}

/* ========================================
   Map Container
   ======================================== */
.map-container {
    padding: 20px;
    background: var(--bg-white);
    position: relative;
    overflow: visible;
}

#mapWrapper {
    position: relative;
    width: 100%;
    /* 縦横比はJavaScriptで動的に設定される */
    overflow: visible;
}

#worldMap {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#worldMap:active {
    cursor: grabbing;
}

#worldMap .zoom-group {
    pointer-events: all;
}

#worldMap .country {
    fill: #e9ecef;
    stroke: none;
    cursor: pointer;
    transition: fill 0.2s;
    pointer-events: all;
}

#worldMap .country:hover {
    filter: brightness(0.95);
}

#worldMap .country.selected {
    /* 選択時も境界線は描画しない（二重線防止） */
}

#worldMap .boundary {
    fill: none;
    stroke: #fff;
    stroke-width: 0.5;
    pointer-events: none;
}

/* 選択した国の輪郭を表示するレイヤー */
#worldMap .selection-outline {
    fill: none;
    stroke: #333;
    stroke-width: 0.5;
    pointer-events: none;
}

/* ========================================
   Annotations
   ======================================== */
.annotation-line {
    stroke: #333;
    stroke-width: 2;
    fill: none;
}

.annotation-bubble {
    background: var(--bg-white);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: move;
    min-width: 120px;
    max-width: 250px;
    position: absolute;
    z-index: 100;
    /* タッチ操作を改善 */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.annotation-bubble h4 {
    margin: 0 0 5px 0;
    font-size: var(--bubble-title-size, 14px);
    color: #333;
}

.annotation-bubble p {
    margin: 0;
    font-size: var(--bubble-desc-size, 12px);
    color: #666;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 説明文が空のときは上下の余白を均等に */
.annotation-bubble:has(p:empty) h4 {
    margin-bottom: 0;
}

.annotation-bubble p:empty {
    margin: 0;
    padding: 0;
    line-height: 0;
    height: 0;
    overflow: hidden;
    min-height: 0;
}

/* 吹き出し編集モード（色プリセットを1行に収めるため幅を広め） */
.annotation-bubble.editing {
    cursor: default;
    min-width: 300px;
    max-width: 320px;
    touch-action: auto;
}

.annotation-bubble .edit-close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #666;
    color: white;
    border: 2px solid white;
    font-size: 18px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    line-height: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: background 0.2s;
    padding: 0;
    padding-bottom: 2px;
}

.annotation-bubble .edit-close-btn:hover {
    background: #444;
}

.annotation-bubble .edit-title-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.annotation-bubble .edit-title-row .edit-title {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.annotation-bubble .edit-title-quick-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.annotation-bubble .edit-btn-pref,
.annotation-bubble .edit-btn-capital {
    padding: 4px 6px;
    font-size: 10px;
    white-space: nowrap;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    background: var(--bg-white);
    cursor: pointer;
    font-weight: 500;
}

.annotation-bubble .edit-btn-pref:hover,
.annotation-bubble .edit-btn-capital:hover {
    background: var(--bg-light);
}

.annotation-bubble .edit-title {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.annotation-bubble .edit-desc {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-size: 12px;
    resize: vertical;
    min-height: 60px;
    max-height: 200px;
    margin-bottom: 2px;
    box-sizing: border-box;
    font-family: inherit;
}

.annotation-bubble .edit-hint {
    font-size: 9px;
    color: #999;
    margin-top: 0;
    margin-bottom: 8px;
}

.annotation-bubble .edit-style-section {
    margin-bottom: 12px;
    padding: 8px;
    background: var(--bg-light);
    border-radius: 4px;
}

.annotation-bubble .edit-style-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.annotation-bubble .edit-style-row:last-child {
    margin-bottom: 0;
}

.annotation-bubble .edit-style-row label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
}

.annotation-bubble .edit-color-presets {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.annotation-bubble .edit-color-preset {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.annotation-bubble .edit-color-preset:hover {
    transform: scale(1.1);
}

.annotation-bubble .edit-color-preset.selected {
    border-color: #333;
}

.annotation-bubble .edit-color-picker {
    width: 24px;
    height: 20px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

.annotation-bubble .edit-style-row-left {
    align-items: flex-start;
}

.annotation-bubble .edit-style-row-left .edit-pattern-select {
    flex: 0 1 auto;
    min-width: 140px;
}

.annotation-bubble .edit-pattern-select {
    padding: 4px 8px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-size: 11px;
    background: var(--bg-white);
    cursor: pointer;
    text-align: left;
}

.annotation-bubble .edit-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.annotation-bubble .edit-buttons button {
    padding: 8px 16px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    min-width: 60px;
    min-height: 36px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.annotation-bubble .edit-save {
    background: var(--accent-green);
    color: var(--text-white);
}

.annotation-bubble .edit-save:hover,
.annotation-bubble .edit-save:active {
    background: var(--accent-green-dark);
}

.annotation-bubble .edit-cancel {
    background: #6c757d;
    color: var(--text-white);
}

.annotation-bubble .edit-cancel:hover,
.annotation-bubble .edit-cancel:active {
    background: #5a6268;
}

.annotation-bubble .edit-delete {
    background: var(--accent-red);
    color: var(--text-white);
}

.annotation-bubble .edit-delete:hover,
.annotation-bubble .edit-delete:active {
    background: var(--accent-red-dark);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    padding: 15px 25px;
    background: var(--bg-light);
    border-radius: 0 0 15px 15px;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
}

.footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ========================================
   Loading & Error
   ======================================== */
.loading {
    text-align: center;
    padding: 50px;
    color: #6c757d;
}

.error-message {
    text-align: center;
    padding: 30px;
    color: var(--accent-red);
    background: #f8d7da;
    border-radius: 8px;
    margin: 20px;
}

/* ========================================
   Color Picker Popup
   ======================================== */
.color-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
}

.color-picker-overlay.active {
    display: block;
}

.color-picker-popup {
    position: absolute;
    background: var(--bg-white);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    min-width: 200px;
}

.color-picker-popup.active {
    display: block;
}

/* スマートフォン向けスタイル */
@media (max-width: 768px) {
    .color-picker-popup {
        width: 90%;
        max-width: 300px;
        padding: 20px;
    }
}

.color-picker-popup .preset-colors {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.color-picker-popup .preset-color {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.color-picker-popup .preset-color:hover,
.color-picker-popup .preset-color:active {
    border-color: #333;
}

/* スマートフォン向けスタイル */
@media (max-width: 768px) {
    .color-picker-popup .preset-color {
        width: 40px;
        height: 40px;
    }
}

.color-picker-popup input[type="color"] {
    width: 100%;
    height: 40px;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
    padding: 0;
    box-sizing: border-box;
}

.color-picker-popup input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 4px;
}

.color-picker-popup input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-picker-popup input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

/* ========================================
   Help Dialog
   ======================================== */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.help-overlay.active {
    display: flex;
}

.help-dialog {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10001;
    margin: 20px;
    text-align: left;
}

.help-dialog h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 24px;
    border-bottom: 2px solid var(--accent-blue);
    padding-bottom: 10px;
}

.help-dialog h3 {
    margin-top: 25px;
    margin-bottom: 12px;
    color: #34495e;
    font-size: 18px;
}

.help-dialog p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

.help-dialog ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-dialog li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #555;
}

.help-dialog .close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e74c3c;
    color: var(--text-white);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.help-dialog .close-button:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.help-dialog a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.help-dialog a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .help-dialog {
        max-width: 95%;
        padding: 20px;
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 600px) {
    .title-banner {
        padding: 40px 20px;
    }

    .title-banner h2 {
        font-size: 24px;
    }

    .title-banner p {
        font-size: 14px;
    }

    .controls {
        border-radius: 0;
    }

    .container {
        margin: 0;
        border-radius: 0;
    }
}

/* ========================================
   Initial Setup Modal
   ======================================== */
.setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.setup-dialog {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.setup-dialog h2 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}

.setup-dialog > p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 30px;
    text-align: center;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.setup-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setup-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.setup-group .button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.setup-btn {
    flex: 1;
    min-width: 120px;
    padding: 14px 20px;
    border: 2px solid var(--border-medium);
    border-radius: var(--border-radius);
    background-color: var(--bg-white);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

/* 用紙向きボタン：アイコン＋テキスト */
.button-group-orientation .setup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.button-group-orientation .orientation-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.button-group-orientation .orientation-icon svg {
    display: block;
}

.setup-btn:hover {
    background-color: #f0f0f0;
    border-color: var(--accent-blue);
}

.setup-btn.active {
    background-color: var(--accent-blue);
    color: var(--text-white);
    border-color: var(--accent-blue);
}

.setup-form .btn-success {
    margin-top: 10px;
    width: 100%;
    justify-content: center;
}

/* ダウンロードダイアログのボタン配置 */
.setup-buttons {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.setup-buttons .btn-secondary {
    flex: 0 0 auto;
    padding: 12px 24px;
}

.setup-buttons .btn-success {
    flex: 1;
    margin-top: 0;
    justify-content: center;
}

/* ボタンの縦並び */
.button-group-vertical {
    flex-direction: column;
}

.button-group-vertical .setup-btn {
    text-align: center;
    justify-content: center;
}

@media (max-width: 600px) {
    .setup-dialog {
        padding: 25px 20px;
    }

    .setup-dialog h2 {
        font-size: 22px;
    }

    .setup-group .button-group {
        flex-direction: column;
    }

    .setup-btn {
        min-width: auto;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .controls,
    .title-banner,
    .footer,
    .selected-countries,
    .export-area {
        display: none;
    }

    body {
        background: var(--bg-white);
        padding: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
        margin: 0;
    }
}
