/* style.css - Medieval Parchment Theme for 1497 AD */

/* ===== Foundations ===== */

:root {
    --parchment: #f5e6c8;
    --parchment-dark: #e8d5a3;
    --parchment-deep: #d4bc82;
    --ink: #2c1810;
    --ink-light: #5c3a2a;
    --gold: #c9a227;
    --gold-bright: #e6b800;
    --gold-dim: #8b6914;
    --wood: #3e2723;
    --wood-light: #5d4037;
    --leather: #6d4c2f;
    --leather-light: #8d6e4a;
    --danger: #a33;
    --success: #4a7c3f;
    --warning: #b8860b;
    --panel-bg: linear-gradient(160deg, #f5e6c8 0%, #e8d5a3 50%, #dcc68e 100%);
    --panel-border: 2px solid var(--gold-dim);
    --panel-shadow: 0 3px 10px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
    --font-heading: 'Cinzel', 'Georgia', serif;
    --font-body: 'Crimson Text', 'Georgia', serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: clamp(14px, 0.9vw + 0.45vh, 24px);
    color: var(--ink);
    background-color: #1a1208;
    height: 100%;
}

h3, h4 {
    font-family: var(--font-heading);
    color: var(--wood);
    margin: 0 0 8px 0;
    letter-spacing: 0.5px;
}

/* ===== Game Container ===== */

#game-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    overflow: hidden;
}

/* Dim overlay so panels are readable over city backgrounds */
#game-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(20, 12, 5, 0.35);
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#game-container.city-fade::before {
    opacity: 1;
}

#game-container > * {
    position: relative;
    z-index: 1;
}

#player-stats {
    z-index: 10001;
    overflow: visible;
}

/* ===== Panels (parchment cards) ===== */

.panel {
    background: var(--panel-bg);
    border: var(--panel-border);
    border-radius: 6px;
    box-shadow: var(--panel-shadow);
    padding: 12px 16px;
    transition: box-shadow 0.2s ease;
}

.panel:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ===== Stats Bar ===== */

#player-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 10px 12px 0;
    padding: 6px 16px;
    background: linear-gradient(180deg, var(--wood) 0%, #2a1a10 100%);
    border: 2px solid var(--gold-dim);
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
    min-height: 52px;
}

.stats-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.stats-center {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 10px;
    flex: 1;
}

.stats-right {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
}

.stats-right .stat {
    display: inline-flex;
    align-items: center;
}

/* Merchant portrait in header */
.stats-portrait img {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    object-fit: cover;
    object-position: center 15%;
    background: var(--parchment);
    box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 12px rgba(201,162,39,0.3);
    margin: -10px 0 -22px;
    transform: scale(1.15);
    transform-origin: center center;
}

.stats-portrait {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: help;
    position: relative;
    z-index: 10000;
}

.stats-portrait img.silhouette {
    opacity: 0.5;
}

.stats-portrait-name {
    font-family: var(--font-heading);
    font-size: 0.78em;
    color: var(--parchment);
    font-style: italic;
    white-space: nowrap;
}

/* Season icon in header */
.stats-season {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 10000;
}

.stats-season img {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    object-fit: cover;
    background: var(--parchment);
    box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 12px rgba(201,162,39,0.3);
    margin: -10px 0 -22px;
    transform: scale(1.15);
    transform-origin: center center;
}

.stats-season-name {
    font-family: var(--font-heading);
    font-size: 0.78em;
    color: var(--parchment);
    font-style: italic;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sound-toggle-float {
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 50;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--wood) 0%, #2a1a10 100%);
    border: 1.5px solid var(--gold-dim);
    box-shadow: 0 3px 12px rgba(0,0,0,0.5), 0 0 6px rgba(201,162,39,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.sound-toggle-float:hover, .feedback-toggle-float:hover {
    border-color: var(--gold);
    box-shadow: 0 5px 16px rgba(0,0,0,0.6), 0 0 10px rgba(201,162,39,0.3);
    transform: translateY(-1px);
}

.feedback-toggle-float {
    position: fixed;
    bottom: 62px;
    right: 18px;
    z-index: 50;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--wood) 0%, #2a1a10 100%);
    border: 1.5px solid var(--gold-dim);
    box-shadow: 0 3px 12px rgba(0,0,0,0.5), 0 0 6px rgba(201,162,39,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--gold-dim);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

/* Sound settings modal */
.sound-slider-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}
.sound-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sound-slider-row label {
    font-family: var(--font-heading);
    font-size: 0.85em;
    color: var(--ink);
    width: 54px;
    text-align: right;
    flex-shrink: 0;
}
.sound-vol-label {
    font-family: var(--font-body);
    font-size: 0.8em;
    color: var(--ink-light);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.sound-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--parchment-deep);
    outline: none;
    cursor: pointer;
}
.sound-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    border: 1.5px solid var(--gold-bright);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: transform 0.15s;
}
.sound-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.sound-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    border: 1.5px solid var(--gold-bright);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    cursor: pointer;
}
.sound-mute-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--gold-dim);
}
.sound-mute-row label {
    font-family: var(--font-heading);
    font-size: 0.85em;
    color: var(--ink);
    cursor: pointer;
}
.sound-mute-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold);
    cursor: pointer;
}

#player-stats .stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-heading);
    font-size: 0.82em;
    font-weight: 600;
    color: var(--parchment);
    padding: 3px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(201,162,39,0.25);
    border-radius: 4px;
    white-space: nowrap;
}

#player-stats .stat-label {
    color: var(--gold);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#player-stats .stat-value {
    color: #fff;
    transition: color 0.3s ease;
}

@keyframes flash-trade {
    0% { color: #fff; }
    30% { color: var(--gold-bright); text-shadow: 0 0 8px rgba(230,184,0,0.8); transform: scale(1.15); }
    100% { color: #fff; text-shadow: none; transform: scale(1); }
}
#player-stats .stat-value.flash-gold { animation: flash-trade 0.6s ease; }

#player-stats .stat-value.condition-good { color: #8bc34a; }
#player-stats .stat-value.condition-mid { color: #ffc107; }
#player-stats .stat-value.condition-low { color: #f44336; }

#player-stats .crew-badge {
    font-size: 0.75em;
    padding: 2px 7px;
    background: rgba(201,162,39,0.2);
    border: 1px solid var(--gold);
    border-radius: 3px;
    color: var(--gold-bright);
    cursor: help;
}

/* ===== Two-Column Layout ===== */

#main-content {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    flex: 1;
    min-height: 0; /* Allow flex children to shrink */
    overflow: hidden;
}

#left-column {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
}

#right-column {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
}

/* ===== City Info ===== */

#city-info {
    flex-shrink: 0;
    padding: 0;
    overflow: hidden;
}

.city-banner {
    position: relative;
    width: 100%;
    height: clamp(120px, 12vw, 220px);
    overflow: hidden;
    cursor: pointer;
}

.city-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.city-banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: linear-gradient(transparent, rgba(20, 12, 5, 0.8));
}

.city-banner-overlay h3 {
    font-size: 1.4em;
    color: var(--parchment);
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    border: none;
    padding: 0;
}

