/* Shipwreck Salvage: the salvage order and controls beside the chart table, inside the practice shell's stage. */
.sw { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; padding: 8px 12px; color: var(--tlg-text, #172c38); }
.sw-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 2px; }

/* the salvage order */
.sw-ticket { padding: 8px 12px 10px; border-radius: var(--tlg-radius-lg, 14px); border: 2px dashed #6b9db0; background: #eef6f8; color: #10303d; }
.sw-ticket-k { margin: 0 0 4px; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps, .08em); color: #1f5f7a; }
.sw-target { margin: 2px 0 4px; font-size: 26px; font-weight: 900; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.sw-rule { margin: 4px 0 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
.sw-rule.is-formula { font-size: 18px; font-weight: 800; padding: 6px 10px; border-radius: 10px; background: #fff; border: 1.5px solid #b9d6de; }
html[data-theme="dark"] .sw-ticket { background: #13262e; color: #e3f1f3; border-color: #3f7a8e; }
html[data-theme="dark"] .sw-ticket-k { color: #8fd0e4; }
html[data-theme="dark"] .sw-rule.is-formula { background: #0d1c22; border-color: #3f7a8e; }

/* controls */
.sw-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.sw-field legend { padding: 0; margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.sw-axis-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sw-num { display: inline-flex; align-items: center; gap: 4px; }
.sw-num input { font: inherit; font-size: 20px; font-weight: 800; width: 84px; min-height: 48px; padding: 6px 8px; text-align: right; color: var(--tlg-text, #172c38);
  background: var(--tlg-surface, #fff); border: 2px solid var(--tlg-border, #a5b6c1); border-radius: 10px; font-variant-numeric: tabular-nums; }
.sw-num.is-km input { width: 150px; }
.sw-unit { font-size: 20px; font-weight: 800; }
.sw-hemi, .sw-mins { display: inline-flex; gap: 4px; }
.sw-hem, .sw-min, .sw-choice { position: relative; font: inherit; cursor: pointer; color: var(--tlg-text, #172c38); background: var(--tlg-surface, #fff); border: 2px solid var(--tlg-border, #a5b6c1);
  border-radius: 10px; box-shadow: 0 2px 0 rgba(0, 0, 0, .1); touch-action: manipulation; }
.sw-hem { min-width: 48px; min-height: 48px; font-size: 20px; font-weight: 900; }
.sw-min { min-width: 44px; min-height: 48px; padding: 0 6px; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sw-choices { display: grid; gap: 8px; }
.sw-choice { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 6px 30px 6px 12px; text-align: left; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sw-hem:hover:not(:disabled), .sw-min:hover:not(:disabled), .sw-choice:hover:not(:disabled) { border-color: #1f5f7a; }
.sw-hem[aria-pressed="true"], .sw-min[aria-pressed="true"], .sw-choice[aria-pressed="true"] { border-color: #1f5f7a; border-width: 3px; background: #dff0f5; box-shadow: 0 0 0 3px rgba(31, 95, 122, .25); }
.sw-choice[aria-pressed="true"] .sw-choice-l::before { content: '● '; color: #1f5f7a; }
.sw-hem[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 4px; }
html[data-theme="dark"] .sw-hem[aria-pressed="true"], html[data-theme="dark"] .sw-min[aria-pressed="true"], html[data-theme="dark"] .sw-choice[aria-pressed="true"] { background: #173341; border-color: #8fd0e4; }
html[data-theme="dark"] .sw-choice[aria-pressed="true"] .sw-choice-l::before { color: #8fd0e4; }
.sw button:disabled, .sw input:disabled { cursor: default; opacity: 1; }
.sw-choice.is-ok { border-color: #2e8b57; border-width: 3px; }
.sw-choice.is-bad { border-color: #b42318; border-style: dashed; border-width: 3px; }
.sw-field.is-ok input { border-color: #2e8b57; border-width: 3px; }
.sw-field.is-bad input { border-color: #b42318; border-style: dashed; border-width: 3px; }
.sw-mark { position: absolute; top: 4px; right: 8px; font-size: 18px; font-weight: 900; }
.sw-choice.is-ok .sw-mark { color: #1d6b40; }
.sw-choice.is-bad .sw-mark { color: #b42318; }
html[data-theme="dark"] .sw-choice.is-ok .sw-mark { color: #8fe0ad; }
html[data-theme="dark"] .sw-choice.is-bad .sw-mark { color: #ffb4a8; }
.sw-tip { margin: 0; font-size: 16px; line-height: 1.35; color: var(--tlg-text-muted, #44606d); }
.sw-msg { margin: 0; font-size: 16px; font-weight: 700; color: #8a3b12; }
.sw-msg:empty { display: none; }
html[data-theme="dark"] .sw-msg { color: #ffbf8a; }
.sw-about { font-size: 16px; line-height: 1.45; }
.sw-about summary { cursor: pointer; font-weight: 700; }
.sw-about p { margin: 6px 0 0; }
.sw :focus-visible { outline: 3px solid #b16a08; outline-offset: 2px; }

/* the chart table */
.sw-view { position: relative; min-width: 0; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.sw-scene { position: relative; width: 100%; aspect-ratio: 720 / 620; border-radius: var(--tlg-radius-lg, 14px); overflow: hidden; border: var(--tlg-border-width, 1px) solid var(--tlg-border, #a5b6c1); user-select: none; -webkit-user-select: none; }
.sw-scene.is-plot { cursor: crosshair; touch-action: none; }
.sw.is-locked .sw-scene.is-plot { cursor: default; }
.sw-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sw-table { fill: url(#sw-g-wood); }
html[data-theme="dark"] .sw-table { fill: url(#sw-g-wood-d); }
.sw-paper { fill: #f7f0dc; stroke: #c9b98f; stroke-width: 1.5; }
.sw-tray { fill: #24160c; fill-opacity: .45; }
.sw-land { fill: url(#sw-g-land); stroke: #8a6a3a; stroke-width: 1.5; }
.sw-grid { stroke: #2f6f86; stroke-width: 1; stroke-opacity: .45; fill: none; }
.sw-grid.is-major { stroke-width: 1.6; stroke-opacity: .6; }
.sw-grid.is-zero { stroke: #1a4252; stroke-width: 2.6; stroke-opacity: .9; }
.sw-contour { fill: none; stroke: #6aa3b6; stroke-width: 1.4; stroke-dasharray: 3 5; opacity: .7; }
.sw-meridian { fill: none; stroke: #b3261e; stroke-width: 2.5; stroke-dasharray: 8 6; opacity: .7; }
.sw-ruler { fill: none; stroke: #22323a; stroke-width: 4; stroke-linecap: round; }
.sw-wake { fill: none; stroke: #ffffff; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 2 8; opacity: .9; }
.sw-miss { stroke: #b42318; stroke-width: 3.5; stroke-dasharray: 8 6; fill: none; }
.sw-guide { stroke: #c2410c; stroke-width: 3; stroke-dasharray: 8 6; fill: none; }
.sw-card { fill: #fffdf6; stroke: #8a6a24; stroke-width: 2; }

.sw-t { font-family: var(--tlg-font-body, system-ui, sans-serif); fill: #10202c; }
.sw-t-rail { font-size: 19px; font-weight: 800; fill: #f6e7c8; letter-spacing: .04em; }
.sw-t-fine { font-size: 17px; font-weight: 600; fill: #e9d9b8; font-style: italic; }
.sw-t-ax { font-size: 17px; font-weight: 800; fill: #1a3440; font-variant-numeric: tabular-nums; }
.sw-t-min { font-size: 16px; font-weight: 700; fill: #3d6676; }
.sw-t-line { font-size: 16px; font-weight: 800; font-style: italic; fill: #1a4252; paint-order: stroke; stroke: #e3f1f3; stroke-width: 4px; }
.sw-t-rose { font-size: 16px; font-weight: 900; fill: #f6e7c8; }
.sw-t-card { font-size: 19px; font-weight: 800; fill: #10202c; font-variant-numeric: tabular-nums; }
.sw-t-tag { font-size: 17px; font-weight: 900; fill: #10202c; }
.sw-t-tag2 { font-size: 17px; font-weight: 800; fill: #7a1c14; paint-order: stroke; stroke: #e3f1f3; stroke-width: 4px; }
.sw-t-chip { font-size: 17px; font-weight: 800; fill: #10202c; }
.sw-chip rect { fill: #fffdf6; stroke: #22323a; stroke-width: 2; }
.sw-chip.is-ok rect { fill: #e6f6ea; stroke: #1d6b40; stroke-width: 3; }
.sw-chip.is-ok .sw-t-chip { fill: #14532d; }
.sw-chip.is-bad rect { fill: #fdecea; stroke: #b42318; stroke-width: 3; stroke-dasharray: 6 4; }
.sw-chip.is-bad .sw-t-chip { fill: #8a1a10; }
.sw-chip.is-info rect { fill: #fff7e0; stroke: #c2410c; stroke-width: 2.5; }

/* reveal badge (over the rail) */
.sw-badge { position: absolute; left: 2%; right: 2%; top: 1%; padding: 7px 12px; border-radius: 10px; font-size: 17px; font-weight: 700; line-height: 1.3; pointer-events: none;
  background: rgba(255, 255, 255, .97); color: #10202c; border: 3px solid #1f5f7a; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); animation: sw-pop .25s ease-out; }
.sw-badge.is-ok { border-color: #1d6b40; }
.sw-badge.is-bad { border-color: #b42318; }
@keyframes sw-pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* briefing + start */
.sw-example-svg { display: block; width: 100%; height: auto; max-height: 460px; }
.sw-start-svg { display: block; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) { .sw-badge { animation: none; } }
@media (max-width: 1100px) { .sw { grid-template-columns: 300px minmax(0, 1fr); } }
@media (max-width: 900px) {
  .sw { position: static; grid-template-columns: 1fr; }
  .sw-panel { overflow: visible; }
  .sw-view { display: block; order: -1; }
  .sw-scene { width: 100% !important; }
}
