/* The expedition desk: warm paper, forest ink, and a consistent control rhythm. */
:root {
  --ui-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --panel-surface: #fcfbf7;
  --panel-line: #e2e5dc;
  --panel-ink: #213e35;
  --panel-muted: #6b7669;
  --panel-accent: #315b47;
}
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.ui-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { grid-template-columns: clamp(320px, 27vw, 384px) minmax(0, 1fr); }
.game-panel {
  padding: 22px;
  background: var(--panel-surface);
  border: 1px solid #e1e4d9;
  border-radius: 18px;
  box-shadow: 0 3px 5px #263d2b03, 0 12px 36px #263d2b05;
  font-family: var(--ui-font);
  scrollbar-color: #cbd3c6 transparent;
  scrollbar-gutter: auto;
}
.game-panel > * { flex-shrink: 0; }
.panel-kicker { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; color: #7b8476; font: 9px var(--font); letter-spacing: 1.3px; }
.history-controls { display: flex; align-items: center; gap: 4px; }
.history-controls button { display: grid; place-items: center; width: 32px; height: 30px; padding: 0; border: 1px solid #dde5d4; border-radius: 7px; background: #f3f7ec; color: #50713f; font: 23px/1 var(--ui-font); }
.history-controls button:hover:not(:disabled) { border-color: #abc29a; background: #e9f1de; }
.history-controls button:disabled { color: #afb8a5; border-color: #ecede5; background: transparent; }
.history-controls #sea-hint-button { position: relative; margin-left: 7px; color: #77501a; border-color: #d3b475; background: #f3dba2; box-shadow: 0 1px 3px #88632014; }
.history-controls #sea-hint-button:hover:not(:disabled) { border-color: #b99041; background: #efcd83; }
.history-controls #sea-hint-button:disabled { color: #a49a83; border-color: #e4ddcc; background: #f0ece2; box-shadow: none; }
.hint-action .ui-icon { width: 18px; height: 18px; stroke-width: 1.7; }
.hint-action #sea-hints-count { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; min-width: 15px; height: 15px; padding: 0 3px; border: 1px solid #fcfbf7; border-radius: 8px; background: #815e26; color: #fff9e9; font: 600 9px/1 var(--ui-font); letter-spacing: 0; }
.hint-action:disabled #sea-hints-count { background: #c2bba9; color: #fffefa; }
.region-footer i { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: #86a077; }
.game-panel #task-title { margin: 0 0 5px; color: #203b32; font: 600 26px/1.2 var(--ui-font); letter-spacing: -.9px; }
.task-description { margin: 0 0 18px; color: var(--panel-muted); font-size: 12px; line-height: 1.6; }
.task-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.task-steps > span { display: flex; align-items: center; gap: 7px; padding: 0 0 9px; border-bottom: 2px solid #e9ebe4; color: #899184; font-size: 11px; }
.task-steps b { font: 10px var(--font); opacity: .8; }
.task-steps [aria-current] { border-color: #4f7258; color: var(--panel-ink); font-weight: 600; }
.task-steps .is-complete { border-color: #afc3a5; color: #627e59; }
.game-panel .silhouette-card {
  float: none;
  width: 100%;
  height: auto;
  padding: 13px 15px 0;
  margin: 0 0 20px;
  border: 1px solid #dde3d4;
  border-radius: 12px;
  background-color: #eff1e7;
  background-image: radial-gradient(#a2b09740 .65px, transparent .65px), radial-gradient(ellipse at 50% 42%, #fcfcf580, transparent 75%);
  background-size: 12px 12px, auto;
  transition: border-color .18s, box-shadow .18s;
}
.game-panel .silhouette-card:hover { border-color: #a1b595; box-shadow: 0 3px 16px #4561480c; }
.outline-meta { display: flex; align-items: center; justify-content: space-between; color: #7d8b73; font: 8px var(--font); letter-spacing: 1.2px; }
.outline-meta > span:last-child { font-size: 10px; }
.game-panel .silhouette-card svg { height: 109px; margin: 4px 0 3px; filter: drop-shadow(0 5px 4px #344f2910); }
.game-panel #silhouette path { fill: #42634b; stroke: #35573f; }
.game-panel .card-bottom { min-height: 33px; margin: 0 -15px; padding: 8px 13px; border-top: 1px solid #cfd9c66b; background: #fcfcf24d; color: #64785b; font: 10px var(--ui-font); letter-spacing: 0; }
.game-panel .card-bottom > span:last-child { font-size: 16px; letter-spacing: 0; }
.game-panel .field-label { color: #64715f; font: 500 9px/1.4 var(--font); letter-spacing: 1px; margin-bottom: 8px; }
.game-panel input, .modal input[type="text"] { min-height: 46px; padding: 12px 14px; border: 1px solid #dce1d5; border-radius: 9px; background: #fffefa; color: #253e31; font: 13px var(--ui-font); box-shadow: 0 1px 3px #233c2903; }
.game-panel input::placeholder, .modal input::placeholder { color: #939b8c; }
.game-panel input:focus-visible, .modal input[type="text"]:focus-visible { border-color: #6e926a; outline: 3px solid #779b6220; outline-offset: 0; }
.game-panel .autocomplete-list { background: #fffefa; border-color: #d4ddcc; border-radius: 10px; padding: 5px; box-shadow: 0 8px 24px #243d2a14; }
.game-panel .autocomplete-list button { min-height: 40px; font-family: var(--ui-font); font-size: 13px; border-radius: 6px; }
.flag-field-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 18px 0 9px; }
.game-panel .flag-field-heading .flag-label { margin: 0; }
.selection-status { color: #6d7966; font-size: 10px; }
.selection-status.is-selected { color: #527342; }
.selection-status.is-selected::before { content: '✓'; margin-right: 4px; }
.game-panel .flag-options { gap: 7px; margin-bottom: 16px; }
.game-panel .flag-option { height: 48px; border: 1px solid #e0e4d8; border-radius: 8px; background: #f8f8f2; box-shadow: 0 1px 2px #1b372104; }
.game-panel .flag-option:hover { background: #f0f3e8; border-color: #a7bb99; }
.game-panel .flag-option.selected { border: 1px solid #6b8e5b; background: #eaf0e0; box-shadow: 0 0 0 2px #7b9f6220; }
.game-panel .flag-option.selected::after { right: 4px; bottom: 2px; font-size: 10px; color: #466f36; }
.game-panel .flag-option img { max-width: 44px; max-height: 29px; }
.game-panel .flag-options.all-flags { max-height: 224px; padding: 3px; border: 1px solid #e7eadf; border-radius: 10px; overscroll-behavior: contain; }
.game-panel .primary-button, .modal .primary-button { min-height: 46px; padding: 12px 15px; border: 1px solid #244936; border-radius: 9px; background: #244936; color: #f9fcf3; font: 600 12px/1.4 var(--ui-font); box-shadow: 0 2px 4px #1d3b2110; }
.game-panel .primary-button:hover:not(:disabled), .modal .primary-button:hover:not(:disabled) { background: #365e42; border-color: #365e42; box-shadow: 0 3px 8px #1d3b211a; }
.game-panel .primary-button:disabled, .modal .primary-button:disabled { background: #e7eade; border-color: #e7eade; color: #8b9583; box-shadow: none; }
.answer-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.game-panel .answer-actions .primary-button { font-size: 12px; gap: 6px; padding-inline: 12px; }
.game-panel .round-actions { margin: 0; display: flex; }
.game-panel .round-actions .text-button { width: auto; min-width: 0; min-height: 46px; padding: 10px; border: 1px solid #e0e5d7; border-radius: 9px; background: #fafbf5; color: #6e805f; font: 11px var(--ui-font); white-space: nowrap; text-align: center; }
.game-panel .round-actions .text-button:hover:not(:disabled) { background: #edf2e5; border-color: #adbf9e; }
.game-panel .round-actions .text-button:disabled { opacity: 1; color: #a1a895; border-color: #eceee5; background: transparent; }
.game-panel .round-actions .text-button[data-postpone] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding-block: 6px; line-height: 14px; }
.action-time-cost { display: block; color: #8a7851; font-size: 9px; line-height: 11px; }
.text-button:disabled .action-time-cost { color: #a9aa99; }
.game-panel .draft-identity { border: 1px solid var(--panel-line); background: #f3f5ec; border-radius: 9px; padding: 12px; margin-bottom: 12px; }
.game-panel .draft-identity > span { font-size: 13px; }
.game-panel .draft-identity > button { min-height: 32px; padding: 5px; color: #547644; font: 11px var(--ui-font); }
.game-panel .placement-status { min-height: 38px; padding: 9px 0; color: #7c8874; font: 11px/1.5 var(--font); }
.game-panel .placement-status.placed { color: #4d7441; }
#placement-panel > .round-actions { justify-content: flex-start; }
#placement-panel > .round-actions .text-button { width: auto; padding: 9px 12px; border: 1px solid #e0e5d7; }
.country-tools:not(:has(button:not([hidden]))) { display: none; }
.game-panel .manage-placed { display: flex; align-items: center; gap: 10px; min-height: 46px; margin-top: 20px; padding: 11px 13px; border: 1px solid #e0e5d7; border-radius: 10px; background: #f6f7ef; color: #48613e; font: 500 12px var(--ui-font); text-align: left; }
.game-panel .manage-placed:hover:not(:disabled) { border-color: #acbd9d; background: #f0f4e7; }
.game-panel .manage-placed:disabled { opacity: .65; }
.manage-placed .ui-icon { width: 18px; height: 18px; color: #738a65; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; padding: 3px 7px; border: 1px solid #e3e7d9; border-radius: 5px; background: #f3f5eb; color: #718160; font: 9px/1.3 var(--font); letter-spacing: 0; white-space: nowrap; }
.manage-placed .count-badge { margin-left: auto; }
.manage-placed > span:last-child { font-size: 15px; color: #8a9a7e; }
.game-panel .country-stack { margin: 18px 0 0; padding: 17px 0 0; border: 0; border-top: 1px solid #e5e8dd; background: none; }
.game-panel .hint-heading { min-height: 20px; margin-bottom: 10px; }
.game-panel .hint-heading .eyebrow { color: #6e7b62; font: 9px var(--font); letter-spacing: 1px; }
.game-panel #stack-count { font-size: 9px; color: #718160; }
.game-panel .stack-empty { display: flex; align-items: center; gap: 9px; color: #6d7966; font-size: 11px; line-height: 1.5; margin: 2px 0 0; padding: 3px 0; }
.stack-empty .ui-icon { width: 16px; height: 16px; color: #9aa78d; }
.game-panel .stack-list { gap: 7px; max-height: 188px; padding: 2px; overscroll-behavior: contain; }
.game-panel .stack-item { padding: 8px; border: 1px solid #e0e5d5; border-radius: 8px; background: #f1f4e9; }
.game-panel .stack-item:hover { border-color: #9eb38e; background: #e9efde; }
.game-panel .stack-item svg { height: 43px; }
.game-panel .stack-item span { font: 10px var(--ui-font); }
.game-panel h1 { color: var(--panel-ink); font-family: var(--ui-font); }
.game-panel .intro { font-family: var(--ui-font); font-size: 13px; }
.game-panel .text-button { font-family: var(--ui-font); }

/* Completion time leads the results, with actual play and action costs kept visible. */
.expedition-time { margin: 22px 0; padding: 22px 24px 18px; border: 1px solid #dce5d1; border-radius: 14px; background: linear-gradient(125deg, #edf3e5, #f7f8ef); }
.time-eyebrow { display: block; color: #667b56; font: 500 10px/1.5 var(--font); letter-spacing: 1.6px; }
.time-total { display: block; margin: 8px 0 17px; color: #294a36; font: 600 64px/1.08 var(--ui-font); letter-spacing: -2.5px; font-variant-numeric: tabular-nums; }
.time-breakdown { display: flex; flex-wrap: wrap; gap: 12px 34px; padding-top: 14px; border-top: 1px solid #d7e1cb; }
.time-breakdown > span { display: grid; gap: 4px; color: #78856b; font: 11px/1.4 var(--ui-font); }
.time-breakdown strong { color: #4f6640; font: 600 16px/1.3 var(--ui-font); font-variant-numeric: tabular-nums; }
.has-penalties [data-time-penalty] { color: #99723d; }
.time-details { margin: 14px 0 0; color: #738266; font: 10px/1.7 var(--ui-font); }
.game-panel .expedition-time { margin: 21px 0 12px; padding: 18px; }
.game-panel .time-total { font-size: 44px; letter-spacing: -1.5px; }
.game-panel .time-eyebrow { font-size: 9px; letter-spacing: 1px; }
.game-panel .time-breakdown { gap: 12px 24px; }
.game-panel .mini-results { margin: 10px 0 24px; }

/* Keep the player's answer and its correction together on the same map anchor. */
.country-label.result-label { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 5px; row-gap: 0; padding: 4px 7px; cursor: pointer; }
.country-label.result-label > img { grid-column: 1; grid-row: 1; }
.country-label.result-label > span { grid-column: 2; grid-row: 1; min-width: 0; text-align: left; }
.country-label.result-label > img[hidden] + span { grid-column: 1 / -1; }
.country-label.result-label.locked:not(.compact)::before { display: none; }
.country-label.result-label.name-wrong > span { color: #e7b7a1; text-decoration: line-through; text-decoration-color: #d19378; }
.country-label.result-label.flag-wrong > img { outline-color: #e0a17f; box-shadow: 0 0 0 2px #d9957133; }
.answer-correction { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 4px; padding-top: 4px; border-top: 1px solid #b5d49c33; color: #d3ecb9; line-height: 1.2; text-align: left; }
.answer-correction .correction-mark { flex-shrink: 0; color: #a8d786; font-size: 10px; }
.answer-correction img { width: 15px; max-height: 11px; flex-shrink: 0; object-fit: contain; outline: 1px solid #d8e9ca55; background: #fff; }
.answer-correction .correct-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.country-label.result-label.expanded .correct-name { white-space: normal; overflow-wrap: anywhere; }
.country-label.result-label.compact { display: grid; grid-template-columns: 1fr; place-items: center; padding: 0; }
.country-label.result-label.compact .answer-correction { display: none; }

/* Dialogs share the desk's materials; country actions use one stable row layout. */
.modal { background: var(--panel-surface); border: 1px solid #e1e5d7; border-radius: 18px; font-family: var(--ui-font); box-shadow: 0 24px 100px #071c2b40, 0 2px 8px #071c2b10; }
.modal::backdrop { background: #0c222960; backdrop-filter: blur(8px); }
.modal h2 { color: #203c32; font-family: var(--ui-font); font-weight: 600; letter-spacing: -1.1px; }
.modal .eyebrow, .modal .field-label { font-family: var(--font); color: #7b896c; }
.modal .intro { color: #6c7863; font-size: 13px; line-height: 1.7; }
.modal .quiet-note { color: #6f7b64; font-size: 11px; }
.modal .close-modal { width: 36px; height: 36px; top: 17px; right: 17px; border: 1px solid #e4e8dc; border-radius: 9px; color: #6d805e; background: #f7f8f1; font: 22px/1 var(--ui-font); }
.modal .close-modal:hover { background: #eaf0e0; color: #3e5c32; }
.modal button:focus-visible { outline: 2px solid #739467; outline-offset: 3px; }
.modal .tool-button { border-radius: 8px; font-family: var(--ui-font); font-size: 12px; }
.modal .difficulty-options label { border-radius: 10px; background: #f9faf4; border-color: #e0e5d5; }
.modal .difficulty-options label:has(input:checked) { border-color: #97b381; background: #edf3e4; }
.modal .difficulty-options small { font-size: 11px; }
.modal .library-flag { background: #f5f7ed; border-color: #e1e6d6; border-radius: 8px; }
.modal .library-flag.selected { background: #e8f0dc; border-color: #86a572; }
.region-modal { width: 460px; max-width: calc(100vw - 32px); max-height: calc(100svh - 32px); padding: 28px; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.region-modal > .eyebrow { display: block; margin: 0 42px 9px 0; font-size: 9px; letter-spacing: 1.5px; }
.region-modal h2 { margin: 0 32px 21px 0; padding: 0; font-size: 28px; line-height: 1.25; letter-spacing: -.9px; overflow-wrap: anywhere; }
.region-overview { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: center; padding-bottom: 22px; margin-bottom: 2px; border-bottom: 1px solid #e6e9df; }
.region-preview { display: block; width: 112px; height: 84px; padding: 7px; border: 1px solid #e2e8d7; border-radius: 10px; background: radial-gradient(#a2b09740 .65px, transparent .65px) #f0f3e8; background-size: 10px 10px; fill: #4d6d4e; }
.region-kind { display: inline-block; color: #687b59; font: 9px/1.5 var(--font); letter-spacing: .7px; }
#region-status { margin: 7px 0 0; color: #6c7962; font: 12px/1.6 var(--ui-font); }
.region-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; margin: 18px 0; }
.region-actions .region-action { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; margin: 0; padding: 11px 12px; border: 1px solid #e4e8dc; border-radius: 10px; background: #fffefa; color: #3e5b36; text-align: left; }
.region-actions #region-link, .region-actions #region-detach { margin: 0; }
.region-actions .region-action:hover:not(:disabled) { background: #f0f5e8; border-color: #b6cba5; }
.region-action .action-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid #e3e9da; border-radius: 9px; color: #718b5f; background: #f2f6ea; }
.region-action .action-question { font: 500 19px var(--ui-font); }
.action-copy { display: grid; min-width: 0; gap: 3px; }
.action-title { display: block; color: #3e5635; font: 600 13px/1.35 var(--ui-font); }
.action-description { display: block; color: #6c7962; font: 11px/1.4 var(--ui-font); }
.action-arrow { margin-left: auto; padding-left: 4px; color: #95a585; font-size: 18px; flex-shrink: 0; }
.region-actions .region-action:disabled { opacity: 1; background: #f9faf4; border-color: #ecefe4; }
.region-action:disabled .action-title { color: #a0aa94; }
.region-action:disabled .action-description { color: #a1aa96; }
.region-action:disabled .action-icon { color: #a4b097; background: #f4f6ee; border-color: #e9ede0; }
.region-actions .region-action.selected { background: #edf4e2; border-color: #b3c99d; }
.region-action.selected .action-icon { color: #587a40; background: #e4eed7; border-color: #ccddbb; }
.action-toggle { display: block; width: 28px; height: 16px; flex: 0 0 auto; padding: 2px; margin-left: auto; border-radius: 20px; background: #dce2d3; transition: background .18s; }
.action-toggle::after { content: ''; display: block; width: 12px; height: 12px; border-radius: 50%; background: #fffef8; box-shadow: 0 1px 2px #27382220; transition: transform .18s; }
.selected .action-toggle { background: #729354; }
.selected .action-toggle::after { transform: translateX(12px); }
.region-footer { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 19px 0 0; color: #6c7962; font-size: 10px; line-height: 1.5; }

@media (min-width: 901px) and (max-height: 850px) {
  .game-panel { padding: 18px; }
  .panel-kicker { margin-bottom: 8px; }
  .task-description { margin-bottom: 8px; }
  .task-steps { margin-bottom: 12px; }
  .game-panel .silhouette-card { padding-top: 11px; margin-bottom: 16px; }
  .game-panel .silhouette-card svg { height: 76px; }
  .game-panel .card-bottom { min-height: 30px; }
  .flag-field-heading { margin-top: 14px; }
  .game-panel .flag-options { margin-bottom: 12px; }
  .game-panel .flag-option { height: 44px; }
  .game-panel .flag-options.all-flags { max-height: 158px; }
  .game-panel .manage-placed { margin-top: 16px; }
}

@media (min-width: 901px) and (max-width: 1150px) {
  .workspace { grid-template-columns: 320px minmax(0, 1fr); }
  .game-panel { padding: 18px; }
  .panel-kicker { font-size: 8px; letter-spacing: 1px; }
}
@media (max-width: 900px) {
  .game-panel { display: flex; flex-direction: column; order: 2; padding: 22px; overflow: visible; }
  .game-panel > .panel-kicker { order: -1; }
  .game-panel .silhouette-card svg { height: 136px; }
  .game-panel .flag-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-panel .flag-option { height: 54px; }
  .game-panel .flag-options.all-flags { max-height: 260px; }
  .game-panel #task-body, .game-panel #stack-wait-panel, .game-panel #finished-panel { order: 0; }
  .game-panel .manage-placed { order: 1; }
  .game-panel .country-stack { order: 2; }
}
@media (max-width: 650px) {
  .game-panel { padding: 19px; border-radius: 15px; }
  .expedition-time { padding: 20px 18px 16px; margin-block: 20px; }
  .time-total { font-size: 46px; letter-spacing: -1.5px; }
  .time-eyebrow { font-size: 9px; letter-spacing: 1.2px; }
  .time-breakdown { gap: 12px 28px; }
  .history-controls button { width: 44px; height: 44px; }
  .game-panel #task-title { font-size: 25px; }
  .game-panel input, .modal input[type="text"] { font-size: 16px; }
  .game-panel .task-description { font-size: 12px; }
  .game-panel .task-steps { display: grid; }
  .game-panel .flag-option { height: 54px; }
  .game-panel .flag-option img { max-width: 46px; max-height: 30px; }
  .game-panel .primary-button, .game-panel .round-actions .text-button { min-height: 48px; }
  .region-modal { padding: 24px 20px 20px; }
  .region-modal .close-modal { width: 40px; height: 40px; top: 14px; right: 14px; }
  .region-modal h2 { font-size: 27px; }
  .region-overview { grid-template-columns: 95px minmax(0, 1fr); gap: 13px; }
  .region-preview { width: 95px; height: 78px; }
  .region-actions .region-action { min-height: 65px; gap: 10px; padding: 11px; }
  .region-action .action-icon { width: 32px; height: 32px; }
}
@media (max-width: 360px) {
  .game-panel { padding: 15px; }
  .game-panel .time-total, .time-total { font-size: 38px; }
  .panel-kicker { font-size: 8px; letter-spacing: .8px; }
  .game-panel .answer-actions { gap: 6px; }
  .game-panel .round-actions .text-button { padding-inline: 8px; font-size: 10px; }
  .region-modal { padding: 22px 16px 18px; }
  .region-overview { grid-template-columns: 80px minmax(0, 1fr); gap: 11px; }
  .region-preview { width: 80px; height: 76px; }
  .region-actions .region-action { gap: 9px; padding-inline: 9px; }
  .action-description { font-size: 10px; }
  .action-title { font-size: 12px; }
}