.city-details {
    padding: 8px 16px 10px;
}

.city-details p {
    margin: 3px 0;
    font-size: 0.92em;
    color: var(--ink-light);
}

/* ===== Market Table ===== */

#market-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#market-container h4 {
    flex-shrink: 0;
    font-size: 1.05em;
    border-bottom: 1px solid var(--parchment-deep);
    padding-bottom: 5px;
    margin-bottom: 0;
}

#market-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

#market-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

#market-table th {
    background: linear-gradient(180deg, var(--wood-light), var(--wood));
    color: var(--parchment);
    font-family: var(--font-heading);
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 7px 8px;
    text-align: left;
    border-bottom: 2px solid var(--gold-dim);
}

#market-table th:nth-child(2),
#market-table th:nth-child(4) {
    text-align: right;
}

#market-table th:nth-child(3),
#market-table th:nth-child(5),
#market-table th:nth-child(6),
#market-table th:nth-child(7) {
    text-align: center;
}

/* Sort arrows */
#market-table th.sortable {
    cursor: pointer;
    user-select: none;
}

#market-table th.sortable:hover {
    background: linear-gradient(180deg, var(--wood), var(--wood-dark, #5a3a1a));
}

.sort-arrows {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    margin-left: 2px;
    line-height: 1;
    gap: 0px;
}

.sort-arrows .arrow-up,
.sort-arrows .arrow-down {
    font-size: 0.5em;
    opacity: 0.35;
    line-height: 1;
    transition: opacity 0.15s;
}

.sort-arrows .arrow-up:hover,
.sort-arrows .arrow-down:hover {
    opacity: 0.8;
}

#market-table th.sort-asc .arrow-up {
    opacity: 1;
    color: var(--gold, #d4a843);
}

#market-table th.sort-desc .arrow-down {
    opacity: 1;
    color: var(--gold, #d4a843);
}

#market-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(139,105,20,0.2);
    vertical-align: middle;
}

#market-table tbody tr:nth-child(even) {
    background: rgba(139,105,20,0.06);
}

#market-table tbody tr:hover {
    background: rgba(139,105,20,0.14);
}

#market-table tbody tr.row-profit {
    background: rgba(34,120,34,0.09);
}

#market-table tbody tr.row-loss {
    background: rgba(160,40,40,0.09);
}

#market-table tbody tr.row-profit:hover {
    background: rgba(34,120,34,0.17);
}

#market-table tbody tr.row-loss:hover {
    background: rgba(160,40,40,0.17);
}

#market-table td:nth-child(1) {
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}

#market-table td:nth-child(2) {
    text-align: right;
    color: var(--ink-light);
}

#market-table td:nth-child(3),
#market-table td:nth-child(5),
#market-table td:nth-child(6),
#market-table td:nth-child(7) {
    text-align: center;
    white-space: nowrap;
}

#market-table td:nth-child(4) {
    text-align: right;
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 0.95em;
    color: var(--wood);
}

.good-icon {
    width: clamp(20px, 1.8vw, 36px);
    height: clamp(20px, 1.8vw, 36px);
    vertical-align: middle;
    margin-right: 8px;
    border-radius: 3px;
    border: 1px solid rgba(139,105,20,0.3);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.good-icon:hover {
    border-color: var(--gold);
    box-shadow: 0 0 4px rgba(201, 162, 39, 0.4);
}

.good-name {
    cursor: pointer;
}

.good-name:hover {
    color: var(--gold);
}

.trade-row {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Market inputs and buttons */

#market-table input[type="number"] {
    width: 56px;
    padding: 3px 6px;
    font-size: 0.9em;
    font-family: var(--font-body);
    border: 1px solid var(--parchment-deep);
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    text-align: center;
}

.bm-sell-btn {
    background: linear-gradient(180deg, #4a3520, #2c1810) !important;
    color: var(--gold-bright) !important;
    border-color: var(--gold-dim) !important;
    font-weight: 700;
    font-size: 0.78em !important;
}
.bm-sell-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #5a4530, #3c2820) !important;
    border-color: var(--gold) !important;
}

#market-table input[type="number"]:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(201,162,39,0.25);
}

#market-table button {
    padding: 3px 10px;
    font-size: 0.82em;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s ease;
}

#market-table button.buy-btn {
    background: linear-gradient(180deg, var(--success), #3a6632);
    color: #fff;
    border: 1px solid #2e5228;
}

#market-table button.buy-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #5a9c4f, var(--success));
}

#market-table button.sell-btn {
    background: linear-gradient(180deg, var(--leather), #5a3a20);
    color: var(--parchment);
    border: 1px solid #4a2a15;
}

#market-table button.sell-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--leather-light), var(--leather));
}

#market-table button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.qty-shortcut {
    padding: 2px 5px;
    font-size: 0.7em;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    border-radius: 2px;
    background: var(--parchment-deep);
    color: var(--ink);
    border: 1px solid var(--gold-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.15s ease;
}

.qty-shortcut:hover:not(:disabled) {
    background: var(--gold);
    color: var(--wood);
}

.qty-shortcut:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ===== Actions Panel ===== */

#actions-container {
    flex-shrink: 0;
    padding: 10px 14px;
}

.action-section-label {
    font-family: var(--font-heading);
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold-dim);
    margin-bottom: 4px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: flex-start;
    margin-bottom: 8px;
}

#travel-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

/* Shared button style for actions */
.action-btn {
    padding: 6px 12px;
    font-size: 0.85em;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    background: linear-gradient(180deg, var(--leather-light), var(--leather));
    color: var(--parchment);
    border: 1px solid var(--gold-dim);
}

.action-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #a07850, var(--leather-light));
    border-color: var(--gold);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Press feedback — tactile "push" on click */
.action-btn:active:not(:disabled),
.ss-btn:active:not(:disabled),
.ss-sail-btn:active,
.ss-daily-btn:active,
#market-table button:active:not(:disabled),
.qty-shortcut:active:not(:disabled) {
    transform: scale(0.97);
}

.action-btn:disabled {
    cursor: not-allowed;
}

.action-btn:disabled .btn-label,
.action-btn:disabled .btn-cost {
    opacity: 0.4;
    filter: grayscale(0.4);
}

.action-btn.travel-btn {
    background: linear-gradient(180deg, var(--wood-light), var(--wood));
    font-size: 0.8em;
    padding: 5px 10px;
}

.action-btn.travel-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #7d5e47, var(--wood-light));
}

