@font-face {
  font-family: "SnakeRound";
  src: url("font/round.woff2") format("woff2"),
       url("../font/round.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* 桌面、羊皮紙與航海道具 */
:root {
  --bg: #241812;
  --ink: #fff1d8;
  --sub: #e6cbb0;
  --panel: #492c23;
  --line: #a67a55;
  --gold: #DE9A45;
  --paper: #f3deb0;
  --paper-ink: #362217;
  --paper-sub: #4e3624;
  --wine: #78382e;
  --blue: #234f57;
  --good: #214532;
  --bad: #71241e;
  --brass: #b6955f;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='161' height='97'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.68' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath d='M0 0h161v97H0z' opacity='.24' filter='url(%23g)'/%3E%3C/svg%3E");
  --paper-fill: var(--grain),
    radial-gradient(ellipse at 12% 8%, #fff5d2a8, transparent 53%),
    radial-gradient(ellipse at 89% 82%, #9c5d232b, transparent 57%),
    linear-gradient(108deg, #dfbd83, #f8e7be 18%, #f1d8a5 82%, #d7ac72);
  --wood: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='144' viewBox='0 0 340 144'%3E%3Cg fill='none' stroke='%23edbb88' stroke-opacity='.14'%3E%3Cpath d='M-3 14C61 1 101 33 179 18S286 7 344 14M-3 28c56-13 106 34 187 10s119-16 160-9M-3 47c64-15 101 34 188 10 66-18 112-13 159-9M-3 82c86 12 108-19 168-5s133 28 179 5M-3 99c93 18 112-21 173-3s117 24 174 3M-3 121c71 6 112-13 163-5 57 7 117 20 184 5'/%3E%3Cellipse cx='122' cy='48' rx='23' ry='4'/%3E%3Cellipse cx='122' cy='48' rx='36' ry='8'/%3E%3C/g%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, #190f0c 0 2px, #755139 2px 3px, transparent 3px 72px),
    linear-gradient(105deg, #31201a, #503326 50%, #2d1c16);
  --rope: repeating-linear-gradient(132deg, #604027 0 1px, #a47f4c 1px 2px, #d2b783 2px 4px, #907041 4px 5px);
  --rivet: radial-gradient(circle at 37% 32%, #f3deb1 0 14%, #b6955f 21% 44%, #795133 52% 63%, #301c13 68% 72%, transparent 76%);
  --four-rivets: var(--rivet) left 7px top 7px / 8px 8px no-repeat,
    var(--rivet) right 7px top 7px / 8px 8px no-repeat,
    var(--rivet) left 7px bottom 7px / 8px 8px no-repeat,
    var(--rivet) right 7px bottom 7px / 8px 8px no-repeat;
  --compass: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%237b4b30'%3E%3Ccircle cx='50' cy='50' r='35'/%3E%3Ccircle cx='50' cy='50' r='30' stroke-dasharray='1 3'/%3E%3Cpath d='m29 29 21 12 21-12-12 21 12 21-21-12-21 12 12-21Z'/%3E%3Cpath d='m50 9 8 33 33 8-33 8-8 33-8-33-33-8 33-8Z' fill='%23f8e8be'/%3E%3C/g%3E%3Cpath d='m50 9 8 33-8 8zm41 41-33 8-8-8zM50 91l-8-33 8-8zM9 50l33-8 8 8z' fill='%237b4b30'/%3E%3Ccircle cx='50' cy='50' r='3' fill='%2378382e'/%3E%3C/svg%3E");
  --waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='116' height='83'%3E%3Cpath d='M13 26q4-3 8 0t8 0m-10 5q4-3 8 0t8 0m45 25q4-3 8 0t8 0m-25 6q4-3 8 0t8 0M104 13h5m-2.5-2.5v5M46 65h5m-2.5-2.5v5' fill='none' stroke='%237e5636' stroke-opacity='.32' stroke-linecap='round'/%3E%3C/svg%3E");
  --route: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 178' preserveAspectRatio='none'%3E%3Cpath d='M75-7C77 25 68 49 90 74S226 80 238 115 160 157 105 170L75 181' fill='none' stroke='%2378382e' stroke-width='2.5' vector-effect='non-scaling-stroke' stroke-linecap='round' stroke-dasharray='2 6'/%3E%3C/svg%3E");
  --lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233f3027' stroke-width='2' stroke-linecap='round'%3E%3Crect x='5' y='10' width='14' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 1 1 8 0v3m-4 5v2'/%3E%3C/svg%3E");
}

html, body, body * {
  font-family: "SnakeRound", "Microsoft JhengHei", sans-serif;
  font-weight: 400 !important;
  font-synthesis: none;
}

body {
  background: var(--wood) 0 0 / auto;
  overflow-wrap: anywhere;
}

button {
  min-height: 44px;
  max-width: 100%;
  padding-inline: 10px;
  border: 1px solid var(--brass);
  border-radius: 5px;
  background: linear-gradient(#315f66, #22464e);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px #ffffff1a, inset 0 -3px #162e35;
}

button:disabled {
  opacity: 1;
  color: #46372b;
  background: repeating-linear-gradient(135deg, #18120d0d 0 1px, transparent 1px 5px), #d2c2a7;
  border-color: #786454;
  box-shadow: inset 0 0 0 2px #ffffff30;
  cursor: not-allowed;
}

button:focus-visible {
  outline: 2px solid #fff4d5;
  outline-offset: 1px;
  box-shadow: 0 0 0 5px #292019;
  position: relative;
  z-index: 2;
}

.primary:not(:disabled) {
  color: var(--ink);
  background: linear-gradient(#315f66, #22464e);
  border-color: var(--brass);
}

:is(#bPhrase, #bNext, #bHunt, #bResume):not(:disabled), #story #bNextLine:not(:disabled) {
  color: #2d1c12;
  background: linear-gradient(#fff1cc46, transparent 43%, #64290724), var(--gold);
  border: 2px solid #734126;
  box-shadow: inset 0 0 0 2px #fff2d19c, inset 0 -5px #83451761, 0 3px #513222;
}

.second:not(:disabled), #story #bSkip:not(:disabled) {
  background: var(--four-rivets), linear-gradient(#675242, #493225);
  color: var(--ink);
  border-color: #86623d;
  box-shadow: inset 0 0 0 2px #f5deb42b, inset 0 -3px #291c16;
}

header {
  max-width: 640px;
  gap: 9px;
  background: var(--wood);
  border-inline: 1px solid #70523e;
  box-shadow: inset 0 -1px #a7805f, inset 0 -3px #231711, 0 3px 8px #160f0b82;
}

header img, .rdg-foot img { flex: none; }

header h1 {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  padding: 5px 12px 6px;
  font-size: 20px;
  line-height: 1.22;
  letter-spacing: .035em;
  color: #ffefd3;
  background: var(--grain), linear-gradient(#884437, #61291f);
  clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 50%, 100% 100%, 0 100%, 5px 50%);
  box-shadow: inset 0 1px #d4a47f, inset 0 -2px #421a17;
}

#bSound { margin-inline-start: auto; }

header button {
  flex: none;
  padding-inline: 9px;
  background: linear-gradient(#654833, #412820);
  border-color: #ac8756;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px #f5deb426, inset 0 -3px #2a1a13;
}

#bSound[aria-pressed="false"] { border-style: dashed; }
body.playing header { max-width: 520px; }

.wrap {
  max-width: 640px;
  margin-block: 10px 18px;
  padding: 13px 15px 17px;
  color: var(--paper-ink);
  --sub: var(--paper-sub);
  --line: #896547;
  border: 1px solid #8d5d32;
  border-radius: 10px 5px 12px 6px / 4px 12px 5px 10px;
  background: var(--paper-fill);
  box-shadow: inset 0 0 3px 1px #693914, inset 0 0 17px #9a5b2e9c, 0 5px 12px #130c09b8;
}

.wrap h2, #veil h2 {
  width: fit-content;
  max-width: 100%;
  margin: 2px auto 14px;
  padding: 7px 22px 9px;
  background: var(--grain), linear-gradient(#874538, #652c24);
  color: #fff3db;
  text-align: center;
  font-size: 23px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%, 9px 50%);
  box-shadow: inset 0 1px #b98d63, inset 0 -2px #492017;
}

.lead, .note { color: var(--paper-sub); }

/* 首頁：鑲框海景、船員徽章與航具 */
#banner {
  width: 100%;
  height: auto;
  object-fit: contain;
  padding: 4px;
  margin-bottom: 13px;
  border: 5px solid #5c3d29;
  border-radius: 4px;
  background: var(--rope);
  box-shadow: 0 0 0 1px #362217, 0 0 0 2px #b79862, 0 4px 7px #68432077;
}

.card {
  position: relative;
  min-width: 0;
  color: var(--paper-ink);
  background: var(--paper-fill);
  border: 1px solid #9b7650;
  border-radius: 3px 8px 5px 4px;
  box-shadow: inset 0 0 6px #9b653e40, 1px 3px #8057304d;
}

#me {
  padding: 11px 13px;
  margin: 0 0 13px;
  gap: 10px;
  color: #fff2d8;
  border: 2px solid #543626;
  border-radius: 9px 4px 9px 4px;
  background: var(--four-rivets), var(--grain), linear-gradient(110deg, #355c5c, #203e46);
  box-shadow: inset 0 0 0 3px #ad95685c, 0 3px #795538;
}

#me b { font-size: 18px; }
#me small { display: block; color: #f3dfbd; line-height: 1.4; }
#me .shell { color: #ffefd0; }

#me .dot, #shop .dot {
  border: 2px solid #65452f;
  outline: 2px solid #c7aa79;
  outline-offset: 1px;
  background-image: radial-gradient(circle at 30% 27%, #fff7d9b8, transparent 55%);
}

#me .bar {
  height: 9px;
  background: #122c33;
  border: 1px solid #c2a775;
}

#me .bar i {
  background: repeating-linear-gradient(125deg, #b7dcb3 0 5px, #7db18b 5px 7px);
}

.menu {
  gap: 7px;
  margin-bottom: 16px;
}

.menu button {
  min-width: 0;
  min-height: 64px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 4px 2px;
  background: var(--rivet) left 4px top 4px / 7px 7px no-repeat,
    var(--rivet) right 4px top 4px / 7px 7px no-repeat,
    var(--grain), linear-gradient(#744e38, #482c23);
  border: 1px solid #634029;
  border-radius: 9px 9px 4px 4px;
  box-shadow: inset 0 0 0 2px #d4ac7047, 0 3px #95704a;
  font-size: 14px;
}

.menu button::before {
  content: "";
  width: 27px;
  height: 27px;
  border: 1px solid #be9b69;
  border-radius: 50%;
  background: var(--tool) center / 17px 17px no-repeat, #2d2019;
  box-shadow: inset 0 0 0 2px #715540;
}

#bDex { --tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5e0b7' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h13a2 2 0 0 1 2 2v14H6a2 2 0 0 1-2-2V4Zm0 13h15M8 4v8l2-1.5 2 1.5V4'/%3E%3C/svg%3E"); }
#bNest { --tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5e0b7' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 19 4-10 5-5 5 4 6 11H2Zm6 0 2-6 3-2 3 8'/%3E%3C/svg%3E"); }
#bDaily { --tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5e0b7' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M2 15q2.5-3 5 0t5 0 5 0 5 0M2 20q2.5-3 5 0t5 0 5 0 5 0M7 10a5 5 0 0 1 10 0m-5-9v2M4 4l1.5 1.5M20 4l-1.5 1.5'/%3E%3C/svg%3E"); }
#bShop { --tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5e0b7' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M3 10h18v10H3zM3 10V8a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v2m-11 0v5h4v-5M7 4v6m10-6v6'/%3E%3C/svg%3E"); }
#bComp { --tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5e0b7' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M6 17c0-2 3-6 6-6s6 4 6 6c0 3-3 3-6 1-3 2-6 2-6-1Z'/%3E%3Ccircle cx='4' cy='10' r='1.7'/%3E%3Ccircle cx='9' cy='6' r='1.7'/%3E%3Ccircle cx='15' cy='6' r='1.7'/%3E%3Ccircle cx='20' cy='10' r='1.7'/%3E%3C/svg%3E"); }

#tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 4px;
  border-bottom: 2px solid #784d30;
}

#tabs button {
  min-width: 0;
  min-height: 47px;
  margin-bottom: -1px;
  border: 1px solid #865f40;
  border-radius: 12px 3px 0 0;
  background: var(--grain), linear-gradient(#e5cca0, #c8a879);
  color: #3c281c;
  box-shadow: inset 0 2px #fff0cb99, inset 0 -3px #85583362;
}

#tabs small { opacity: 1; }

#tabs button[aria-selected="true"] {
  min-height: 52px;
  background: var(--grain), linear-gradient(#884638, #652b23);
  color: #fff3db;
  border-color: #6a392c;
  box-shadow: inset 0 0 0 2px #bb916667;
}

#tierNote {
  margin: 0 0 10px;
  padding: 5px 7px 6px;
  border-bottom: 1px dashed #8e6643;
  font-size: 14px;
}

/* 航線與釘在地圖上的島嶼標記 */
#levels {
  --route-row: 190px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(var(--route-row), auto);
  align-items: start;
  column-gap: 9px;
  padding: 26px 9px 6px;
  border: 4px solid #794d30;
  border-radius: 7px 12px 5px 11px;
  background: var(--compass) right 4px top 4px / 60px 60px no-repeat,
    var(--route) 0 23px / 100% var(--route-row) repeat-y,
    var(--waves) 0 0 repeat,
    var(--paper-fill);
  box-shadow: 0 0 0 1px #52331f, inset 0 0 0 1px #9a734b, inset 0 0 17px #9b5e35b3;
}

#levels::before {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid transparent;
  border-radius: inherit;
  background: var(--rope) border-box;
  pointer-events: none;
  /* 中空繩圈讓紙面與航線完整露出。 */
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0) border-box;
  mask-composite: exclude;
}

#levels .isle {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  max-width: 215px;
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: start;
  gap: 2px;
  padding: 0 0 3px;
  margin: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  text-align: center;
  color: var(--paper-ink);
}

#levels .isle:nth-child(even) { margin-top: 44px; }

#levels .isle::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 17px;
  width: min(86%, 104px);
  height: 45px;
  border: 1px solid #47777a7d;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #366e6c19, 0 0 0 6px #366e6c12;
  transform: rotate(-9deg);
  pointer-events: none;
}

#levels .isle .art, #levels .isle .bossart {
  width: min(80px, 100%);
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0;
}

#levels img.art, #levels .bossimg {
  display: block;
  object-fit: contain;
}

#levels {
  --island: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 56'%3E%3Cpath d='M4 40c0-7 13-13 23-13h27c13 0 22 5 22 12 0 10-16 13-37 13S4 48 4 40Z' fill='%23dfbd82' stroke='%23584029' stroke-width='2'/%3E%3Cpath d='M10 39c4-8 17-12 29-12s26 3 31 12c-10 10-51 10-60 0Z' fill='%237e9c60' stroke='%23584029'/%3E%3Cpath d='M38 39c1-10-2-16-4-23l4-2c4 9 8 16 7 25Z' fill='%23bc8052' stroke='%23584029' stroke-width='1.6'/%3E%3Cpath d='M35 18c-6-4-13-3-17 2 0-8 8-13 15-9-1-5 3-9 12-9l-7 9c8-3 15 1 19 7-7-3-15-1-19 1Z' fill='%2358794f' stroke='%23374832' stroke-linejoin='round'/%3E%3Cpath d='M58 38l4-5 5 5Z' fill='%23aa8870'/%3E%3C/svg%3E");
}

#levels :not(img).art {
  border: 0;
  border-radius: 0;
  background: var(--island) center / contain no-repeat;
}

