/* ==========================================================================
   資優民主國 (Democratic Meritocracy of Ziyu) - 現代主權國家風格設計系統
   ========================================================================== */

:root {
    --primary-900: #071326;
    --primary-800: #0c1f38;
    --primary-700: #132e52;
    --primary-600: #1b3d6c;
    --primary-500: #2563eb;
    
    --accent-gold: #d4af37;
    --accent-gold-light: #fef3c7;
    --accent-gold-dark: #b45309;
    --accent-amber: #f59e0b;
    
    --status-red: #ef4444;
    --status-red-light: #fee2e2;
    --status-green: #10b981;
    --status-green-light: #d1fae5;
    --status-blue: #0284c7;
    
    --bg-base: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-subtle: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;
    
    --border-color: #e2e8f0;
    --border-highlight: #cbd5e1;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --font-serif: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
}

/* Reset & Base Setup */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    line-height: 1.65;
    color: var(--text-primary);
    background-color: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header & Sovereign Heraldry
   ========================================================================== */
header {
    background: radial-gradient(circle at 50% 20%, #173862 0%, #0c1f38 60%, #071326 100%);
    color: var(--text-inverse);
    padding: 3.5rem 1.5rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 3px solid var(--accent-gold);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(rgba(212, 175, 55, 0.12) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: 0 0, 16px 16px;
    pointer-events: none;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.state-emblem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.05));
    border: 2px solid var(--accent-gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.state-emblem svg {
    width: 38px;
    height: 38px;
    fill: var(--accent-gold);
}

.header-content h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
}

.header-sub-en {
    font-family: var(--font-serif);
    font-size: 1rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.motto-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    padding: 0.4rem 1.25rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(212, 175, 55, 0.3);
    font-size: 0.95rem;
    color: #e2e8f0;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
nav {
    background: rgba(12, 31, 56, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.nav-brand span {
    color: var(--accent-gold);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
}

.nav-links li a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.42rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.nav-links li a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.nav-links li a.nav-special {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.05));
    border: 1px solid var(--accent-gold);
    color: #fef3c7;
    font-weight: 600;
    padding: 0.42rem 0.8rem;
    white-space: nowrap;
}

.nav-links li a.nav-special:hover {
    background: var(--accent-gold);
    color: #071326;
}

.nav-links li a.nav-cta-join {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff !important;
    font-weight: 700;
    border-radius: var(--radius-full);
    padding: 0.42rem 0.95rem;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
    border: 1px solid #34d399;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.nav-links li a.nav-cta-join:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.55);
}

.nav-links li a.nav-cta-diplomacy {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff !important;
    font-weight: 700;
    border-radius: var(--radius-full);
    padding: 0.42rem 0.95rem;
    box-shadow: 0 2px 10px rgba(217, 119, 6, 0.4);
    border: 1px solid #fde047;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.nav-links li a.nav-cta-diplomacy:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.55);
}

/* 獨立分開的網站編輯按鈕區塊 */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 0.75rem;
    flex-shrink: 0;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.22);
}

.nav-edit-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff !important;
    border: 1px solid #93c5fd;
    border-radius: var(--radius-full);
    padding: 0.42rem 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
    transition: all 0.25s ease;
}

.nav-edit-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5);
}

.nav-edit-btn.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #fca5a5;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.nav-links li a.nav-cta {
    background: var(--primary-500);
    color: white;
    font-weight: 600;
}

.nav-links li a.nav-cta:hover {
    background: #1d4ed8;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ==========================================================================
   Main Layout & Section Architecture
   ========================================================================== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.section {
    background: var(--bg-card);
    margin-bottom: 2.5rem;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    transition: box-shadow 0.3s ease;
}

.section:hover {
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 60px;
    height: 2px;
    background: var(--primary-500);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-900);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.section-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--bg-card-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

h2 {
    color: var(--primary-900);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 60px;
    height: 2px;
    background: var(--primary-500);
}

h3 {
    color: var(--primary-800);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1.5rem 0 1rem;
}

/* ==========================================================================
   Welcome & National Info Section
   ========================================================================== */
.intro-lead {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 860px;
    margin: 0 auto 2rem;
    text-align: center;
}

.national-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.info-item {
    background: var(--bg-card-subtle);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-600);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.info-item.gold {
    border-top-color: var(--accent-gold);
}

.info-item.red {
    border-top-color: var(--status-red);
}

.info-item.green {
    border-top-color: var(--status-green);
}

.info-item-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.info-item h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin: 0 0 0.4rem;
}