.action-btn.travel-btn.travel-medium {
    border-left: 3px solid var(--warning);
}
.action-btn.travel-btn.travel-long {
    border-left: 3px solid var(--danger);
    background: linear-gradient(180deg, #5d3a2a, #4a2a1a);
}
.action-btn.travel-btn.travel-long:hover:not(:disabled) {
    background: linear-gradient(180deg, #7d4a3a, #5d3a2a);
}
.action-btn.travel-btn.last-trip {
    border-color: var(--warning);
    box-shadow: 0 0 4px rgba(184,134,11,0.4);
}

#other-actions,
#crew-actions,
#shipyard-actions {
    display: block;
}

.action-btn.hired {
    background: linear-gradient(180deg, #5a7c4f, #3a5c32);
    border-color: var(--success);
    cursor: default;
}

/* ===== Tooltips ===== */

.has-tooltip {
    position: relative;
}

#global-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--wood);
    color: var(--parchment);
    font-family: var(--font-body);
    font-size: 0.85em;
    font-weight: 400;
    padding: 8px 14px;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: min(360px, 50vw);
    text-align: left;
    line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 3px 12px rgba(0,0,0,0.5);
    border: 1px solid var(--gold-dim);
}

/* Hide the inline tooltip spans — they're just data carriers */
.has-tooltip .tooltip {
    display: none !important;
}

/* ===== Message Log ===== */

#message-log {
    flex: 1;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #3e2723 0%, #2a1a10 100%);
    border: 2px solid var(--gold-dim);
    overflow: hidden;
}

#message-log h4 {
    flex-shrink: 0;
    color: var(--gold);
    font-size: 0.9em;
    margin: 0 0 6px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(201,162,39,0.3);
}

#message-log-content {
    flex: 1;
    overflow-y: auto;
    font-family: 'Crimson Text', 'Georgia', serif;
    font-size: 0.88em;
    line-height: 1.4;
}

#message-log-content p {
    margin: 0;
    padding: 3px 4px;
    color: var(--parchment);
    border-bottom: 1px dotted rgba(201,162,39,0.15);
    word-wrap: break-word;
    animation: log-entry-in 0.25s ease;
}

@keyframes log-entry-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

#message-log-content p:last-child {
    border-bottom: none;
}

#message-log-content p .turn-tag {
    color: var(--gold-dim);
    font-size: 0.85em;
    margin-right: 4px;
}

/* Scrollbar styling for log */
#message-log-content::-webkit-scrollbar {
    width: 6px;
}
#message-log-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
#message-log-content::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 3px;
}

/* Left column scrollbar */
#left-column::-webkit-scrollbar {
    width: 6px;
}
#left-column::-webkit-scrollbar-track {
    background: transparent;
}
#left-column::-webkit-scrollbar-thumb {
    background: rgba(139,105,20,0.4);
    border-radius: 3px;
}

/* ===== Tavern Panel (anchored to market) ===== */

.tavern-anchored-panel {
    position: fixed;
    z-index: 50;
    background: var(--panel-bg);
    border: 2px solid var(--gold);
    border-radius: 6px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.4), 0 0 15px rgba(201,162,39,0.15);
    overflow-y: auto;
    animation: tavern-slide-in 0.25s ease;
}

@keyframes tavern-slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.tavern-dimmed {
    position: relative;
    pointer-events: none;
    transition: filter 0.25s ease;
    filter: brightness(0.3);
}

.tavern-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 8px;
    border-bottom: 2px solid var(--gold-dim);
    background: linear-gradient(180deg, var(--parchment), var(--parchment-dark));
    position: sticky;
    top: 0;
    z-index: 1;
}

.tavern-panel-header h3 {
    margin: 0;
    font-family: var(--font-heading);
    color: var(--wood);
    font-size: 1.1em;
}

.tavern-close {
    background: none;
    border: none;
    font-size: 1.4em;
    color: var(--ink-light);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.tavern-close:hover { color: var(--danger); }

.tavern-city {
    padding: 10px 16px 6px;
    border-bottom: 1px solid var(--parchment-deep);
}

.tavern-city-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95em;
    color: var(--wood);
    margin-bottom: 4px;
}

.tavern-price-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.88em;
    color: var(--ink);
}

.tavern-price-row .tavern-good { color: var(--ink); }
.tavern-price-row .tavern-price { font-weight: 600; color: var(--wood); }
.tavern-price-row.stale { font-style: italic; opacity: 0.7; }
.tavern-price-row.stale .tavern-price::after { content: ' (old)'; font-weight: 400; font-size: 0.85em; color: var(--ink-light); }

/* ===== Game Modal Backdrop (shared) ===== */

.game-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 6, 2, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: modal-fade-in 0.3s ease forwards;
    overflow-y: auto;
    padding: 20px;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modal-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes modal-zoom-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes modal-zoom-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.95); }
}

.game-modal-backdrop.modal-closing {
    animation: modal-fade-out 0.15s ease forwards;
}

.game-modal-backdrop.modal-closing .parchment-modal {
    animation: modal-zoom-out 0.15s ease forwards;
}

#event-modal {
    z-index: 70;
}

#sound-modal {
    z-index: 100;
}

.parchment-modal {
    background: var(--panel-bg);
    border: 2px solid var(--gold);
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 20px rgba(201,162,39,0.2);
    padding: 24px 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.parchment-modal.travel-modal-wide {
    max-width: 800px;
}

/* Travel map */
#travel-map-container {
    position: relative;
    height: clamp(180px, 30vw, 360px);
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--gold-dim);
    margin: 10px 0 14px;
    background: var(--parchment-deep);
}

#travel-map-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.3) brightness(0.9);
}

#travel-ship-icon {
    position: absolute;
    width: clamp(28px, 3vw, 42px);
    transition: left 1.8s ease-in-out;
    transform: translateX(-50%);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    z-index: 2;
    top: -4px;
    pointer-events: none;
}

#travel-ship-icon img {
    width: 100%;
    height: auto;
}

.parchment-modal:not(.travel-modal-wide) {
    animation: modal-zoom-in 0.3s ease forwards;
}

/* ===== Travel Modal ===== */

#travel-route-label {
    font-family: var(--font-heading);
    font-size: 1.3em;
    font-weight: 700;
    color: var(--wood);
    letter-spacing: 1px;
    margin-bottom: 20px;
}

#travel-timeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 12px;
    padding: 22px 10px 0;
    position: relative;
}

.timeline-dot {
    width: clamp(18px, 2vw, 28px);
    height: clamp(18px, 2vw, 28px);
    border-radius: 50%;
    border: 2px solid var(--gold-dim);
    background: var(--parchment-dark);
    flex-shrink: 0;
    transition: all 0.4s ease;
    position: relative;
}

.timeline-dot.completed {
    background: var(--gold);
    border-color: var(--gold-bright);
    box-shadow: 0 0 6px rgba(201,162,39,0.5);
}

.timeline-dot.current {
    border-color: var(--gold-bright);
    animation: dot-pulse 1s ease-in-out infinite alternate;
}

.timeline-dot.event-dot {
    background: var(--danger);
    border-color: #c44;
    box-shadow: 0 0 8px rgba(170,51,51,0.5);
}

.timeline-dot.event-dot.good-event {
    background: var(--success);
    border-color: #5a9c4f;
    box-shadow: 0 0 8px rgba(74,124,63,0.5);
}

.timeline-connector {
    height: 2px;
    flex: 1;
    min-width: 12px;
    max-width: 40px;
    background: var(--parchment-deep);
    transition: background 0.4s ease;
}

.timeline-connector.completed {
    background: var(--gold);
}