#levels .t2 { --island: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 56'%3E%3Cpath d='M4 40c0-18 72-18 72 0 0 16-72 16-72 0Z' fill='%23e5bf83' stroke='%23584129' stroke-width='2'/%3E%3Cpath d='M22 22h30v19H22Z' fill='%23e7c39a' stroke='%23523a28' stroke-width='2'/%3E%3Cpath d='M17 24 37 8l20 16Z' fill='%23945347' stroke='%23523a28' stroke-width='2'/%3E%3Cpath d='M34 41V29h7v12m11-8h15v6H52' fill='%23523a28'/%3E%3C/svg%3E"); }
#levels .t3 { --island: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 56'%3E%3Cpath d='m4 42 14-8 14-21h15l15 22 14 7c-11 16-63 16-72 0Z' fill='%23877a83' stroke='%23544447' stroke-width='2'/%3E%3Cpath d='m32 14-8 12 9-2 6 11 4-12 12 3-8-12Z' fill='%23b56551'/%3E%3Cpath d='M42 8c-8 0-9-5-5-7m8 8q6-4 4-7' fill='none' stroke='%23877463' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
#levels :not(img).art::after { content: none; }

#levels .bossimg { max-width: 100%; max-height: 56px; }

#levels .isle .t {
  width: 100%;
  padding: 3px 4px;
  border: 1px solid #9a714a;
  border-radius: 3px 7px 4px 8px;
  background: linear-gradient(100deg, #f0d8ab, #f8e9c4 47%, #ebcfa1);
  box-shadow: inset 0 0 0 1px #fff0ce, 1px 2px #a77a4d80;
}