.info-item p {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-900);
}

.info-item .sub {
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.wiki-link {
    text-align: center;
    margin-top: 2rem;
}

.wiki-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #4c1d95;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.wiki-btn:hover {
    background: #3b0764;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   National Dashboard
   ========================================================================== */
.dashboard-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.75rem;
}

.dashboard-card {
    background: var(--bg-card-subtle);
    padding: 1.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.dashboard-card h3 {
    margin-top: 0;
    font-size: 1.15rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--status-red-light);
    color: #991b1b;
    border: 1px solid #fca5a5;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.9rem;
}

.status-badge.status-peace {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--status-red);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
    animation: pulse 1.8s infinite;
}

.status-dot-green {
    width: 10px;
    height: 10px;
    background: var(--status-green);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
    animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
    0% { transform: scale(0.95); opacity: 0.85; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.85; }
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.status-box {
    background: white;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.status-box-val {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--primary-700);
    white-space: nowrap;
    line-height: 1.2;
}

.status-box-lbl {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 確保各類前往系統與操作按鈕排成優雅俐落單行 */
.btn-singleline {
    white-space: nowrap !important;
    text-overflow: ellipsis;
    overflow: hidden;
    justify-content: center;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.stat-value {
    font-weight: 700;
    color: var(--primary-900);
    font-feature-settings: "tnum";
}

.recent-events {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.event-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    gap: 0.75rem;
    font-size: 0.9rem;
}

.event-date {
    font-weight: 700;
    color: var(--primary-600);
    background: #e0f2fe;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    font-family: var(--font-mono);
}

.event-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* ==========================================================================
   Timeline / History
   ========================================================================== */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-left: 1rem;
    border-left: 2px solid var(--primary-500);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.45rem;
    top: 0.2rem;
    width: 14px;
    height: 14px;
    background: var(--bg-card);
    border: 3px solid var(--primary-500);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-card {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-date {
    font-weight: 700;
    color: var(--primary-700);
    background: #dbeafe;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.timeline-event {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-900);
}

.timeline-details ul {
    list-style: none;
    margin-top: 0.5rem;
}

.timeline-details li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.timeline-details li::before {
    content: '▪';
    position: absolute;
    left: 0;
    color: var(--primary-500);
    font-size: 1rem;
    line-height: 1.5;
}

/* ==========================================================================
   Constitution Section
   ========================================================================== */
.constitution {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.chapter {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
}

.chapter-title {
    color: var(--primary-900);
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid rgba(19, 46, 82, 0.1);
}

.chapter-title span {
    color: var(--primary-500);
}

.articles-grid {
    display: grid;
    gap: 1rem;
}

.article {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.article h4 {
    color: var(--primary-700);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.article p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.article p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Laws & Search Filter
   ========================================================================== */
.law-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.law-search {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: white;
    outline: none;
    transition: border-color 0.2s;
}

.law-search:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.law-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cat-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.cat-btn.active, .cat-btn:hover {
    background: var(--primary-700);
    color: white;
    border-color: var(--primary-700);
}

.laws-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.law-card {
    background: white;
    padding: 1.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--status-red);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
}

.law-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.law-tag {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.tag-defense { background: #fee2e2; color: #b91c1c; }
.tag-involution { background: #fef3c7; color: #92400e; }
.tag-morality { background: #e0e7ff; color: #4338ca; }
.tag-education { background: #d1fae5; color: #065f46; }

.law-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    color: var(--primary-900);
}

.law-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.view-law {
    background: var(--primary-700);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
    width: 100%;
}

.view-law:hover {
    background: var(--primary-600);
}

/* ==========================================================================
   Government Structure
   ========================================================================== */
.government-structure {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.position-card {
    background: var(--bg-card-subtle);
    padding: 1.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-600);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.position-card:hover {
    transform: translateY(-2px);
}

.position-card.executive { border-top-color: var(--accent-gold); }
.position-card.legislative { border-top-color: var(--primary-500); }
.position-card.ministry { border-top-color: var(--status-blue); }

.position-card h3 {
    margin: 0 0 1rem;
    font-size: 1.15rem;
    color: var(--primary-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.position-list {
    list-style: none;
}

.position-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
}

.position-list li:last-child {
    border-bottom: none;
}

.position-list strong {
    color: var(--primary-800);
}

/* ==========================================================================
   Territory & Geography Section
   ========================================================================== */
.territory-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.map-container {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.map-container img, .map-container svg {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.territory-content h3 {
    margin-top: 0;
}

.territory-list {
    list-style: none;
    margin-top: 1rem;
}

.territory-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.territory-list li strong {
    color: var(--primary-800);
}

/* ==========================================================================
   Join & Identity Preview Section
   ========================================================================== */
.join-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2.5rem;
}

.join-intro h3 {
    margin-top: 0;
    color: var(--primary-900);
}

.join-benefits {
    background: var(--status-green-light);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid #a7f3d0;
    margin-top: 1.5rem;
}

.join-benefits h4 {
    color: #065f46;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.join-benefits ul {
    list-style: none;
}

.join-benefits li {
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.4rem;
    color: #064e3b;
    font-size: 0.95rem;
}

.join-benefits li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--status-green);
    font-weight: bold;
}

.join-documents {
    background: #fef3c7;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid #fde68a;
    margin-top: 1.5rem;
}

.join-documents h4 {
    color: #92400e;
    margin-bottom: 0.75rem;
}

.join-documents p {
    color: #78350f;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.join-form-card {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-md);
    border: 2px solid #86efac;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.15);
    position: relative;
}

.join-featured-badge {
    position: absolute;
    top: -14px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 0.3rem 1rem;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.35);
    letter-spacing: 0.5px;
}

.section-featured-join {
    border: 2px solid #34d399 !important;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.12) !important;
    background: linear-gradient(180deg, #ffffff 0%, #f7fee7 100%) !important;
}

.join-announcement-banner {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 1px solid #86efac;
    border-radius: var(--radius-md);
    padding: 1.1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #065f46;
    font-weight: 700;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.hero-join-cta-wrap {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.75rem;
}

.hero-join-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
    padding: 0.85rem 1.85rem;
    border-radius: var(--radius-full);
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    border: 1px solid #34d399;
    transition: all 0.25s ease;
    letter-spacing: 0.5px;
}

.hero-join-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.55);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.hero-diplomacy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff !important;
    padding: 0.85rem 1.85rem;
    border-radius: var(--radius-full);
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(217, 119, 6, 0.4);
    border: 1px solid #fde047;
    transition: all 0.25s ease;
    letter-spacing: 0.5px;
}

.hero-diplomacy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.55);
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.join-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white !important;
    padding: 1.1rem 2rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
    width: 100%;
    max-width: 320px;
    letter-spacing: 0.5px;
}

.join-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(16, 185, 129, 0.5);
}

.join-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: white;
    color: var(--primary-700);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.75rem;
    width: 100%;
    max-width: 280px;
    transition: all 0.2s ease;
}

.join-secondary-btn:hover {
    background: var(--bg-card-subtle);
    border-color: var(--primary-600);
}

.join-note {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Identity Artwork Showcase */
.id-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.id-preview-box {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.id-preview-box h4 {
    margin-bottom: 1rem;
    color: var(--primary-800);
    font-size: 1rem;
}

.id-preview-box img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.id-preview-box img:hover {
    transform: scale(1.02);
}

/* ==========================================================================
   Diplomacy
   ========================================================================== */
.section-featured-diplomacy {
    border: 2px solid #f59e0b !important;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15) !important;
    background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%) !important;
}

.diplomacy-announcement-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-md);
    padding: 1.1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #92400e;
    font-weight: 700;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}

.diplomacy-container {
    background: linear-gradient(135deg, #07172c, #0f2c52);
    color: white;
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 12px 28px rgba(7, 23, 44, 0.35);
}

.diplomacy-intro {
    max-width: 680px;
    margin: 0 auto 2rem;
}

.diplomacy-intro h3 {
    color: var(--accent-gold);
    font-size: 1.85rem;
    margin-top: 0;
}

.diplomacy-intro p {
    color: #cbd5e1;
    font-size: 1.1rem;
    line-height: 1.8;
}

.diplomacy-principles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    max-width: 860px;
    margin: 2rem auto;
    text-align: left;
}

.prin-card {
    background: rgba(255, 255, 255, 0.07);
    padding: 1.25rem 1.4rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent-gold);
    transition: transform 0.2s ease, background 0.2s ease;
}

.prin-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.prin-card h4 {
    color: var(--accent-gold);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.prin-card p {
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.6;
}

.diplomacy-cta-wrap {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2.2rem;
}

.diplomacy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #071326 !important;
    padding: 1.1rem 2.2rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 800;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    transition: all 0.2s ease;
    border: 1px solid #fef08a;
    letter-spacing: 0.5px;
}

.diplomacy-btn:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.55);
}

.diplomacy-guide-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fef08a !important;
    border: 1px solid rgba(254, 240, 138, 0.4);
    padding: 1.1rem 1.8rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.diplomacy-guide-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fef08a;
    transform: translateY(-2px);
}