.timeline-port {
    width: clamp(120px, 12vw, 150px);
    border-radius: 5px;
    border: 2px solid var(--gold-dim);
    background: var(--parchment-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: clamp(8px, 0.85vw, 11px);
    font-weight: 700;
    color: var(--wood);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    transition: all 0.4s ease;
    white-space: nowrap;
}

.timeline-port .tl-coa {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.timeline-port.completed {
    background: var(--gold);
    border-color: var(--gold-bright);
    color: var(--wood);
    box-shadow: 0 0 6px rgba(201,162,39,0.5);
}

.timeline-port.arrived {
    animation: dot-pulse 1s ease-in-out infinite alternate;
    border-color: var(--gold-bright);
}

@keyframes dot-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(201,162,39,0); }
    100% { transform: scale(1.15); box-shadow: 0 0 10px rgba(201,162,39,0.6); }
}

#travel-month-label {
    font-family: var(--font-heading);
    font-size: 0.9em;
    color: var(--ink-light);
    margin-bottom: 6px;
}

#travel-status {
    font-family: var(--font-body);
    font-size: 0.9em;
    color: var(--ink-light);
    font-style: italic;
    min-height: 1.4em;
}

/* ===== Event Modal ===== */

#event-modal-content {
    max-width: 560px;
}

#event-modal-img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
    margin: -24px -30px 16px;
    width: calc(100% + 60px);
    border-bottom: 2px solid var(--gold-dim);
}

#event-modal-title {
    font-family: var(--font-heading);
    font-size: 1.2em;
    color: var(--wood);
    margin: 0 0 10px;
}

#event-modal-lines {
    font-family: var(--font-body);
    font-size: 0.95em;
    color: var(--ink);
    line-height: 1.5;
    margin-bottom: 16px;
    text-align: left;
}

#event-modal-lines p {
    margin: 4px 0;
}

#event-modal-lines .event-damage {
    color: var(--danger);
    font-weight: 600;
}

#event-modal-lines .event-gain {
    color: var(--success);
    font-weight: 600;
}

#event-modal-btn {
    font-size: 0.95em;
    padding: 8px 24px;
}

/* ===== Good Detail Modal ===== */
#good-modal {
    z-index: 80;
    top: 70px;
    inset: 70px 0 0 0;
    align-items: center;
    padding: 20px;
}

#good-modal-content {
    max-width: 800px;
    width: 90%;
    position: relative;
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

#good-modal-left {
    flex: 0 0 auto;
    text-align: center;
}

#good-modal-right {
    flex: 1;
    min-width: 0;
}

.good-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--ink-light);
    cursor: pointer;
    z-index: 1;
    line-height: 1;
}

.good-modal-close:hover {
    color: var(--ink);
}

#good-modal-img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--gold-dim);
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#good-modal-title {
    font-family: var(--font-heading);
    font-size: 1.3em;
    color: var(--wood);
    margin: 0 0 10px;
}

#good-modal-desc {
    font-family: var(--font-body);
    font-size: 0.95em;
    color: var(--ink);
    line-height: 1.6;
    margin: 0 0 14px;
    text-align: left;
}

#good-modal-meta {
    font-family: var(--font-body);
    font-size: 0.85em;
    color: var(--ink-light);
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

#good-modal-meta span {
    background: var(--parchment-dark);
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--gold-dim);
}

#good-modal-trivia {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

#good-modal-trivia li {
    font-family: var(--font-body);
    font-size: 0.9em;
    color: var(--ink);
    line-height: 1.5;
    padding: 6px 0 6px 20px;
    position: relative;
    border-bottom: 1px solid rgba(139, 105, 20, 0.15);
}

#good-modal-trivia li:last-child {
    border-bottom: none;
}

#good-modal-trivia li::before {
    content: "\2767";
    position: absolute;
    left: 0;
    color: var(--gold-dim);
}

/* ===== End Game Screen ===== */

#end-game-screen {
    font-family: var(--font-body);
    font-size: 1em;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: fixed;
    inset: 0;
    overflow-y: auto;
    padding: 80px 30px 30px;
    background: radial-gradient(ellipse at center, rgba(42,26,16,0.95) 0%, rgba(13,8,5,0.98) 100%);
    color: var(--parchment);
    text-align: center;
    z-index: 100;
}

#end-game-screen::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('images/med_map_opt.jpg') center center / cover no-repeat;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.end-content {
    max-width: min(1100px, 92vw);
    text-align: center;
    width: 100%;
}

.end-layout {
    display: flex;
    gap: clamp(20px, 3vw, 40px);
    align-items: flex-start;
    text-align: left;
    margin-top: 20px;
}

.end-left {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.end-merchant-img {
    width: clamp(160px, 18vw, 280px);
    object-fit: contain;
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.6));
}

.end-right {
    flex: 1;
    min-width: 0;
}

.end-stats-block {
    margin: 15px 0;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(201,162,39,0.25);
    border-radius: 6px;
}

.end-meta {
    font-size: 0.85em;
    color: var(--parchment-dark);
    margin-bottom: 6px;
}

.end-gold-row {
    font-size: 0.9em;
    color: var(--parchment);
    margin-bottom: 8px;
}

.end-net-worth {
    font-family: var(--font-heading);
    font-size: 1.5em;
    color: var(--parchment);
    font-weight: 700;
    margin-bottom: 4px;
}

.end-best {
    font-size: 0.85em;
    font-weight: 600;
}

@media (max-width: 768px) {
    .end-layout {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .end-merchant-img { width: 120px; }
}

#end-game-screen h2 {
    font-family: var(--font-heading);
    color: var(--gold-bright);
    font-size: 1.8em;
    margin: 0 0 10px;
}

#end-game-screen h3 {
    font-family: var(--font-heading);
    color: var(--parchment);
    margin-top: 20px;
    margin-bottom: 10px;
}

#end-game-screen button {
    padding: 12px 30px;
    font-size: 1.1em;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    margin-top: 25px;
    background: linear-gradient(180deg, var(--leather-light), var(--leather));
    color: var(--parchment);
    border: 2px solid var(--gold);
    border-radius: 5px;
    transition: all 0.2s ease;
}

#end-game-screen button:hover {
    background: linear-gradient(180deg, #a07850, var(--leather-light));
    box-shadow: 0 0 12px rgba(201,162,39,0.4);
}

/* ===== Event Image Popup ===== */

.event-image-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    max-width: 280px;
    max-height: 280px;
    z-index: 1000;
    border: 3px solid var(--gold);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(201,162,39,0.5), 0 0 60px rgba(0,0,0,0.6);
    animation: fadeInOutPopup 4s ease-in-out forwards;
}

@keyframes fadeInOutPopup {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    85%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* ===== City Detail Modal ===== */

#city-modal {
    z-index: 200;
    align-items: center;
    padding: 20px;
}

#city-modal-content {
    max-width: 700px;
    width: 92%;
    position: relative;
    text-align: left;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    max-height: 85vh;
    animation: modal-zoom-in 0.3s ease forwards;
}

.city-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--parchment);
    cursor: pointer;
    z-index: 1;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

.city-modal-close:hover {
    color: var(--gold-bright);
}

#city-modal-left {
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
}

#city-modal-img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 45vh;
    object-fit: cover;
}