#levels .isle b { font-size: 17px; line-height: 1.17; }

#levels .isle small {
  white-space: normal;
  overflow: visible;
  font-size: 12px;
  line-height: 1.3;
  color: #543a2b;
}

#levels .isle .s {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 4px;
  padding: 0 1px;
  color: #683229;
  font-size: 11px;
  text-align: center;
  white-space: normal;
}

#levels .isle .s span { line-height: 1.35; white-space: nowrap; }

#levels .isle.boss {
  grid-column: 1 / -1;
  margin: 0 0 7px;
  max-width: 230px;
}

#levels .isle.boss .t { color: #fff2d6; background: #78382e; border-color: #6e372a; box-shadow: inset 0 0 0 1px #b98666; }
#levels .isle.boss small { color: #ffdfba; }
#levels .isle:disabled { cursor: not-allowed; }
#levels .isle:disabled .t { color: #3e342b; background: #dfd1b4; border-style: dashed; box-shadow: none; }
#levels .isle:disabled :is(.art, .bossart) { filter: grayscale(.85); }
#levels .isle:disabled .s, #levels .isle:disabled small { color: #554237; }

#levels .isle:disabled::before {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 23px;
  height: 23px;
  border: 1px solid #7f6550;
  border-radius: 50%;
  background: var(--lock) center / 15px no-repeat, #e3d3b6;
}