/* ==========================================================================
   Live Site Editor Bar & Visual Editing Modes
   ========================================================================== */
body.site-editing-active {
    padding-bottom: 75px !important;
}

body.site-editing-active [data-site-editable] {
    outline: 2px dashed #3b82f6 !important;
    outline-offset: 3px !important;
    cursor: text !important;
    transition: background-color 0.2s ease;
    position: relative;
    border-radius: 4px;
}

body.site-editing-active [data-site-editable]:hover {
    background-color: rgba(59, 130, 246, 0.12) !important;
}

body.site-editing-active [data-site-editable]:focus {
    outline: 2px solid #2563eb !important;
    background-color: rgba(59, 130, 246, 0.18) !important;
}

.site-editor-bar {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    border: 2px solid #3b82f6;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-full);
    padding: 0.6rem 1.4rem;
    display: none;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    animation: editorBarSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-editor-bar.active {
    display: flex;
}

@keyframes editorBarSlideUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.editor-bar-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #60a5fa;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.editor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    animation: editorPulse 1.5s infinite;
}

@keyframes editorPulse {
    0% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.4; transform: scale(0.8); }
}

.editor-btn {
    border: none;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.editor-btn-save {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.editor-btn-save:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.editor-btn-settings {
    background: #3b82f6;
    color: white;
}

.editor-btn-settings:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.editor-btn-reset {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.editor-btn-reset:hover {
    background: #ef4444;
    color: white;
}

.editor-btn-close {
    background: rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}

.editor-btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Site Editor Modal */
.site-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.site-modal.active {
    display: flex;
}

.site-modal-card {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 2rem;
    position: relative;
    animation: modalIn 0.25s ease-out;
}

.auth-modal-card {
    max-width: 480px;
    padding: 2.25rem 2rem;
    border-radius: var(--radius-md);
}

.password-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-key-input {
    width: 100%;
    padding: 0.75rem 2.75rem 0.75rem 1rem;
    font-size: 1.05rem;
    letter-spacing: 1px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
}

.auth-key-input:focus {
    border-color: var(--primary-600);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.pwd-toggle-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 6px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.pwd-toggle-btn:hover {
    color: var(--primary-700);
}

.auth-error-text {
    margin-top: 0.5rem;
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 600;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.site-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.site-modal-header h3 {
    margin: 0;
    color: var(--primary-900);
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-modal-close {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    line-height: 1;
}

.site-modal-close:hover {
    color: var(--primary-900);
}

.site-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.site-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.site-form-group.full-width {
    grid-column: 1 / -1;
}

.site-form-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.site-form-group input,
.site-form-group textarea,
.site-form-group select {
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #f8fafc;
    transition: border-color 0.2s;
}

.site-form-group input:focus,
.site-form-group textarea:focus,
.site-form-group select:focus {
    border-color: #3b82f6;
    background: white;
    outline: none;
}

.site-toast {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: white;
    border-left: 4px solid #10b981;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 100001;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    background: var(--primary-900);
    color: #94a3b8;
    padding: 3rem 1.5rem;
    border-top: 2px solid var(--primary-700);
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-brand {
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.footer-motto {
    color: var(--accent-gold);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    list-style: none;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

.footer-copy {
    font-size: 0.85rem;
    color: #64748b;
}

/* ==========================================================================
   Modal Dialogs & Interactive Law Viewer
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 19, 38, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 820px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(20px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    position: sticky;
    top: 0;
    background: white;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-tool-btn {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s;
}

.modal-tool-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--bg-card-subtle);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem 2.25rem;
}

.law-text h3 {
    color: var(--primary-900);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 0.4rem;
    border-bottom: 2px solid var(--accent-gold);
    padding-bottom: 0.5rem;
}

.law-date-tag {
    color: var(--primary-600);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
}

.law-articles p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1rem;
}

.law-articles strong {
    color: var(--primary-800);
    display: inline-block;
    margin-bottom: 0.25rem;
}

/* Floating Tools */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: var(--primary-700);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-600);
    transform: translateY(-2px);
}

/* Notification Toast */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-900);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1100;
    border-left: 4px solid var(--status-green);
    animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 360px;
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.notification-message {
    font-size: 0.95rem;
    font-weight: 500;
}

.notification-close {
    cursor: pointer;
    font-size: 1.2rem;
    color: #94a3b8;
}

.notification-close:hover {
    color: white;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 900px) {
    .join-container,
    .territory-grid,
    .id-showcase {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header {
        padding: 2.5rem 1rem 2rem;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-sub-en {
        font-size: 0.85rem;
        letter-spacing: 2px;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 1rem;
        gap: 0.5rem;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-container {
        flex-wrap: wrap;
    }

    .nav-actions {
        margin-left: auto;
        margin-right: 0.5rem;
    }

    .nav-divider {
        display: none;
    }

    .nav-edit-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }
    
    main {
        padding: 1.5rem 1rem 3rem;
    }
    
    .section {
        padding: 1.5rem;
    }
    
    .timeline {
        padding-left: 1.5rem;
        margin-left: 0.5rem;
    }
    
    .timeline-item::before {
        left: -1.95rem;
    }
}

/* ==========================================================================
   國家簡報與政府透明度專區 (National Briefing & D3.js Visualization)
   ========================================================================== */
.briefing-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.briefing-kpi-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.briefing-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.briefing-kpi-card.highlight {
    background: linear-gradient(135deg, #f8fafc 0%, #f0fdf4 100%);
    border-color: #86efac;
}

.briefing-kpi-card .kpi-icon {
    font-size: 2.2rem;
    line-height: 1;
    background: var(--bg-card-subtle);
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.briefing-kpi-card.highlight .kpi-icon {
    background: #dcfce7;
}

.briefing-kpi-card .kpi-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--primary-900);
    line-height: 1.1;
}

.briefing-kpi-card.highlight .kpi-value {
    color: #166534;
}

.briefing-kpi-card .kpi-unit {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.briefing-kpi-card .kpi-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

.briefing-kpi-card .kpi-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* 雙圖表展示容器 */
.briefing-charts-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .briefing-charts-layout {
        grid-template-columns: 1fr 1fr;
    }
}

.briefing-chart-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.chart-title-wrap h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-desc {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-pill-btn {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chart-pill-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.chart-pill-btn.active {
    background: var(--primary-900);
    color: white;
    border-color: var(--primary-900);
}

.badge-verified {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* D3 容器高寬限制 */
.d3-chart-wrapper {
    position: relative;
    width: 100%;
    min-height: 280px;
    flex-grow: 1;
}

.d3-chart-wrapper svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

/* 滿意度儀表板內部切分 */
.gauge-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: center;
    flex-grow: 1;
}

@media (min-width: 640px) {
    .gauge-dashboard-grid {
        grid-template-columns: 200px 1fr;
    }
}

.gauge-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.d3-gauge-wrapper {
    width: 180px;
    height: 140px;
}

.d3-gauge-wrapper svg {
    width: 100%;
    height: 100%;
}

.gauge-summary-text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.gauge-summary-text strong {
    font-size: 1.15rem;
    color: #166534;
}

.gauge-summary-text p {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.breakdown-col {
    width: 100%;
}

.breakdown-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.d3-bars-wrapper {
    width: 100%;
    min-height: 210px;
}

.chart-footer-note {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* D3 Tooltip 懸浮框 */
.d3-tooltip {
    position: absolute;
    padding: 0.65rem 0.9rem;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 50;
    transition: opacity 0.15s ease, transform 0.15s ease;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.15);
}

.d3-tooltip strong {
    color: #fde047;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.2rem;
}

/* 開放政府透明行動卡 */
.transparency-statement-box {
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: flex-start;
}

@media (min-width: 768px) {
    .transparency-statement-box {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.transparency-statement-box .statement-icon {
    font-size: 2.2rem;
    background: white;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbeafe;
    flex-shrink: 0;
}

.transparency-statement-box .statement-content {
    flex-grow: 1;
}

.transparency-statement-box h4 {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    color: #1e3a8a;
}

.transparency-statement-box p {
    margin: 0;
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.5;
}

.transparency-statement-box .statement-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.statement-btn {
    background: white;
    border: 1px solid #93c5fd;
    color: #1d4ed8;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.statement-btn:hover {
    background: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
}