#city-modal-right {
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#city-modal-title {
    font-family: var(--font-heading);
    font-size: 1.4em;
    color: var(--wood);
    margin: 0 0 10px;
    letter-spacing: 0.5px;
}

#city-modal-desc {
    font-family: var(--font-body);
    font-size: 0.95em;
    color: var(--ink);
    line-height: 1.6;
    margin: 0 0 12px;
}

#city-modal-meta {
    font-family: var(--font-body);
    font-size: 0.85em;
    color: var(--ink-light);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

#city-modal-meta span {
    background: var(--parchment-dark);
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--gold-dim);
}

#city-modal-goods {
    margin-bottom: 14px;
}

.city-goods-label {
    font-family: var(--font-heading);
    font-size: 0.8em;
    color: var(--gold-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.city-goods-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.city-good-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--parchment-dark);
    border: 1px solid var(--gold-dim);
    border-radius: 6px;
    padding: 4px 10px 4px 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.city-good-badge:hover {
    border-color: var(--gold);
    background: var(--parchment-deep);
}

.city-good-badge img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.city-good-badge span {
    font-family: var(--font-body);
    font-size: 0.85em;
    color: var(--ink);
}

#city-modal-trivia {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid rgba(139, 105, 20, 0.25);
    padding-top: 12px;
}

#city-modal-trivia li {
    font-family: var(--font-body);
    font-size: 0.9em;
    color: var(--ink);
    line-height: 1.5;
    padding: 6px 0 6px 20px;
    position: relative;
    border-bottom: 1px solid rgba(139, 105, 20, 0.15);
}

#city-modal-trivia li:last-child {
    border-bottom: none;
}

#city-modal-trivia li::before {
    content: "\2767";
    position: absolute;
    left: 0;
    color: var(--gold-dim);
}

@media (max-width: 768px) {
    #city-modal-content {
        max-height: 90vh;
    }

    #city-modal-img {
        max-height: 35vh;
    }

    #city-modal-right {
        padding: 16px 20px;
    }
}

/* ===== Market Cost Preview ===== */

.cost-preview {
    display: block;
    font-size: 0.75em;
    font-family: var(--font-body);
    color: var(--ink-light);
    margin-top: 1px;
    min-height: 1.1em;
}

.cost-basis {
    display: inline-block;
    font-size: 0.78em;
    font-family: var(--font-heading);
    font-weight: 600;
    font-style: normal;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    color: var(--ink-light);
}
.cost-basis.profit { color: var(--success); background: rgba(74,124,63,0.12); border: 1px solid rgba(74,124,63,0.3); }
.cost-basis.loss { color: var(--danger); background: rgba(170,51,51,0.1); border: 1px solid rgba(170,51,51,0.25); }

.cost-preview.over-budget {
    color: var(--danger);
    font-weight: 600;
}

/* ===== Trend Arrows ===== */

.trend-up { color: #4a7c3f; font-size: 0.8em; }
.trend-down { color: var(--danger); font-size: 0.8em; }
.trend-flat { color: #999; font-size: 0.7em; }
.col-trend, .col-weight { text-align: center; font-size: 0.85em; color: var(--ink-light); }

/* ===== Embargo & Port Notices ===== */

/* Embargo stamp overlay on sell cell */
/* Embargo stamp overlay on sell cell */
.sell-embargoed {
    position: relative;
}

.sell-embargoed .trade-row {
    opacity: 0.15;
    pointer-events: none;
}

.embargo-stamp {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 0.78em;
    font-weight: 700;
    color: rgba(170, 51, 51, 0.75);
    border: 2px solid rgba(170, 51, 51, 0.5);
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 3px;
    pointer-events: none;
    z-index: 5;
    background: rgba(245, 230, 200, 0.6);
    animation: stamp-in 0.4s ease-out;
}

@keyframes stamp-in {
    0%   { opacity: 0; transform: scale(1.4) rotate(-5deg); }
    60%  { opacity: 1; transform: scale(0.95) rotate(1deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
.port-notice { font-size: 0.82em; font-family: var(--font-heading); padding: 4px 8px; margin-top: 6px; border-radius: 4px; text-align: center; }
.embargo-notice { background: rgba(170,51,51,0.1); color: var(--danger); border: 1px solid rgba(170,51,51,0.3); }
.tax-notice { background: rgba(184,134,11,0.1); color: var(--warning); border: 1px solid rgba(184,134,11,0.3); }

/* ===== Season Badge ===== */

.season-badge { background: rgba(201,162,39,0.15) !important; border-color: var(--gold) !important; }

/* ===== Stacked Action Buttons ===== */

.action-btn-stacked {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 14px 4px;
    min-width: 70px;
}
.action-btn-stacked .btn-label {
    font-size: 0.85em;
    text-transform: capitalize;
}
.action-btn-stacked .btn-cost {
    font-size: 0.65em;
    opacity: 0.75;
    font-family: var(--font-body);
    margin-top: 1px;
}

/* ===== Travel speed strikethrough ===== */

.travel-months { font-size: 0.85em; }
.travel-months s { opacity: 0.5; margin-right: 3px; }
.travel-cost { display: block; font-size: 0.7em; opacity: 0.7; font-family: var(--font-body); }

/* ===== End Game Achievements ===== */

.end-narrative {
    margin: 0 0 10px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--parchment-dark);
}
.end-narrative p { margin: 8px 0; }
.end-narrative strong { color: var(--gold-bright); }
.end-narrative em { color: var(--parchment); font-style: italic; }

.end-achievements { margin-top: 15px; }
.end-achievements h4 { color: var(--gold); margin-bottom: 8px; }
.achievement-earned { display: inline-block; background: rgba(201,162,39,0.15); border: 1px solid var(--gold-dim); border-radius: 4px; padding: 3px 10px; margin: 3px; font-family: var(--font-heading); font-size: 0.8em; color: var(--gold-bright); }

/* ===== End Game Actions ===== */

.achievement-progress-list { margin-top: 10px; }
.achievement-progress-item { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 0.8em; }
.ach-prog-name { flex: 0 0 auto; color: var(--parchment-dark); font-family: var(--font-heading); min-width: 100px; text-align: right; }
.ach-prog-bar { flex: 1; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; min-width: 80px; max-width: 150px; }
.ach-prog-fill { height: 100%; background: var(--gold-dim); border-radius: 4px; transition: width 0.3s; }
.ach-prog-text { flex: 0 0 auto; color: var(--gold-dim); font-size: 0.9em; min-width: 40px; }

.end-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.end-actions button { padding: 10px 24px; font-size: 1em; font-family: var(--font-heading); font-weight: 600; cursor: pointer; border-radius: 5px; transition: all 0.2s ease; }
.end-actions button:first-child { background: linear-gradient(180deg, var(--leather-light), var(--leather)); color: var(--parchment); border: 2px solid var(--gold); }
.end-actions button:first-child:hover { background: linear-gradient(180deg, #a07850, var(--leather-light)); box-shadow: 0 0 12px rgba(201,162,39,0.4); }
#share-btn { background: var(--parchment-dark); color: var(--ink); border: 1px solid var(--gold-dim); font-size: 0.85em; }
#share-btn:hover { background: var(--gold); color: var(--wood); }

/* End game staggered reveal */
@keyframes end-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.end-reveal {
    opacity: 0;
    animation: end-fade-up 0.5s ease forwards;
}
.end-reveal:nth-child(1) { animation-delay: 0s; }
.end-reveal:nth-child(2) { animation-delay: 0.12s; }
.end-reveal:nth-child(3) { animation-delay: 0.24s; }
.end-reveal:nth-child(4) { animation-delay: 0.36s; }
.end-reveal:nth-child(5) { animation-delay: 0.48s; }
.end-reveal:nth-child(6) { animation-delay: 0.6s; }

/* ===== Start Screen ===== */

/* ===== Start Screen ===== */

#start-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #2a1a10 0%, #0d0805 100%);
    padding: 20px;
    position: relative;
    opacity: 0;
    transition: opacity 0.6s ease-in;
}

#start-screen.ss-ready { opacity: 1; }

#start-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/med_map_opt.jpg') center center / cover no-repeat;
    opacity: 0.35;
    z-index: 0;
}

#start-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(42,26,16,0.4) 0%, rgba(13,8,5,0.85) 100%);
    z-index: 1;
}

/* Custom scrollbar */
.ss-card::-webkit-scrollbar { width: 7px; }
.ss-card::-webkit-scrollbar-track { background: var(--parchment-dark); border-radius: 4px; }
.ss-card::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
.ss-card::-webkit-scrollbar-thumb:hover { background: var(--gold); }
.ss-voyages-collapsible::-webkit-scrollbar { width: 5px; }
.ss-voyages-collapsible::-webkit-scrollbar-track { background: transparent; }
.ss-voyages-collapsible::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }

.ss-card {
    position: relative;
    z-index: 10;
    background: var(--panel-bg);
    border: 2px solid var(--gold);
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 30px rgba(201,162,39,0.15);
    padding: clamp(16px, 2.5vw, 32px) clamp(20px, 3vw, 44px);
    width: 94%;
    max-width: 720px;
    max-height: 92vh;
    overflow-y: auto;
    scrollbar-color: var(--gold-dim) var(--parchment-dark);
    scrollbar-width: thin;
}

/* Step indicators */
.ss-steps-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: clamp(8px, 1vh, 14px);
}

.ss-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--gold-dim);
    background: transparent;
    cursor: pointer;
    transition: all 0.25s ease;
}