@media (hover: hover) {
  #levels .isle:not(:disabled):hover .t { outline: 2px solid var(--wine); outline-offset: 1px; }
}

.how {
  padding: 0 9px 3px;
  border: 1px dashed #93694a;
  background: #fff2ca72;
}

.how summary::before { content: "◇"; color: var(--wine); margin-inline-end: 7px; }
.how[open] summary::before { content: "◆"; }
.how p { padding-bottom: 6px; }

.rdg-foot {
  max-width: none;
  margin: 15px -5px -7px;
  padding-inline: 9px;
  border: 1px solid #614331;
  border-top: 1px solid var(--gold);
  border-radius: 2px 2px 5px 5px;
  background: var(--wood);
  color: #f6dfbf;
}

.rdg-foot .rdg-slg { border-color: #9c7b5d; }
.rdg-foot .rdg-by { color: #fff2d8; }

/* 詞卡、圖鑑、錯題、夥伴與裝備 */
#introMeta { gap: 5px; }
#introMeta span {
  padding: 3px 7px;
  border-color: #886447;
  border-radius: 3px 6px 4px 6px;
  background: #f6e6bc;
  color: #4f3728;
}

#introMeta .hz { color: var(--bad); border-color: var(--bad); }

#introMeta img.host, #sFace, #compList .pal {
  border: 2px solid #a98959;
  outline: 1px solid #644633;
  outline-offset: 1px;
  border-radius: 50%;
  background: #f8e9c6;
  object-fit: contain;
}

