/* Ruins boards: scoped to the existing task and navigation contract. */
.outpost.ruins.ruins-task {
  --ruins-gold: #eed08a;
  --ruins-ink: #f5edd8;
  position: relative;
  isolation: isolate;
  gap: 10px;
  padding: 0 0 16px;
  color: var(--ruins-ink);
}
.ruins-task::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  border-radius: 18px;
  background: linear-gradient(180deg, #101b1bb8, #101b1bf5 86%), var(--ruins-scene) center top / cover no-repeat;
}
.ruins-task .ruins-task-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.ruins-task-nav > span { font-size: 10px; color: #d8d7c8; text-align: right; line-height: 1.4; }
.ruins-task-nav i { padding: 0 3px; font-style: normal; color: #bfa36d; }
.ruins-task .ruins-back.outpost-secondary {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  width: auto;
  min-height: 44px;
  padding: 6px 12px 6px 8px;
  border: 1px solid #d5d6b82f;
  border-radius: 12px;
  background: #172727db;
  font-size: 12px;
  color: #eee7d3;
}
.ruins-back > span { font-size: 28px; font-weight: 400; line-height: 18px; }
.ruins-task .ruins-task-card.outpost-card {
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  border: 1px solid #b7a7775e;
  border-radius: 19px;
  background: linear-gradient(160deg, #20352cec, #142827ed 55%, #162423f5);
  box-shadow: 0 8px 20px #07151240, inset 0 1px #fff4cc12;
}
.ruins-task .ruins-task-card > .ruins-task-heading {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  text-align: left;
}
.ruins-task-heading > * { max-width: 100%; }
.ruins-task .ruins-eyebrow {
  margin: 0 0 7px;
  color: #d5bd81;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ruins-eyebrow > span { color: #aebdb0; white-space: nowrap; }
.ruins-task .ruins-task-heading h3 {
  margin: 0;
  color: #fff3d7;
  font-size: clamp(20px, 5.6vw, 25px);
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.ruins-task h3:focus { outline: none; }
.ruins-task .ruins-task-goal { margin: 9px 0 0; color: #cfdbcd; font-size: 12px; line-height: 1.5; }
.ruins-task .ruins-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin: 14px 0;
  color: #b6c7b8;
  font-size: 11px;
}
.ruins-progress b { margin-left: 7px; color: #f8e1a4; font-size: 15px; font-variant-numeric: tabular-nums; }
.ruins-progress b span { color: #abbbaa; font-size: 11px; font-weight: 500; }
.ruins-task .ruins-progress small { margin: 0; color: #e9d59f; font-size: 10px; }
.ruins-progress-track { flex: 0 0 100%; height: 5px; overflow: hidden; background: #091c19; border-radius: 5px; box-shadow: 0 1px #e8dbaa18; }
.ruins-progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8eaa72, #e7c77d); }
.ruins-task .ruins-clue {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #d9c58c36;
  border-radius: 10px;
  background: #101f1dbf;
  color: #e5dfc8;
  font-size: 11px;
}
.ruins-clue-label { display: block; margin-bottom: 6px; color: #aebeac; font-size: 10px; }
.ruins-clue-sequence { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; margin: 0; padding: 0; }
.ruins-clue-sequence li { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; border: 1px solid #849e812e; border-radius: 5px; line-height: 1.4; }
.ruins-clue-sequence li.is-current { background: #efcf8e; border-color: #ffe4ac; color: #2b2e1e; }
.ruins-clue-sequence li.is-done { color: #9cbaa5; border-color: #77ab7d55; }
.ruins-clue-step { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #82917b22; font-size: 9px; font-weight: 700; }
.ruins-clue-all { margin: 2px 0 -6px; }
.ruins-clue-all summary { display: flex; align-items: center; gap: 7px; min-height: 40px; width: fit-content; color: #c5cbb0; cursor: pointer; font-size: 10px; }
.ruins-clue-all summary::before { content: "＋"; color: #e7ce8e; font-size: 15px; }
.ruins-clue-all[open] summary::before { content: "−"; }
.ruins-clue-all summary::-webkit-details-marker { display: none; }
.ruins-clue-all[open] { padding-bottom: 8px; }
.ruins-clue-all summary:focus-visible { outline: 2px solid #ffeba8; outline-offset: 2px; border-radius: 5px; }
.ruins-clue-sequence.is-preview { flex-wrap: nowrap; }
.ruins-clue-sequence.is-preview li { flex: 1 1 0; min-width: 0; font-size: 11px; }
.ruins-clue-sequence.is-preview .ruins-clue-step { flex: 0 0 17px; }
.ruins-map-clue { display: flex; justify-content: space-between; align-items: center; }
.ruins-map-clue strong { color: #f8d995; font-size: 20px; letter-spacing: .1em; }
.ruins-task .ruins-load { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; font-size: 11px; color: #c4d3c4; }
.ruins-load > strong { display: grid; place-items: center; width: 31px; height: 31px; background: #d9bd79; color: #22302b; border: 2px solid #fff0b68c; border-radius: 7px; font-size: 18px; }
.ruins-load > span:last-child { margin-left: auto; font-size: 10px; }
.ruins-task .ruins-playfield {
  position: relative;
  min-width: 0;
  padding: 12px 10px 10px;
  border: 1px solid #b6bd8b42;
  border-radius: 14px;
  background: linear-gradient(#10221bc9, #0a191be6), var(--ruins-scene) center / cover;
  box-shadow: inset 0 2px 8px #04140e6b;
}
.ruins-board-caption { margin-bottom: 10px; color: #ced6ba; font-size: 10px; line-height: 1.35; text-align: center; letter-spacing: .015em; }
.ruins-task .ruins-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.ruins-task .ruins-controls.is-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ruins-task .ruins-controls.is-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ruins-task .ruins-controls.is-single { grid-template-columns: minmax(0, 1fr); }
.ruins-task .mode-keys .ruins-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ruins-task .ruins-choice.outpost-secondary {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 80px;
  margin: 0;
  padding: 4px 4px 7px;
  overflow: hidden;
  border: 1px solid #aabe9266;
  border-bottom: 3px solid #0b1916;
  border-radius: 11px;
  background: linear-gradient(145deg, #455a3bf2, #263d2eea 65%);
  color: #f0ead5;
  box-shadow: inset 0 1px #eef6c128, 0 2px 3px #06130f66;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 100ms ease, border-color 100ms ease;
}
.ruins-task .ruins-choice:nth-child(3n + 2) { background: linear-gradient(145deg, #4b5640f2, #303d2eea 65%); }
.ruins-task .ruins-choice:nth-child(3n) { background: linear-gradient(145deg, #3d5847f2, #263b33ea 65%); }
.ruins-task .ruins-choice:enabled:active { transform: translateY(2px); border-bottom-width: 1px; }
.ruins-task button:focus-visible { outline: 2px solid #ffeba8; outline-offset: 3px; }
.ruins-task .ruins-choice:disabled { opacity: .45; }
.ruins-task .ruins-choice.is-collected:disabled { opacity: .72; border-color: #a2bc79; background: #263c2ce8; }
.ruins-choice-art { position: relative; display: grid; flex: 0 0 auto; place-items: center; width: 100%; height: 53px; pointer-events: none; }
.ruins-prop { display: block; width: 65px; height: 100%; max-width: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.ruins-choice-label { position: relative; display: block; flex: 0 0 auto; max-width: 100%; color: inherit; font-size: 10px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; pointer-events: none; }
.ruins-task .mode-find .ruins-choice { justify-content: flex-start; gap: 0; padding: 0 0 6px; }
.mode-find .ruins-choice-art { height: 62px; overflow: hidden; margin-bottom: 5px; background: #192a20; }
.mode-find .ruins-choice-art::after { content: ""; position: absolute; inset: auto 0 0; height: 18px; background: linear-gradient(transparent, #263c2cb8); }
.mode-find .ruins-prop { width: 100%; height: 100%; object-fit: cover; }
.mode-find .ruins-choice-label { padding-inline: 3px; }
.ruins-collected-mark { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #e9e9af; border-radius: 50%; background: #57734a; color: #fff8cb; font-size: 11px; }
.ruins-task .is-key .ruins-choice-art { height: 72px; }
.is-key .ruins-prop { width: 90px; height: 100%; }
.ruins-key-shape { position: absolute; right: 1px; top: 1px; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #dccb97; border-radius: 7px; background: #182c24ed; color: #ffe6a2; font-size: 23px; line-height: 1; }
.ruins-task .is-symbol-tile { min-height: 100px; }
.ruins-key-shape.is-symbol { inset: auto; width: 42px; height: 42px; border: 0; border-radius: 50%; background: #182a23e6; font-size: 33px; }
.ruins-task .mode-order .ruins-controls:has(.is-plank) { grid-template-columns: minmax(0, 1fr); gap: 7px; }
.ruins-task .ruins-choice.is-plank { min-height: 53px; padding: 3px 10px; background: linear-gradient(180deg, #536044b5, #263b2cde); }
.is-plank .ruins-choice-art { height: 42px; justify-items: start; }
.ruins-plank { display: block; height: 42px; width: calc(var(--plank-length) * 20%); min-width: 0; }
.ruins-plank .ruins-prop { width: 100%; height: 100%; max-width: none; object-fit: fill; }
.ruins-task .mode-maze .ruins-controls { gap: 5px; background: #baaa7f42; padding: 5px; border-radius: 11px; }
.ruins-task .ruins-choice.is-maze-cell { min-height: 85px; aspect-ratio: 1; padding: 3px; border-radius: 8px; background: #b29e6d; color: #282e22; border: 1px solid #eadab866; border-bottom: 3px solid #625b3b; }
.is-maze-cell .ruins-choice-art { height: 53px; }
.ruins-task .ruins-choice.is-wall { background: #273831; border-color: #52624b; color: #b1b9a7; }
.ruins-task .ruins-choice.is-visited { background: #d8ba73; border-color: #ffe6a2; }
.ruins-task .ruins-choice.is-position { box-shadow: inset 0 0 0 2px #fff1bf; }
.is-maze-cell .ruins-choice-label { position: absolute; top: 4px; left: 6px; font-size: 10px; }
.ruins-maze-hook { color: #253e30; font-size: 34px; }
.ruins-maze-dot { width: 8px; height: 8px; border-radius: 50%; background: #3d4a3045; }
.ruins-task .ruins-board { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; padding: 7px; border: 1px solid #a7ba8c50; border-radius: 12px; background: #061b17b8; }
.ruins-task .ruins-board .ruins-number-stone { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 1px solid #879a71; border-bottom: 3px solid #1b3025; border-radius: 8px; background: linear-gradient(135deg, #5e7352, #344b38); color: #fff8d6; font-size: clamp(17px, 5.7vw, 28px); text-shadow: 0 1px #172719; }
.ruins-task .ruins-board .is-empty { border: 1px solid #759b7230; background: #20382c88; }
.ruins-task .ruins-number-stone[data-value="16"] { background: linear-gradient(135deg, #8e8b53, #666841); border-color: #cec28a; }
.ruins-task .ruins-number-stone[data-value="32"] { background: linear-gradient(135deg, #b99955, #77643c); border-color: #f0d69b; }
.ruins-task .ruins-number-stone[data-value="64"],.ruins-task .ruins-number-stone[data-value="128"] { background: linear-gradient(135deg, #efd896, #b8934c); color: #2c3526; border-color: #fff0b8; text-shadow: none; }
.ruins-task .mode-merge .ruins-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: ". up ." "left down right"; max-width: 220px; margin: 0 auto; gap: 5px; }
.ruins-task .ruins-choice.is-direction { min-height: 44px; padding: 2px; border-radius: 9px; }
.is-direction .ruins-choice-art { height: 36px; }
.direction-0 { grid-area: left; }.direction-1 { grid-area: right; }.direction-2 { grid-area: up; }.direction-3 { grid-area: down; }
.ruins-direction { font-size: 26px; color: #f7e0a7; }
.ruins-task .ruins-clock { margin: 0 0 12px; padding: 10px; border: 1px solid #b8af7a65; border-radius: 10px; background: #152820e8; color: #ffe2a1; font-size: 12px; font-weight: 650; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums; }
.ruins-task .mode-timing .ruins-clock { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 22px 6px; min-height: 133px; justify-content: center; }
.mode-timing .ruins-clock::before { content: ""; display: block; width: 45px; height: 45px; border: 5px solid #2a3830; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #ffc597, #ae5d43 70%); box-shadow: 0 0 0 1px #8e9a7955, inset 0 2px 3px #fff5; }
.mode-timing .ruins-clock[data-safe="true"]::before { background: radial-gradient(circle at 40% 30%, #ebffa8, #79ad58 70%); box-shadow: 0 0 0 1px #a9c98799, 0 0 20px #bbd87940; }
.ruins-task .ruins-choice.is-primary { flex-direction: row; gap: 10px; min-height: 52px; background: linear-gradient(180deg, #ebd08b, #bea15d); color: #233128; border-color: #f7dfa6; border-bottom-color: #7c6b3d; }
.is-primary .ruins-choice-label { font-size: 12px; }
.is-primary .ruins-choice-art { width: 28px; height: 34px; }
.ruins-step-mark { font-size: 25px; }
.ruins-task .ruins-choice.is-chest-action { flex-direction: column; min-height: 200px; padding: 15px 10px; background: radial-gradient(ellipse at center, #947b3f66, #233c2c); color: #ffe4a2; }
.ruins-task .is-chest-action .ruins-choice-art { width: 100%; height: 140px; }
.is-chest-action .ruins-prop { width: 150px; height: 140px; }
.ruins-task .ruins-choice.is-catch-lane { min-height: 160px; justify-content: space-between; background: linear-gradient(#48624a9c, #163d3c); }
.is-catch-lane .ruins-choice-art { height: 125px; }
.is-catch-lane .ruins-prop { opacity: .08; }
.is-catch-lane.has-crate .ruins-prop { opacity: 1; }
.ruins-task .is-catch-lane.has-crate { border-color: #f4d58f; background: linear-gradient(#827748bb, #284e3d); }
.ruins-catch-water { position: absolute; bottom: 12px; width: 75%; height: 18px; border-block: 2px solid #a8d4b950; border-radius: 50%; }
.ruins-balance-weight { display: grid; place-items: center; width: 48px; height: 43px; border: 2px solid #c9b478; border-radius: 14px 14px 7px 7px; background: linear-gradient(#7e8054, #46553a); color: #fff0bf; font-size: 23px; }
.ruins-task .ruins-choice.is-balance { min-height: 115px; gap: 12px; }
.ruins-route-mark { font-size: 35px; color: #d2d6ac; }
.ruins-task .ruins-choice.is-lane { min-height: 125px; }
.ruins-task .ruins-choice.is-safe { background: linear-gradient(#647752de, #314d37); border-color: #bccb93; }
.ruins-task .ruins-choice.is-hazard { background: linear-gradient(#514e3de6, #323c30); }
.is-hazard .ruins-route-mark { color: #d4a27e; }
.ruins-signal-stone { width: 40px; height: 40px; border: 3px solid #c3b383; border-radius: 50%; box-shadow: inset 0 3px 7px #fff6, 0 2px 5px #081a15; }
.signal-0 { background: #c5644b; }.signal-1 { background: #4c8cc2; }.signal-2 { background: #7bab58; }
.ruins-task .ruins-feedback { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; padding: 10px 12px; border: 1px solid #c5ac6f66; border-radius: 9px; background: #594c2a50; color: #f1dfa6; font-size: 12px; line-height: 1.4; }
.ruins-task .ruins-feedback.is-success { border-color: #91b77c66; background: #3c69303d; color: #c8e6b2; }
.ruins-task .ruins-feedback.is-failed { border-color: #c28b6d; background: #603b2c80; color: #ffe1c5; }
.ruins-feedback.is-failed span { font-size: 11px; color: #ead3c0; }
.ruins-task .ruins-task-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.ruins-task-footer > span { color: #acbcaa; font-size: 10px; line-height: 1.4; }
.ruins-task .ruins-task-footer .outpost-secondary { flex: 0 0 auto; min-height: 44px; padding: 7px 9px; border: 1px solid #93a17c42; border-radius: 9px; background: #192c23; color: #d5d9c3; font-size: 10px; }
@media (hover: hover) { .ruins-task .ruins-choice:enabled:hover { border-color: #e6d59a; } }
@media (min-width: 500px) {
  .ruins-task .ruins-task-card.outpost-card { padding: 20px; }
  .ruins-task .ruins-choice.outpost-secondary { min-height: 100px; }
  .ruins-task .ruins-choice.is-plank { min-height: 55px; }
  .ruins-task .ruins-choice.is-direction { min-height: 44px; }
  .ruins-task .ruins-choice.is-primary { min-height: 52px; }
  .ruins-task .ruins-choice.is-chest-action { min-height: 200px; }
  .ruins-task .ruins-choice-art { height: 65px; }
  .ruins-task .is-plank .ruins-choice-art { height: 42px; }
  .ruins-task .is-direction .ruins-choice-art { height: 36px; }
  .ruins-task .is-primary .ruins-choice-art { height: 34px; }
  .ruins-task .is-chest-action .ruins-choice-art { height: 140px; }
  .ruins-task .ruins-choice-label { font-size: 12px; }
  .ruins-task .ruins-task-goal { font-size: 14px; }
}
@media (max-width: 359px) {
  .ruins-task .ruins-task-card.outpost-card { padding: 11px; }
  .ruins-task .ruins-playfield { padding: 10px 7px 7px; }
  .ruins-task .ruins-controls { gap: 6px; }
  .ruins-task .ruins-choice.outpost-secondary { min-height: 74px; }
  .ruins-task .ruins-choice.is-direction { min-height: 44px; }
  .ruins-task .ruins-choice.is-plank { min-height: 53px; }
  .ruins-task .ruins-choice.is-primary { min-height: 52px; }
  .ruins-task .ruins-choice.is-chest-action { min-height: 200px; }
  .ruins-task .ruins-task-nav > span { max-width: 130px; }
}
/* A short Telegram viewport still shows the first actionable row on entry. */
@media (max-height: 700px) and (max-width: 480px) {
  .outpost.ruins.ruins-task { gap: 6px; }
  .ruins-task .ruins-task-card.outpost-card { padding: 10px; }
  .ruins-task .ruins-eyebrow { margin-bottom: 4px; font-size: 9px; line-height: 1.3; }
  .ruins-task .ruins-task-heading h3 { font-size: 18px; line-height: 1.12; }
  .ruins-task .ruins-task-goal { margin-top: 6px; font-size: 11px; line-height: 1.35; }
  .ruins-task .ruins-progress { margin: 8px 0; gap: 4px; font-size: 10px; }
  .ruins-progress b { font-size: 13px; }
  .ruins-progress-track { height: 4px; }
  .ruins-task .ruins-clue { position: relative; margin: 7px 0; padding: 6px 7px; }
  .ruins-clue-label { margin-bottom: 4px; font-size: 9px; }
  .ruins-clue:has(.ruins-clue-all) > .ruins-clue-label { display: flex; align-items: center; min-height: 34px; padding-right: 112px; margin: 0; }
  .ruins-clue-all { margin: 0; }
  .ruins-clue-all summary { position: absolute; top: 0; right: 7px; min-height: 44px; font-size: 9px; }
  .ruins-clue-all[open] > .ruins-clue-sequence { margin-top: 7px; }
  .ruins-clue-sequence { gap: 4px; }
  .ruins-clue-sequence li { padding: 3px 4px; font-size: 10px; }
  .ruins-clue-sequence.is-preview li { font-size: 10px; }
  .ruins-task .ruins-playfield { padding: 8px 7px; }
  .ruins-board-caption { margin-bottom: 6px; font-size: 9px; }
  .ruins-task .ruins-clock { margin-bottom: 6px; padding: 7px; font-size: 11px; }
  .ruins-task .ruins-choice.outpost-secondary { min-height: 68px; }
  .ruins-choice-art { height: 45px; }
  .ruins-task .ruins-choice.is-direction { min-height: 44px; }
  .ruins-task .ruins-choice.is-plank { min-height: 53px; }
  .ruins-task .ruins-choice.is-primary { min-height: 48px; }
  .ruins-task .ruins-choice.is-chest-action { min-height: 150px; }
  .ruins-task .is-chest-action .ruins-choice-art { height: 100px; }
  .is-chest-action .ruins-prop { height: 100px; width: 110px; }
  .ruins-task .ruins-choice.is-catch-lane { min-height: 100px; }
  .is-catch-lane .ruins-choice-art { height: 66px; }
  .ruins-task .mode-timing .ruins-clock { min-height: 90px; gap: 8px; padding: 12px 6px; }
  .mode-timing .ruins-clock::before { width: 32px; height: 32px; border-width: 4px; }
  .ruins-task .mode-merge { display: flex; flex-direction: column; }
  .ruins-task .mode-merge .ruins-controls { order: 1; width: 100%; max-width: none; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "left up down right"; margin: 0 0 8px; }
  .ruins-task .mode-merge .ruins-board { order: 2; width: 180px; max-width: 100%; margin: 0 auto; padding: 5px; gap: 4px; }
  .ruins-task .ruins-feedback { margin: 7px 0; padding: 8px; font-size: 11px; }
  .ruins-task .ruins-task-footer { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { .ruins-task .ruins-choice { transition: none; } }