.ss-dot.active {
    background: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 6px rgba(201,162,39,0.4);
}

/* Step container & transitions */
.ss-step-container {
    position: relative;
}

.ss-step {
    display: none;
    animation: ss-step-in 0.35s ease;
}

.ss-step.active {
    display: block;
}

@keyframes ss-step-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.ss-header {
    text-align: center;
    margin-bottom: clamp(8px, 1.2vh, 14px);
}

.ss-title {
    font-family: var(--font-heading);
    font-size: clamp(1.8em, 4vw, 2.8em);
    color: var(--wood);
    margin: 0 0 2px;
    letter-spacing: 3px;
}

.ss-title-ad {
    font-size: 0.5em;
    color: var(--gold);
    letter-spacing: 4px;
    vertical-align: super;
}

.ss-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--ink-light);
    margin: 0;
    font-size: 0.95em;
}

/* City hero image */
.ss-city-hero {
    position: relative;
    height: clamp(140px, 22vh, 240px);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: clamp(10px, 1.5vh, 16px);
    background-size: cover;
    background-position: center;
    background-color: var(--parchment-dark);
    transition: background-image 0.4s ease;
}

.ss-city-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.5) 100%);
}

.ss-city-hero-name {
    position: absolute;
    bottom: 12px;
    left: 16px;
    font-family: var(--font-heading);
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    font-weight: 700;
    color: var(--parchment);
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    letter-spacing: 1.5px;
}

/* City selector strip */
.ss-city-strip {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.ss-city-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px 6px;
    min-width: 80px;
    flex: 1 1 0;
    max-width: 110px;
    cursor: pointer;
    border: 1.5px solid var(--parchment-deep);
    border-radius: 6px;
    background: var(--parchment-dark);
    transition: all 0.15s ease;
    text-align: center;
}

.ss-city-tile:hover:not(.locked) {
    border-color: var(--gold);
    background: var(--parchment);
}

.ss-city-tile.selected {
    border-color: var(--gold);
    background: linear-gradient(180deg, var(--leather-light), var(--leather));
    box-shadow: 0 0 8px rgba(201,162,39,0.35);
}

.ss-city-tile.locked {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.ss-city-tile .ss-city-coa {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.ss-city-tile .ss-city-name {
    font-family: var(--font-heading);
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink);
    line-height: 1.2;
}

.ss-city-tile.selected .ss-city-name {
    color: var(--parchment);
}

/* Nationality panel */
.ss-nationality-panel {
    margin-top: 10px;
    padding: 12px 14px;
    background: rgba(139,105,20,0.08);
    border: 1px solid rgba(201,162,39,0.3);
    border-radius: 6px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.ss-nat-portrait {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold-dim);
    flex-shrink: 0;
    background: var(--parchment-dark);
}

.ss-nat-info {
    flex: 1;
    min-width: 0;
}

.ss-nat-header {
    font-family: var(--font-heading);
    font-size: 0.95em;
    color: var(--wood);
    margin-bottom: 2px;
}

.ss-nat-desc {
    font-size: 0.82em;
    color: var(--ink-light);
    margin-bottom: 6px;
    font-style: italic;
}

.ss-nat-bonuses {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    font-size: 0.8em;
}

.ss-nat-bonus { color: #2e7d32; }
.ss-nat-penalty { color: #8b2500; }

/* Continue / step action button */
.ss-step-actions {
    display: flex;
    justify-content: center;
    margin-top: clamp(12px, 1.5vh, 20px);
}

.ss-continue-btn {
    padding: 12px 48px;
    font-family: var(--font-heading);
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(180deg, var(--leather-light), var(--leather));
    color: var(--parchment);
    border: 2px solid var(--gold);
    border-radius: 6px;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.ss-continue-btn:hover {
    background: linear-gradient(180deg, #a07850, var(--leather-light));
    box-shadow: 0 0 15px rgba(201,162,39,0.5);
}

/* Port summary (step 2 header) */
.ss-port-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: clamp(10px, 1.2vh, 16px);
    padding: 8px 12px;
    background: rgba(139,105,20,0.06);
    border: 1px solid rgba(201,162,39,0.2);
    border-radius: 6px;
}

.ss-port-summary img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.ss-port-summary-name {
    font-family: var(--font-heading);
    font-size: 0.9em;
    font-weight: 600;
    color: var(--wood);
}

.ss-port-summary-nat {
    font-size: 0.8em;
    color: var(--ink-light);
    font-style: italic;
}

.ss-port-back {
    margin-left: auto;
    font-family: var(--font-heading);
    font-size: 0.8em;
    color: var(--gold-dim);
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
}

.ss-port-back:hover { color: var(--gold); }

/* Sections */
.ss-section {
    margin-bottom: clamp(10px, 1.2vh, 16px);
}

.ss-section-label {
    font-family: var(--font-heading);
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gold-dim);
    margin-bottom: 8px;
}

/* Difficulty tier grid */
.ss-tier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.ss-btn {
    padding: 8px 10px;
    font-family: var(--font-heading);
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid var(--gold-dim);
    background: var(--parchment-dark);
    color: var(--ink);
    transition: all 0.15s ease;
    text-align: center;
}

.ss-btn strong { display: block; font-size: 1.05em; }
.ss-btn-desc { display: block; font-size: 0.8em; font-weight: 400; color: var(--ink-light); margin-top: 2px; font-family: var(--font-body); }

.ss-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--parchment); }

.ss-btn.selected {
    background: linear-gradient(180deg, var(--leather-light), var(--leather));
    color: var(--parchment);
    border-color: var(--gold);
    box-shadow: 0 0 6px rgba(201,162,39,0.3);
}

.ss-btn.selected .ss-btn-desc { color: var(--parchment-dark); }

.ss-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

/* Nationality badge in-game */
#player-stats .nationality-badge {
    background: rgba(139,105,20,0.25);
    border-color: var(--gold-dim);
    color: var(--parchment);
    font-style: italic;
    cursor: help;
}

