body {
    font-family: 'Marcellus', serif;
    background-color: #FDF6E3; /* Parchment fallback */
    color: #382D24; /* Dark Ink */
    /* Paper texture blended with base color */
    background-image: linear-gradient(#FDF6E3, #FDF6E3), url('../images/paper-texture.jpg');
    background-repeat: repeat;
    background-size: auto; /* scale tile to reduce repetition seams */
    background-blend-mode: multiply;
}

.britannia-map {
    width: 100%;
    min-height: 320px;
    height: clamp(320px, 60vw, 640px);
    border: 1px solid rgba(180, 140, 80, 0.5);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(56, 45, 36, 0.15);
}

.map-instructions a {
    color: #854D0E;
}

.leaflet-popup-content-wrapper {
    background: rgba(251, 242, 213, 0.95);
    border-radius: 0.5rem;
    border: 1px solid rgba(180, 140, 80, 0.4);
    font-family: 'Marcellus', serif;
}

.leaflet-popup-tip {
    background: rgba(251, 242, 213, 0.95);
    border: 1px solid rgba(180, 140, 80, 0.4);
}

.leaflet-popup-content {
    color: #382D24;
    margin: 0.5rem 0;
}

.britannia-add-marker-control {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(56, 45, 36, 0.28);
}

.britannia-add-marker-control button {
    display: block;
    border: none;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #1f2937;
    font-family: 'Marcellus', serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    min-width: 7.5rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.britannia-add-marker-control button:hover,
.britannia-add-marker-control button:focus {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    color: #111827;
}

.britannia-add-marker-control button.active,
.britannia-add-marker-control button[aria-pressed="true"] {
    background: linear-gradient(135deg, #10b981, #047857);
    color: #fdf6e3;
}

.britannia-map--adding {
    cursor: crosshair !important;
}

h1, h2, h3, h4 {
    font-family: 'IM Fell English', serif;
}

.tab-button {
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-button.active {
    border-bottom-color: #854D0E; /* Gold */
    color: #854D0E;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    height: 400px;
    max-height: 50vh;
}

.gemini-response {
    white-space: pre-wrap;
    background-color: #FBF1D3;
    border-left: 4px solid #D97706;
    border-radius: 0.25rem;
    margin-top: 1rem;
    font-family: 'Marcellus', serif;
}

.keyword-helper {
    position: absolute;
    max-width: 24rem;
    background: #FBF1D3;
    border: 1px solid #D97706;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 12px 24px rgba(56, 45, 36, 0.25);
    z-index: 30;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    opacity: 0;
    transform: translate(-50%, -0.5rem);
}

.keyword-helper.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.seer-tone-option,
.seer-spoiler-option {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    color: #92400e;
}

.seer-tone-option:hover,
.seer-tone-option:focus,
.seer-spoiler-option:hover,
.seer-spoiler-option:focus {
    border-color: #d97706;
    color: #78350f;
}

.seer-option-selected {
    background-color: rgba(248, 191, 85, 0.85) !important;
    border-color: #b45309 !important;
    color: #1f2937 !important;
    box-shadow: 0 6px 14px rgba(180, 83, 9, 0.25);
}

.keyword-helper h3 {
    margin-top: 0;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #854D0E;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin: 1rem auto;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.britannia-map-toolbar {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: rgba(251, 242, 213, 0.8);
    border: 1px solid rgba(180, 140, 80, 0.4);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    box-shadow: inset 0 1px 2px rgba(56, 45, 36, 0.08);
}

.britannia-map-toolbar__label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #92400e;
}

.britannia-map-toolbar__controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.britannia-map-toolbar__input {
    flex: 1;
    border: 1px solid rgba(180, 140, 80, 0.6);
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.92);
    color: #382d24;
    font-family: 'Marcellus', serif;
}

.britannia-map-toolbar__input:focus {
    outline: none;
    border-color: #d97706;
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.25);
}

.britannia-map-toolbar__clear {
    border: none;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #1f2937;
    padding: 0.55rem 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.britannia-map-toolbar__clear:hover,
.britannia-map-toolbar__clear:focus {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(217, 119, 6, 0.25);
}

.britannia-map-toolbar__hint {
    font-size: 0.75rem;
    color: rgba(146, 64, 14, 0.75);
}