#introMeta img.host { margin: 2px 4px 2px 2px; }

.card.word {
  gap: 8px;
  padding: 9px 8px 9px 13px;
  border-inline-start: 3px solid #7c4333;
  background: repeating-linear-gradient(0deg, transparent 0 20px, #8d65421c 20px 21px),
    linear-gradient(110deg, #f9eccb, #efdbb4);
}

.card.word b { color: #2d392e; }
.card.word :is(.zh, p, .dx) { color: #503a2b; }
.card.word mark { color: #813c28; text-decoration: underline; text-underline-offset: .14em; }
.card.word .why { color: var(--bad); }
.card.word button { flex-shrink: 0; white-space: normal; }
.dx { margin: 1px 0 1px 5px; border-color: #967455; background: #fff1d1; }

#nestList .card { border-inline-start-color: #8f4a3d; }
#dex h3 {
  padding: 4px 6px;
  border-block-end: 1px dashed #996b47;
  color: #643e2b;
  font-size: 16px;
}

.chip {
  border-radius: 3px 12px 12px 3px;
  border-color: #97744d;
  box-shadow: inset 0 0 0 2px #fff1d22e;
}

.chip.m0 { opacity: 1; color: #594433; border-style: dashed; background: #f5e6c3; }
.chip.m1 { color: #f6fbff; background: #285370; border-color: #456b80; }
.chip.m2 { color: #fbfff0; background: #365943; border-color: #54755a; }
.chip.m3 { color: #422916; background: #f0d09a; border: 3px double #886135; }

.fam b { color: var(--paper-ink); }
.fam.on {
  border: 2px solid #326154;
  box-shadow: inset 0 0 0 2px #d6e5bf;
}

.fam.on span { color: #285340; }
#shopList .card { background: var(--four-rivets), var(--paper-fill); padding-inline: 14px; }
#compList .card { border-inline-start: 4px solid #845d42; }
#shop h2 .shell { color: #fff1d4; }

#rSum span {
  border: 1px dashed #83563a;
  border-radius: 4px;
  color: #65352a;
  background: #fbebc6;
  box-shadow: inset 0 0 0 2px #f3dab0;
}

#rSum .up {
  border: 3px double #d3b285;
  border-radius: 12px 8px 13px 8px;
  background: #753229;
  color: #fff3da;
  box-shadow: inset 0 0 0 1px #9a5143;
}

/* 劇情與暫停的裝訂和蠟封 */
#story, #veil { background: #1d120edf; }

#story .box, #veil .box {
  color: var(--paper-ink);
  border: 2px solid #80563c;
  border-radius: 11px 5px 10px 5px;
  background: var(--four-rivets), var(--paper-fill);
  box-shadow: inset 0 0 0 3px #a6784d7a, inset 0 0 14px #9b623482, 0 7px 16px #170e0ab8;
}

#veil .box { padding: 17px 15px 15px; }

#story .box {
  flex: 0 1 auto;
  min-height: 0;
  overflow: auto;
}

#sArt {
  flex: 0 1 auto;
  min-height: 0;
  padding: 3px;
  object-fit: contain;
  border: 4px solid #573721;
  border-radius: 7px 4px 7px 4px;
  background: var(--rope);
  box-shadow: 0 0 0 1px #c4a16e, 0 3px 5px #1b100e;
}

#sWho {
  padding: 5px 11px;
  border: 3px double #c18569;
  border-radius: 42% 34% 44% 32% / 24% 31% 24% 31%;
  background: linear-gradient(#96503e, #703128);
  color: #fff1d4;
  box-shadow: 1px 2px #52261f;
  vertical-align: middle;
}

#sText { color: var(--paper-ink); }
#story .row button { min-width: 0; }

/* 一屏航行：保持題框、控制列與畫布的原始尺寸配置 */
body.playing { overscroll-behavior: none; }

#ask {
  border-color: #795433;
  border-radius: 5px 11px 6px 4px;
  background: var(--paper-fill);
  color: var(--paper-ink);
  box-shadow: inset 0 0 0 1px #ab7b4f, inset 0 0 12px #9b60396e;
}

#askTop { color: var(--paper-sub); }
#hearts { color: var(--bad); }
#ask .slot { border-bottom-color: #81593d; }
#ask .slot.full { border-bottom-color: var(--good); color: var(--good); }
#ask .slot.ghost { color: #4f4032; border-bottom-style: dotted; }
#ask.bad { border-color: #8d3029; box-shadow: inset 0 0 0 2px #a5523a70; }
#ask.bad #count { color: var(--bad); }
#ask.gold { border-color: #3c665b; box-shadow: inset 0 0 0 2px #4b715b80; }
#ask.gold #count { color: var(--good); }
#ask.sent #askTop { min-height: 17px; line-height: 1.2; }
#ask.sent #askZh { line-height: 1.18; }
#ask.sent #slots { gap: 2px 4px; margin-top: 1px; }
#ask.sent .gaptext { line-height: 1.2; }
#ask.sent .slot { line-height: 16px; }

#bReplay { min-height: 44px; }
#ask:has(#bReplay) #askTop { min-height: 17px; line-height: 17px; }
#ask:has(#bReplay) #slots { gap: 1px 4px; margin-top: 1px; }
#ask:has(#bReplay) .slot { line-height: 17px; }

#stage {
  isolation: isolate;
  border-radius: 7px;
  background: var(--wood);
  box-shadow: 0 0 0 1px #20140e, 0 2px 3px #170f0caa;
}

#cv {
  border-radius: 7px;
  outline: 1px solid #68482f;
  outline-offset: -1px;
}

#stage::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  padding: 4px;
  border: 1px solid #563622;
  border-radius: inherit;
  background: var(--rivet) left 0 top 0 / 7px 7px no-repeat,
    var(--rivet) right 0 top 0 / 7px 7px no-repeat,
    var(--rivet) left 0 bottom 0 / 7px 7px no-repeat,
    var(--rivet) right 0 bottom 0 / 7px 7px no-repeat,
    var(--rope);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

#msg {
  z-index: 2;
  color: var(--paper-ink);
  background: var(--paper-fill);
  border: 1px solid #936d48;
  border-radius: 3px 7px 4px 7px;
}

#msg mark, #msg small { color: #743521; }

#pad { gap: 5px; }

#pad button {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 3px;
  border: 2px solid #9d7c51;
  border-radius: 10px 10px 5px 5px;
  background: var(--four-rivets), var(--grain), linear-gradient(#6a4936, #44291f);
  color: #fff0d4;
  box-shadow: inset 0 0 0 2px #c5a47342, inset 0 -4px #2f1f19;
  line-height: 1.12;
}

#pad #bHint:not(:disabled) { background: var(--four-rivets), linear-gradient(#365f64, #214149); }
#pad :is(button.held, #bHint.held):not(:disabled) {
  background: #d9c193;
  color: #35241a;
  border-color: #c8a97b;
  box-shadow: inset 0 3px 5px #6950348c;
}

#pad button:disabled {
  background: #d2c2a7;
  color: #46372b;
  border-style: dashed;
  box-shadow: none;
}

:is(.wrap, #ask, #story .box, #veil .box) button:focus-visible {
  outline-color: #39251a;
  outline-offset: 2px;
}

@media (max-width: 365px) {
  header { gap: 6px; padding-inline: 7px; }
  header h1 { font-size: 17px; letter-spacing: 0; padding-inline: 8px; }
  header button { padding-inline: 7px; }
  .wrap { padding-inline: 10px; }
  #levels { column-gap: 5px; padding-inline: 5px; }
  #pad button { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html, body, body *, body *::before, body *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* 星等墊一張紙籤，航線虛線不穿過字 */
#levels .isle .s { background: #f6e6c2; border: 1px solid #b8946466; border-radius: 5px; margin-top: 2px; }
#levels .isle:disabled .s { background: #dfd1b4; }