/* Nationality tooltip */
.nat-tooltip {
    display: none;
    position: fixed;
    width: clamp(260px, 25vw, 360px);
    background: var(--panel-bg);
    border: 2px solid var(--gold);
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 12px rgba(201,162,39,0.15);
    padding: 14px 16px;
    padding-top: 22px;
    z-index: 9999;
    font-style: normal;
    cursor: default;
}

.nat-tooltip.visible {
    display: block;
    animation: tooltip-in 0.15s ease;
}

@keyframes tooltip-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nat-tip-title {
    font-family: var(--font-heading);
    font-size: 1.05em;
    font-weight: 700;
    color: var(--wood);
    margin-bottom: 4px;
}

.nat-tip-desc {
    font-size: 0.88em;
    color: var(--ink-light);
    font-style: italic;
    margin-bottom: 8px;
}

.nat-tip-section {
    margin-bottom: 4px;
}

.nat-tip-bonus {
    font-size: 0.85em;
    color: #2e7d32;
    padding: 1px 0;
}

.nat-tip-penalty {
    font-size: 0.85em;
    color: #8b2500;
    padding: 1px 0;
    margin-bottom: 10px;
}

.nat-tip-teaser {
    font-size: 0.82em;
    color: var(--ink-light);
    font-style: italic;
    line-height: 1.5;
    border-top: 1px solid var(--parchment-deep);
    padding-top: 8px;
    margin-top: 8px;
    font-family: var(--font-body);
}

.nat-tip-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.82em;
    color: var(--gold-dim);
    cursor: pointer;
    font-family: var(--font-heading);
    text-decoration: underline;
}
.nat-tip-link:hover { color: var(--gold); }

/* Nationality modal */
.nat-modal-content {
    max-width: 620px;
    max-height: 80vh;
    overflow-y: auto;
}

.nat-modal-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.nat-modal-portrait {
    width: 160px;
    flex-shrink: 0;
    border-radius: 6px;
    object-fit: contain;
}

.nat-modal-content h3 {
    font-family: var(--font-heading);
    color: var(--wood);
    margin: 0 0 8px;
}

.nat-modal-desc {
    font-style: italic;
    color: var(--ink-light);
    margin: 0 0 12px;
    font-size: 0.95em;
}

.nat-modal-section-label {
    font-family: var(--font-heading);
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold-dim);
    margin: 12px 0 4px;
}

.nat-modal-bonuses {
    margin-bottom: 4px;
}

.nat-modal-history,
.nat-modal-legacy {
    font-size: 0.9em;
    color: var(--ink);
    line-height: 1.6;
    margin: 4px 0 0;
    font-family: var(--font-body);
}

.nat-modal-content .action-btn {
    margin-top: 16px;
}

/* Modifier toggles */
.ss-modifier {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--parchment-deep);
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85em;
    transition: all 0.15s;
}
.ss-modifier:hover { background: rgba(201,162,39,0.08); }
.ss-modifier.active { border-color: var(--gold); background: rgba(201,162,39,0.1); }
.ss-modifier input[type="checkbox"] { accent-color: var(--gold); }
.ss-mod-name { font-weight: 600; font-family: var(--font-heading); font-size: 0.95em; }
.ss-mod-desc { color: var(--ink-light); font-size: 0.9em; }

.ss-empty { color: var(--ink-light); font-style: italic; font-size: 0.9em; margin: 6px 0; }

/* Action buttons */
.ss-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: clamp(12px, 1.5vh, 20px) 0;
    border-top: 1px solid var(--parchment-deep);
    margin-top: clamp(10px, 1.2vh, 16px);
}

.ss-sail-btn {
    padding: 14px 40px;
    font-family: var(--font-heading);
    font-size: 1.3em;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(180deg, var(--leather-light), var(--leather));
    color: var(--parchment);
    border: 2px solid var(--gold);
    border-radius: 6px;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}
.ss-sail-btn:hover { background: linear-gradient(180deg, #a07850, var(--leather-light)); box-shadow: 0 0 15px rgba(201,162,39,0.5); }

.ss-daily-btn {
    padding: 10px 22px;
    font-family: var(--font-heading);
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    background: var(--parchment-dark);
    color: var(--ink);
    border: 1px solid var(--gold-dim);
    border-radius: 5px;
    transition: all 0.15s;
}
.ss-daily-btn:hover { border-color: var(--gold); background: var(--parchment); }

.ss-actions-secondary {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-bottom: clamp(6px, 1vh, 12px);
}

.ss-daily-info { font-size: 0.88em; color: var(--ink-light); font-style: italic; }

/* Past voyages collapsible */
.ss-voyages-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px;
    font-family: var(--font-heading);
    font-size: 0.82em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold-dim);
    cursor: pointer;
    user-select: none;
}
.ss-voyages-toggle:hover { color: var(--gold); }

.ss-voyages-arrow {
    font-size: 0.7em;
    transition: transform 0.2s ease;
    display: inline-block;
}
.ss-voyages-arrow.open {
    transform: rotate(90deg);
}

.ss-voyages-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.ss-voyages-collapsible.open {
    max-height: 300px;
    overflow-y: auto;
}

/* History table */
.ss-history-table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin-top: 6px; }
.ss-history-table th { font-family: var(--font-heading); font-size: 0.88em; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--parchment-deep); color: var(--gold-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.ss-history-table td { padding: 5px 8px; border-bottom: 1px solid rgba(139,105,20,0.15); color: var(--ink); }

/* ===== Start Screen Decorations ===== */

.ss-compass {
    position: absolute;
    bottom: 2%;
    right: 1%;
    width: clamp(80px, 10vw, 160px);
    height: clamp(80px, 10vw, 160px);
    z-index: 11;
    opacity: 0.7;
    pointer-events: none;
    object-fit: contain;
}

.ss-ship {
    position: absolute;
    bottom: 2%;
    left: 0;
    width: clamp(60px, 10vw, 140px);
    z-index: 11;
    opacity: 0.5;
    pointer-events: none;
    animation: ss-sail 45s linear infinite;
}

.ss-ship img {
    width: 100%;
    filter: sepia(0.5) brightness(0.7);
}

@keyframes ss-sail {
    0% { transform: translateX(-15vw); }
    100% { transform: translateX(110vw); }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ss-card { max-width: 100%; padding: 14px 16px; }
    .ss-city-strip { gap: 4px; }
    .ss-city-tile { min-width: 60px; padding: 6px 4px 5px; }
    .ss-city-tile .ss-city-coa { width: 22px; height: 22px; }
    .ss-city-tile .ss-city-name { font-size: 0.65em; }
    .ss-city-hero { height: clamp(100px, 18vh, 160px); }
    .ss-nationality-panel { flex-direction: column; align-items: center; text-align: center; }
    .ss-nat-bonuses { justify-content: center; }
    .ss-tier-grid { grid-template-columns: repeat(2, 1fr); }
    .ss-compass { width: 80px; height: 80px; opacity: 0.35; }
    .ss-ship { width: 50px; opacity: 0.2; }
}

/* ===== Icon Integration ===== */

/* Coat of arms in city banner */
.city-banner-overlay .city-coa {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    margin-right: 6px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

/* Coat of arms in city modal title */
#city-modal-title .city-coa {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    margin-right: 8px;
}

/* Coat of arms in tavern rumors */
.tavern-coa {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Coat of arms on start screen */
.ss-city-coa {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Crew badge icons */
.crew-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 2px;
}

/* Achievement badge icons */
.ach-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 4px;
}

.ach-icon-locked {
    opacity: 0.35;
    filter: grayscale(1);
}

/* ===== Toolbar Strips ===== */

/* Strip containers fill parent width */
#travel-buttons,
#other-actions,
#crew-actions,
#shipyard-actions,
#city-services {
    width: 100%;
}

/* Shared strip container */
.travel-strip,
.action-strip {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    background: var(--leather);
    border: 1.5px solid var(--gold-dim);
    border-radius: 0;
    overflow: hidden;
}

/* First strip in a group gets top corners */
.travel-strip:first-child,
.action-strip:first-child {
    border-radius: 4px 4px 0 0;
}

/* Last strip in a group gets bottom corners */
.travel-strip:last-child,
.action-strip:last-child {
    border-radius: 0 0 4px 4px;
}

/* Only strip gets full corners */
.travel-strip:only-child,
.action-strip:only-child {
    border-radius: 4px;
}

/* Merge adjacent strips (no double borders) */
.travel-strip + .travel-strip,
.action-strip + .action-strip {
    border-top: none;
}

/* Strip button base */
.strip-btn {
    border: none;
    border-radius: 0;
    border-right: 1px solid rgba(0,0,0,0.25);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
    font-family: var(--font-heading);
    font-weight: 600;
    flex: 1;
    justify-content: center;
    white-space: nowrap;
    background: linear-gradient(180deg, var(--leather-light) 0%, var(--leather) 100%);
    color: var(--parchment);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), inset 0 -1px 0 rgba(0,0,0,0.15);
}

.strip-btn:last-child { border-right: none; }

.strip-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #a07850 0%, var(--leather-light) 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), inset 0 -1px 0 rgba(0,0,0,0.15);
}

.strip-btn:active:not(:disabled) {
    background: linear-gradient(180deg, var(--leather) 0%, var(--leather-light) 100%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.strip-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.strip-btn.hired {
    background: linear-gradient(180deg, #5a7c4f, #3a5c32);
    cursor: default;
    border-right-color: rgba(0,0,0,0.3);
}

/* Travel strip specifics */
.travel-coa {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    flex-shrink: 0;
}

.weeks {
    font-size: 0.75em;
    color: var(--gold);
    margin-left: 2px;
    opacity: 0.8;
}

.strip-btn.travel-medium {
    border-left: 3px solid var(--warning);
}

.strip-btn.travel-long {
    background: linear-gradient(180deg, #7d4a3a, #5d3a2a);
    border-left: 3px solid var(--danger);
}

.strip-btn.last-trip {
    border-color: var(--warning);
    box-shadow: inset 0 0 6px rgba(184,134,11,0.3);
}

/* Action strip specifics */
.strip-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.strip-cost {
    font-size: 0.8em;
    color: var(--gold);
    margin-left: 3px;
    opacity: 0.8;
}

/* ===== Ship's Log Modal ===== */

#log-modal-content {
    max-width: 600px;
    text-align: left;
}

#log-modal-messages {
    max-height: 70vh;
    overflow-y: auto;
    margin-bottom: 16px;
    font-family: var(--font-body);
    font-size: 0.95em;
    line-height: 1.5;
    color: var(--ink);
}

#log-modal-messages p {
    margin: 4px 0;
    padding: 2px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

#log-modal-close {
    display: block;
    margin: 0 auto;
}

/* Clickable log hint */
#message-log {
    transition: border-color 0.2s;
    position: relative;
}

#message-log:hover {
    border-color: var(--gold);
}

#message-log h4 .expand-hint {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 16px;
    color: var(--gold-dim);
    opacity: 0.5;
}

#message-log:hover h4 .expand-hint {
    opacity: 1;
    color: var(--gold);
}

/* ===== Expand Hints ===== */

.expand-hint {
    font-size: 10px;
    color: var(--gold-dim);
    opacity: 0.4;
    transition: opacity 0.2s;
    cursor: pointer;
    margin-left: 4px;
}

.city-banner-overlay .expand-hint {
    position: absolute;
    top: 4px;
    right: 6px;
    color: var(--parchment);
    font-size: 14px;
}

*:hover > .expand-hint,
td:hover .expand-hint {
    opacity: 0.9;
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    #main-content {
        flex-direction: column;
        overflow-y: auto;
    }

    #left-column, #right-column {
        flex: none;
        overflow-y: visible;
    }

    #market-container {
        max-height: 50vh;
    }

    #message-log {
        min-height: 150px;
        max-height: 200px;
    }
}

/* ===== Welcome Modal ===== */

#welcome-modal {
    z-index: 55;
}

.welcome-modal-content {
    max-width: 520px;
    text-align: left;
}

.welcome-map {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid var(--gold-dim);
    margin-bottom: 16px;
    filter: sepia(0.4) brightness(0.85);
}

.welcome-heading {
    font-family: var(--font-heading);
    font-size: 1.4em;
    color: var(--wood);
    text-align: center;
    margin: 0 0 14px;
    letter-spacing: 1px;
}

.welcome-body p {
    font-size: 0.95em;
    line-height: 1.65;
    margin: 0 0 10px;
    color: var(--ink);
}

.welcome-cta {
    font-style: italic;
    color: var(--ink-light);
}

.welcome-dismiss {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: var(--ink-light);
    cursor: pointer;
    margin: 14px 0 6px;
    justify-content: center;
}

.welcome-dismiss input[type="checkbox"] {
    accent-color: var(--gold);
}

.welcome-continue-btn {
    display: block;
    margin: 10px auto 0;
    padding: 10px 36px;
    font-size: 1.05em;
}
