/* 界面是一套奶油色的圆角纸片，和船、码头用的是同一盒颜料（见 render/props.js）。 */
:root {
  --ink: #3b4352;
  --ink-dim: #8b8794;
  --paper: #fff8ea;
  --panel: rgba(255, 248, 234, 0.9);
  --line: rgba(122, 96, 62, 0.14);
  --track: rgba(59, 67, 82, 0.12);
  --sun: #f5bf45;
  --coral: #e9634a;
  --coral-ink: #c8492f;
  --teal: #3f9a94;
  --green: #4fb286;
  --blue: #3f73ad;
  --slate: #5d6675;
  --sea: #cfeaf0;
  --shoal: #b4dfe2;
  --sand: #f4e7c6;
  --grass: #b3d9a2;
  --lift: 0 6px 20px rgba(74, 58, 34, 0.16), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  --font: ui-rounded, "SF Pro Rounded", "PingFang SC", "PingFang TC", "Hiragino Sans GB", "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans SC", "Noto Sans TC", "Noto Sans JP", "Noto Sans KR", "Microsoft YaHei", system-ui, sans-serif;
  --display: "Yuanti SC", "YouYuan", ui-rounded, "SF Pro Rounded", "PingFang SC", "PingFang TC", "Hiragino Maru Gothic ProN", "Apple SD Gothic Neo", "Noto Sans SC", system-ui, sans-serif;
  --hand: "Kaiti SC", "STKaiti", "Songti SC", "Hiragino Mincho ProN", "Nanum Myeongjo", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #cfe6ee;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: block;
  cursor: grab;
  touch-action: none;
}
#view:active { cursor: grabbing; }

#ui { position: fixed; inset: 0; height: 100%; height: 100dvh; pointer-events: none; }
#ui [hidden] { display: none !important; }
#ui * { scrollbar-width: thin; scrollbar-color: rgba(59, 67, 82, 0.25) transparent; }
#ui :is(b, dd, .count) { font-variant-numeric: tabular-nums; }

button {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--lift);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}
button:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
button:active:not(:disabled) { transform: scale(0.97); }
button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
button.primary { background: var(--sun); border-color: transparent; color: #4a3305; }
button.primary:hover:not(:disabled) { background: #ffd062; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--lift);
  backdrop-filter: blur(8px) saturate(1.15);
  -webkit-backdrop-filter: blur(8px) saturate(1.15);
}

.stars { letter-spacing: 3px; }
.stars i { font-style: normal; color: rgba(59, 67, 82, 0.16); }
.stars i.on { color: var(--sun); text-shadow: 0 1px 0 #d99a1f; }

.icon-globe { flex: none; display: block; opacity: 0.78; }

/* ───────── 多语言选择器 ───────── */
.lang-menu { position: relative; pointer-events: auto; }
.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lang-trigger .caret { font-size: 11px; opacity: 0.65; transition: transform 0.2s ease; }
.lang-trigger[aria-expanded="true"] .caret { transform: rotate(180deg); }
.lang-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 18px;
  background: rgba(255, 248, 234, 0.97);
  z-index: 20;
  animation: drop 0.18s ease both;
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.lang-list :is(button, a) {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.lang-list :is(button, a):hover:not(:disabled) { background: rgba(59, 67, 82, 0.08); transform: none; }
.lang-list :is(button, a).active { background: rgba(245, 191, 69, 0.34); color: #4a3305; }
.lang-list :is(button, a) i { font-style: normal; color: var(--coral-ink); font-weight: 700; font-size: 12px; }

.lang-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.lang-section small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 9px;
}
.lang-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-pill {
  padding: 6px 12px;
  font-size: 12.5px;
  box-shadow: none;
  background: rgba(59, 67, 82, 0.065);
  border-color: transparent;
}
.lang-pill:hover:not(:disabled) { background: rgba(59, 67, 82, 0.12); transform: none; }
.lang-pill.active { background: var(--sun); color: #4a3305; }
.lang-pill.active:hover:not(:disabled) { background: #ffd062; }

/* ───────── HUD ───────── */
.hud { position: absolute; inset: 0; }

.objectives {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  max-width: min(340px, 56vw);
  padding: 13px 18px 11px;
}
.objectives small { display: block; color: var(--coral-ink); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; margin-bottom: 6px; }
.objectives p { display: flex; align-items: baseline; gap: 8px; margin: 5px 0; font-size: 14.5px; line-height: 1.45; }
.objectives p i {
  flex: none; width: 16px; height: 16px; border: 2px solid rgba(59, 67, 82, 0.28); border-radius: 50%;
  font-style: normal; font-size: 10px; font-weight: 700; line-height: 12px; text-align: center; transform: translateY(2px);
}
.objectives p b { margin-left: auto; padding-left: 10px; font-size: 13px; color: var(--coral-ink); white-space: nowrap; }
.objectives p.done { color: var(--ink-dim); }
.objectives p.done i { border-color: var(--green); background: var(--green); color: #fff; }
.objectives p.done b { color: var(--green); }

.corner {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.bar { display: flex; gap: 6px; }
.bar button { width: 40px; height: 40px; padding: 0; font-size: 15px; }
.bar .mute.off { color: var(--ink-dim); text-decoration: line-through; }
.minimap {
  display: block; width: 204px; height: auto; background: var(--sea); border: 4px solid var(--paper);
  pointer-events: auto; cursor: pointer; transition: width 0.24s ease;
}
.minimap.expanded { width: min(296px, 72vw) !important; }

.gauges {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 218px;
  padding: 12px 16px 14px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px;
}
.speed { white-space: nowrap; }
.speed b { font-size: 34px; line-height: 1; }
.speed span { margin-left: 5px; color: var(--ink-dim); font-size: 13px; }
.heading { text-align: right; align-self: end; }
.heading span { display: block; color: var(--ink-dim); font-size: 11px; letter-spacing: 0.08em; }
.heading b { font-size: 18px; }
.meter { grid-column: 1 / -1; display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-dim); }
.meter span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { position: relative; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.track i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; background: var(--teal); }
.track.mid::after { content: ''; position: absolute; left: calc(50% - 1px); top: 0; bottom: 0; width: 2px; background: var(--paper); }
.track .hull { background: var(--green); transition: width 0.4s; }
.track.strain::before { content: ''; position: absolute; left: 72%; right: 0; top: 0; bottom: 0; background: rgba(233, 99, 74, 0.2); }
.track .tension { background: var(--green); transition: background 0.3s; }
.track .tension.hot { background: var(--coral); }

.line {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(300px, 46vw); padding: 8px 14px;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px;
  font-size: 12px; color: var(--ink-dim);
}

.radio {
  position: absolute; left: 50%; bottom: 174px; transform: translateX(-50%);
  width: max-content; max-width: min(680px, calc(100vw - 32px));
  padding: 16px 22px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--lift);
  text-align: center;
}
/* 说话的人是别在纸片上沿的一枚小名牌。 */
.radio b {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, -55%);
  padding: 2px 12px; border-radius: 999px; background: var(--coral); color: #fff;
  font-size: 12.5px; letter-spacing: 0.08em; white-space: nowrap;
}
.radio p { margin: 0; min-width: 9em; min-height: 1.6em; font-size: 17px; line-height: 1.6; }

.prompt {
  position: absolute; left: 50%; bottom: 31%; transform: translateX(-50%);
  padding: 9px 20px; border-radius: 999px;
  background: var(--sun); color: #4a3305; font-weight: 700; font-size: 15px;
  box-shadow: var(--lift);
  white-space: nowrap; max-width: calc(100vw - 32px); text-align: center;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: translateX(-50%) scale(1.04); } }

.pointer { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
/* 箭头描一圈奶油边，压在亮的海面和夜里的海面上都看得清。 */
.pointer i {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px;
  filter: drop-shadow(0 0 1.5px var(--paper)) drop-shadow(0 0 1.5px var(--paper)) drop-shadow(0 2px 4px rgba(74, 58, 34, 0.35));
}
.pointer i::before { content: ''; position: absolute; left: 2px; top: 1px; border: 7px solid transparent; border-top: 0; border-bottom: 15px solid var(--coral); }
.pointer span {
  position: absolute; left: 0; top: -38px; transform: translateX(-50%);
  padding: 2px 10px; border-radius: 999px; background: var(--paper); box-shadow: var(--lift);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* 章名是一块挂出来的木牌：奶油底，圆角。 */
.card-title {
  position: absolute; left: 50%; top: 15%; translate: -50% 0;
  width: max-content; max-width: calc(100vw - 32px); padding: 18px 46px 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--lift);
  text-align: center;
}
.card-title.play { animation: card 5.2s ease both; }
.card-title small { font-size: 13px; font-weight: 700; letter-spacing: 0.32em; color: var(--coral-ink); }
.card-title h2 { margin: 4px 0 2px; font: 700 clamp(28px, 6vw, 56px) / 1.2 var(--display); letter-spacing: 0.1em; }
.card-title p { margin: 0; font-size: 15px; color: var(--ink-dim); letter-spacing: 0.1em; }
@keyframes card {
  0% { opacity: 0; transform: translateY(10px); }
  14%, 78% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px); }
}

.toasts {
  position: absolute; left: 50%; top: max(70px, calc(env(safe-area-inset-top) + 54px)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.toast {
  padding: 7px 16px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--lift);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  animation: rise 0.35s ease both; transition: opacity 0.6s, transform 0.6s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.letter {
  position: relative; width: min(330px, calc(100vw - 32px)); max-height: 46vh; overflow: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  margin-top: 6px; transform: rotate(0.6deg);
  padding: 18px 22px 20px;
  background: var(--paper); color: #4a4034; border-radius: 8px;
  box-shadow: 0 12px 34px rgba(74, 58, 34, 0.28);
  font-family: var(--hand);
  pointer-events: auto;
}
.letter.play { animation: unfold 0.7s ease both; }
.letter h3 { margin: 0 32px 8px 0; font-size: 17px; }
.letter p { margin: 0; font-size: 15.5px; line-height: 1.85; white-space: pre-line; }
.letter button {
  position: absolute; right: 4px; top: 4px; width: 38px; height: 38px; padding: 0;
  border: 0; background: none; box-shadow: none; color: #9a8a70; font-size: 22px;
}
@keyframes unfold { from { opacity: 0; transform: translateY(14px) rotate(-1.5deg) scale(0.96); } }

/* ───────── 触屏摇杆与功能键 ───────── */
.touch { position: absolute; inset: 0; }
.stick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: clamp(112px, 29vw, 134px);
  height: clamp(112px, 29vw, 134px);
  border-radius: 50%;
  background: rgba(255, 248, 234, 0.44);
  border: 2px solid rgba(255, 248, 234, 0.82);
  box-shadow: 0 6px 20px rgba(74, 58, 34, 0.16);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;
  touch-action: none;
  transition: background 0.18s, border-color 0.18s;
}
/* 中心微速圈提示，轻推即微速 */
.stick::before {
  content: '';
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  border: 1.5px dashed rgba(59, 67, 82, 0.18);
  pointer-events: none;
}
.stick.active {
  background: rgba(255, 248, 234, 0.62);
  border-color: var(--paper);
}
.stick i {
  position: absolute; left: 50%; top: 50%;
  width: 42%; height: 42%;
  margin: -21%;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--lift);
  pointer-events: none;
}
.pads {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(26px, env(safe-area-inset-bottom));
  display: flex;
  gap: clamp(8px, 2.5vw, 12px);
  align-items: flex-end;
}
.pad {
  width: clamp(66px, 18vw, 76px);
  height: clamp(66px, 18vw, 76px);
  padding: 0 4px;
  border-radius: 50%;
  font-size: clamp(12.5px, 3.2vw, 15px);
  line-height: 1.15;
  touch-action: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pad.ready,
.pad.ready:hover:not(:disabled) {
  background: var(--sun);
  border-color: transparent;
  color: #4a3305;
  box-shadow: 0 0 0 4px rgba(245, 191, 69, 0.34), var(--lift);
}
.pad.held,
.pad.held:hover:not(:disabled) {
  background: #f2ae2e;
  border-color: transparent;
  color: #3a2602;
  box-shadow: 0 0 0 5px rgba(245, 191, 69, 0.45), var(--lift);
  transform: scale(0.93);
}

/* 触屏：底下是摇杆和按钮，仪表和缆力收成两条挂在小地图下面。字幕横屏时落在摇杆和按钮之间，竖屏时在它们上面。 */
.is-touch :is(.gauges, .line) { position: static; transform: none; width: auto; padding: 6px 12px; border-radius: 14px; }
.is-touch .gauges { display: flex; align-items: center; gap: 10px; }
.is-touch .gauges :is(.heading, .meter:not(:last-child)) { display: none; }
.is-touch .gauges .meter { width: 78px; grid-template-columns: auto 1fr; gap: 6px; }
.is-touch .line { align-self: stretch; gap: 7px; }
.is-touch .speed b { font-size: 19px; }
.is-touch .speed span { font-size: 11.5px; }
/* 横屏字幕两边各让出摇杆和按钮的宽度，刘海屏按较宽的那一侧算。 */
.is-touch .radio {
  --side: max(18px, env(safe-area-inset-left), env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(680px, calc(100vw - 2 * (var(--side) + 174px)));
}
.is-touch .radio p { font-size: 15.5px; }
@media (orientation: portrait) {
  .is-touch .radio {
    bottom: calc(max(22px, env(safe-area-inset-bottom)) + clamp(112px, 29vw, 134px) + 24px);
    width: min(680px, calc(100vw - 28px));
  }
  .is-touch .prompt {
    bottom: calc(max(22px, env(safe-area-inset-bottom)) + clamp(112px, 29vw, 134px) + 114px);
  }
}

/* ───────── 卡片 ───────── */
.screen {
  position: absolute; inset: 0; pointer-events: auto;
  display: flex; align-items: center; justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: rgba(255, 244, 222, 0.34);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  animation: fade 0.5s ease both;
}
@keyframes fade { from { opacity: 0; } }
/* 卡片盖着时，HUD 里会动、会抢眼的东西先收起来；歇着和翻日志时整层 HUD 淡出，避免边缘穿帮。 */
.hud { transition: opacity 0.2s ease; }
#ui[data-screen] :is(.pointer, .prompt, .toasts, .card-title, .letter) { visibility: hidden; }
#ui:is([data-screen="pause"], [data-screen="log"], [data-screen="postcard"], [data-screen="challenge"]) .hud { opacity: 0; visibility: hidden; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions.col { flex-direction: column; align-items: stretch; }
.keys { color: var(--ink-dim); font-size: 13px; line-height: 1.7; }
.title-main .keys { color: var(--ink); opacity: 0.8; }

.card {
  width: min(460px, 100%); margin: auto; padding: 28px 30px 26px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 30px;
  box-shadow: 0 22px 60px rgba(74, 58, 34, 0.26), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}
.card h2 { margin: 0 0 8px; font: 700 clamp(24px, 5vw, 30px) var(--display); letter-spacing: 0.06em; }
.card > p { margin: 0 0 16px; line-height: 1.7; color: var(--ink); }
.card > small { color: var(--coral-ink); font-weight: 700; letter-spacing: 0.12em; font-size: 12.5px; }

.result { text-align: center; }
.result .big { font-size: 46px; margin: 4px 0 2px; }
.result .big i { animation: pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.result .big i:nth-child(2) { animation-delay: 0.22s; }
.result .big i:nth-child(3) { animation-delay: 0.44s; }
@keyframes pop { from { opacity: 0; transform: scale(0.3); } }
.result .remark { color: var(--ink-dim); }
.result dl { display: flex; justify-content: center; gap: 30px; margin: 4px 0 16px; }
.result dt { font-size: 12px; color: var(--ink-dim); }
.result dd { margin: 2px 0 0; font-size: 19px; font-weight: 700; }
.result .quote { font-family: var(--hand); font-size: 17px; line-height: 1.8; }
.result .actions { justify-content: center; }

.screen.title {
  align-items: stretch; justify-content: flex-start; padding: 0;
  background: linear-gradient(90deg, rgba(255, 246, 228, 0.93) 0%, rgba(255, 246, 228, 0.7) 40%, rgba(255, 246, 228, 0) 72%);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.title-top {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  top: max(16px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}
.title-top > button,
.title-top .lang-trigger { padding: 8px 14px; font-size: 13px; min-height: 36px; }
.title-main {
  margin: auto 0;
  padding: calc(max(16px, env(safe-area-inset-top)) + 52px) clamp(22px, 6vw, 84px) max(36px, env(safe-area-inset-bottom)) clamp(22px, 6vw, 84px);
  width: min(790px, 100%);
}
.title-main h1 { margin: 0; font: 700 clamp(44px, 8.2vw, 90px) / 1.06 var(--display); letter-spacing: 0.08em; color: #2f4d68; text-wrap: balance; }
.title-main h1 small { display: block; margin-top: 12px; font: 700 15px var(--font); letter-spacing: 0.44em; color: var(--coral-ink); }
.tagline { margin: 18px 0 6px; font-size: clamp(15.5px, 2.4vw, 18px); letter-spacing: 0.04em; line-height: 1.5; }
.calm { margin: 0 0 22px; color: var(--ink-dim); font-size: clamp(13.5px, 2vw, 15px); }
.chapters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 24px 0 14px; }
.chapter {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 12px 13px 11px; border-radius: 18px; text-align: left; min-width: 0;
}
.chapter small { font-size: 11px; color: var(--coral-ink); letter-spacing: 0.06em; }
.chapter b { font-size: 15.5px; font-weight: 700; line-height: 1.25; }
.chapter em { font-style: normal; font-size: 11.5px; font-weight: 400; color: var(--ink-dim); line-height: 1.4; min-height: 2.8em; }
.chapter .stars { font-size: 13px; letter-spacing: 1px; }
.chapter .count { font-size: 12px; color: var(--teal); }
.chapter:disabled { opacity: 0.55; cursor: default; }

/* 拉丁语系收紧字距，避免法/西/英语标题过宽 */
:lang(en) .title-main h1,
:lang(fr) .title-main h1,
:lang(es) .title-main h1 { letter-spacing: -0.015em; font-size: clamp(36px, 6.8vw, 76px); }
:lang(en) .title-main h1 small,
:lang(fr) .title-main h1 small,
:lang(es) .title-main h1 small { letter-spacing: 0.28em; }
:lang(en) .card-title h2,
:lang(fr) .card-title h2,
:lang(es) .card-title h2 { letter-spacing: 0.02em; }

.card.log { width: min(760px, 100%); }
.letters {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  max-height: 56dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  margin-bottom: 16px; padding-right: 4px; touch-action: pan-y;
}
.letters article { padding: 14px 16px; border-radius: 12px; background: #fdeecb; color: #4a4034; font-family: var(--hand); }
.letters h3 { margin: 0 0 6px; font-size: 16px; }
.letters p { margin: 0; font-size: 14.5px; line-height: 1.8; white-space: pre-line; }
.letters .unfound { background: none; color: var(--ink-dim); border: 2px dashed rgba(122, 96, 62, 0.22); font-family: var(--font); }
.log .actions { justify-content: flex-end; }

/* ───────── 响应式：桌面宽屏 / 手机竖屏 / 手机横屏 ───────── */
/* 屏幕够宽时字幕落到仪表旁边，窄了就让到仪表上面去。 */
@media (min-width: 1240px) { #ui:not(.is-touch) .radio { bottom: 74px; } }

@media (max-width: 760px) {
  .objectives {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    max-width: calc(100vw - 160px);
    padding: 9px 12px 8px;
    border-radius: 16px;
  }
  .objectives small { font-size: 11px; margin-bottom: 3px; }
  .objectives p { font-size: 12.5px; gap: 6px; margin: 3px 0; line-height: 1.38; }
  .objectives p i { width: 14px; height: 14px; font-size: 9px; line-height: 10px; }
  .objectives p b { font-size: 12px; padding-left: 6px; }

  .corner {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    gap: 6px;
  }
  .bar { gap: 5px; }
  .bar button { width: 36px; height: 36px; font-size: 14px; }
  .minimap { width: 118px; border-width: 3px; border-radius: 14px; }

  .is-touch .gauges { padding: 5px 10px; gap: 8px; border-radius: 13px; }
  .is-touch .gauges .meter { width: 64px; font-size: 11px; gap: 5px; }
  .is-touch .speed b { font-size: 17px; }
  .is-touch .line { padding: 5px 10px; font-size: 11px; gap: 6px; border-radius: 13px; }

  .radio { padding: 13px 16px 10px; border-radius: 18px; }
  .radio b { font-size: 11.5px; padding: 2px 10px; }
  .radio p { font-size: 14.5px; line-height: 1.5; min-width: 6em; }
  .prompt { font-size: 14px; padding: 8px 16px; }

  .screen.title {
    background: linear-gradient(180deg, rgba(255, 246, 228, 0.36) 0%, rgba(255, 246, 228, 0.86) 36%, rgba(255, 246, 228, 0.94) 100%);
  }
  .title-top {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
  .title-main {
    margin: 0;
    padding: calc(max(12px, env(safe-area-inset-top)) + 54px) max(16px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .title-main h1 { font-size: clamp(38px, 10.5vw, 62px); }
  .title-main h1 small { margin-top: 8px; font-size: 12.5px; letter-spacing: 0.34em; }
  .chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 18px 0 12px; }
  .chapter { padding: 11px 12px 10px; border-radius: 16px; }
  .chapter b { font-size: 15px; }
  .chapter em { min-height: 0; }
  /* 2 列布局下，尾声卡片横向跨满两列，不留孤零零的空位 */
  .chapter.epilogue {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 2px 12px;
  }
  .chapter.epilogue small { grid-column: 1; }
  .chapter.epilogue b { grid-column: 1; }
  .chapter.epilogue em { grid-column: 1; }
  .chapter.epilogue .count { grid-column: 2; grid-row: 1 / span 3; font-size: 13px; font-weight: 700; }

  .card { padding: 22px 20px 20px; border-radius: 24px; }
  .letters { grid-template-columns: 1fr; max-height: 54dvh; }
  .letter {
    position: fixed; left: 50%; top: 50%; margin: 0;
    width: min(340px, calc(100vw - 32px)); max-height: 62dvh;
    transform: translate(-50%, -50%); animation: none; z-index: 8;
  }
}

@media (max-width: 480px) {
  .title-main .actions button { min-height: 44px; padding: 10px 16px; font-size: 14.5px; }
  .title-main .actions button.primary { flex: 1 1 100%; }
  .title-main .actions button:not(.primary) { flex: 1 1 0; }
  .card-title { padding: 12px 24px 14px; border-radius: 22px; }
  .card-title p { font-size: 13.5px; }
  .result .big { font-size: 38px; }
  .result .actions button { flex: 1 1 auto; }
}

/* 竖着的窄屏，顶上一排被任务栏和小地图占满了：提示挂到任务栏下面，章名往下让。 */
@media (max-width: 760px) and (orientation: portrait) {
  .toasts { top: calc(var(--objectives-bottom, 110px) + 8px); left: max(12px, env(safe-area-inset-left)); transform: none; align-items: flex-start; }
  .toast { max-width: calc(100vw - 156px); white-space: normal; border-radius: 16px; font-size: 13px; padding: 6px 12px; }
  .card-title { top: 26%; }
}

/* 手机横屏 / 矮视口 */
@media (max-height: 520px) {
  .card-title { top: 9%; padding: 10px 30px 12px; }
  .card-title h2 { font-size: 26px; }
  .prompt { bottom: 38%; font-size: 13.5px; padding: 7px 16px; }
  .minimap { width: 112px; }
  .bar button { width: 34px; height: 34px; font-size: 13.5px; }
  .stick { width: 98px; height: 98px; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); }
  .pads { right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); gap: 8px; }
  .pad { width: 60px; height: 60px; font-size: 12.5px; }
  .is-touch .radio {
    --side: max(14px, env(safe-area-inset-left), env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(640px, calc(100vw - 2 * (var(--side) + 146px)));
    padding: 11px 16px 8px;
  }
  .is-touch .radio p { font-size: 13.5px; }
  #ui:not(.is-touch) .radio {
    left: auto;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: none;
    max-width: calc(100vw - 266px);
    padding: 12px 16px 9px;
  }
  #ui:not(.is-touch) .radio p { font-size: 14px; }
  .screen.title {
    background: linear-gradient(90deg, rgba(255, 246, 228, 0.94) 0%, rgba(255, 246, 228, 0.8) 56%, rgba(255, 246, 228, 0.16) 100%);
  }
  .title-main {
    margin: 0;
    padding: calc(max(12px, env(safe-area-inset-top)) + 34px) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  }
  .title-main h1 { font-size: clamp(34px, 7vw, 48px); }
  .chapters { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 14px 0 10px; }
  .chapter.epilogue { grid-column: auto; display: flex; flex-direction: column; align-items: flex-start; }
  .card { width: min(600px, 100%); padding: 14px 20px 14px; border-radius: 22px; }
  .card h2 { font-size: 21px; margin-bottom: 4px; }
  .card > p { margin-bottom: 8px; font-size: 13.5px; line-height: 1.5; }
  .card .keys { margin-bottom: 10px; font-size: 12px; line-height: 1.45; }
  .actions.col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .actions.col button.primary { grid-column: 1 / -1; }
  .actions.col button { padding: 7px 14px; font-size: 13.5px; }
  .lang-section { margin-top: 10px; padding-top: 10px; }
  .lang-section small { margin-bottom: 6px; }
  .lang-pill { padding: 5px 10px; font-size: 12px; }
  .letters { max-height: 52dvh; }
  /* 屏太矮，小地图下面挂不下信纸：放到正中间读，点 × 或等它自己收起来。 */
  .letter {
    position: fixed; left: 50%; top: 50%; margin: 0;
    max-height: 72dvh; transform: translate(-50%, -50%); animation: none; z-index: 8;
  }
}

.title-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.title-foot .keys { margin: 0; flex: 1 1 320px; }
.guide-trigger {
  padding: 6px 14px;
  font-size: 12.5px;
  background: rgba(255, 248, 234, 0.78);
  color: var(--ink);
  box-shadow: 0 3px 12px rgba(74, 58, 34, 0.1);
}

/* ───────── 静态 SEO 海湾指南与 FAQ 抽屉（默认收起，不遮挡 3D 海湾） ───────── */
.guide-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.guide-drawer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 54, 72, 0.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.guide-sheet {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(84dvh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 64px rgba(47, 77, 104, 0.28), 0 1px 0 rgba(255, 255, 255, 0.85) inset;
  transform: translateY(14px) scale(0.985);
  transition: transform 0.24s ease;
}
.guide-drawer.is-open .guide-sheet { transform: none; }
.guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 248, 234, 0.96);
}
.guide-badge {
  display: block;
  color: var(--coral-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.guide-head h2 {
  margin: 0;
  font: 700 clamp(20px, 3.6vw, 28px) / 1.25 var(--display);
  color: #2f4d68;
}
.guide-close {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  box-shadow: none;
  background: rgba(59, 67, 82, 0.08);
  border-color: transparent;
}
.guide-body {
  padding: 20px 26px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 67, 82, 0.25) transparent;
}
.guide-lead {
  margin: 0 0 16px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
}
.guide-cta-row { margin-bottom: 20px; }
.guide-body section { margin: 20px 0 0; }
.guide-body h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  color: #2f4d68;
}
.guide-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
}
.guide-fleet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.guide-ship {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
}
.guide-ship h4 {
  margin: 0 0 4px;
  font-size: 14.5px;
  color: var(--coral-ink);
}
.guide-ship p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
}
.guide-faqs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guide-faq {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  padding: 11px 15px;
}
.guide-faq summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.5;
  color: #2f4d68;
}
.guide-faq p {
  margin: 8px 0 2px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}
.guide-langs {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.guide-langs small {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.guide-lang-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.guide-lang-links a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(59, 67, 82, 0.07);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.guide-lang-links a:hover { background: rgba(59, 67, 82, 0.14); }
.guide-lang-links a.active { background: var(--sun); color: #4a3305; }

.noscript-fallback {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 32px 20px;
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}

@media (max-width: 640px) {
  .guide-head { padding: 16px 18px 12px; }
  .guide-body { padding: 16px 18px 20px; }
  .guide-fleet { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .prompt, .toast, .result .big i, .screen, .letter.play, .card-title.play, .lang-list { animation: none; }
  .guide-drawer, .guide-sheet, .holo-card { transition: none; }
}

/* ───────── 社媒分享、3D 流光航海卡、实景明信片与好友挑战 ───────── */
.bar .cam-pill {
  width: auto;
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(135deg, #fff6df, #fde4a4);
  border-color: rgba(217, 154, 31, 0.42);
  color: #5a3a04;
}
.bar .cam-pill:hover:not(:disabled) { background: linear-gradient(135deg, #fff9ea, #ffeaa9); }
.icon-cam { flex: none; display: block; }

button.challenge-cta {
  background: linear-gradient(135deg, #e9634a, #f17a52);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(233, 99, 74, 0.34), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}
button.challenge-cta:hover:not(:disabled) {
  background: linear-gradient(135deg, #f26d54, #f7875e);
  color: #fff;
}
.actions.col button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.screen-toasts {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 90;
  pointer-events: none;
}

.vs-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 248, 234, 0.97), rgba(255, 237, 200, 0.94));
  border: 1.5px solid rgba(233, 99, 74, 0.38);
  pointer-events: auto;
}
.vs-banner-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vs-banner-body strong { font-size: 15.5px; color: var(--coral-ink); line-height: 1.3; }
.vs-banner-body span { font-size: 13px; color: var(--ink); opacity: 0.88; line-height: 1.4; }
.vs-banner-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.vs-banner-actions .primary { min-height: 42px; padding: 9px 18px; font-size: 14.5px; }
.vs-dismiss {
  width: 36px; height: 36px; padding: 0; font-size: 19px; line-height: 1;
  box-shadow: none; background: rgba(59, 67, 82, 0.08); border-color: transparent;
}

.card.result,
.card.postcard-modal,
.card.challenge-modal {
  width: min(580px, 100%);
  padding: 22px 26px 24px;
}

.postcard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.postcard-head small { color: var(--coral-ink); font-weight: 700; letter-spacing: 0.12em; font-size: 12px; }
.postcard-head h2 { margin: 2px 0 0; }
.postcard-x {
  flex: none; width: 38px; height: 38px; padding: 0; font-size: 22px; line-height: 1;
  box-shadow: none; background: rgba(59, 67, 82, 0.08); border-color: transparent;
}
.postcard-sub { margin: 0 0 12px; font-size: 14px; color: var(--ink-dim); line-height: 1.55; }
.postcard-modal .actions,
.challenge-modal .actions { justify-content: center; margin-top: 14px; }
.postcard-modal .actions button,
.challenge-modal .actions button,
.result .actions button { min-height: 44px; padding: 10px 22px; font-size: 15px; }

.ch-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}
.ch-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 11px;
  border-radius: 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid rgba(122, 96, 62, 0.14);
  box-shadow: none;
}
.ch-pick small { font-size: 10.5px; color: var(--coral-ink); font-weight: 700; }
.ch-pick b { font-size: 14px; color: #2f4d68; line-height: 1.25; }
.ch-pick span { font-size: 11px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ch-pick.active {
  background: linear-gradient(135deg, #fff3c9, #ffe294);
  border-color: #df9e20;
  box-shadow: 0 6px 16px rgba(217, 154, 31, 0.24);
}
.ch-pick.active span { color: #5c3d04; font-weight: 700; }

.challenge-stars { text-align: center; font-size: 32px; margin: 2px 0 4px; }
.challenge-open-note {
  margin: 4px 0 2px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(63, 154, 148, 0.1);
  color: #1f5c57;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.holo-stage { perspective: 1000px; margin: 4px 0 14px; }
.holo-card {
  --px: 50%;
  --py: 50%;
  --rx: 0deg;
  --ry: 0deg;
  --op: 0.45;
  position: relative;
  border-radius: 22px;
  padding: 2.5px;
  transform-style: preserve-3d;
  transform: rotateY(var(--rx)) rotateX(var(--ry));
  box-shadow: 0 14px 36px rgba(47, 77, 104, 0.18), 0 1px 0 rgba(255, 255, 255, 0.78) inset;
  background: linear-gradient(135deg, #f8d166, #fff3be, #e59c2d, #f7d979);
}
.holo-card[data-rarity="pearl"] { background: linear-gradient(135deg, #ffd6a5, #fff4d2, #9be5e5, #d6b8ff, #ffbfa8); }
.holo-card[data-rarity="gold"] { background: linear-gradient(135deg, #f8d166, #fff3be, #e59c2d, #f7d979); }
.holo-card[data-rarity="silver"] { background: linear-gradient(135deg, #b8d8e6, #f4fbff, #7eb8c4, #d5ecf5); }
.holo-card[data-rarity="bronze"] { background: linear-gradient(135deg, #e3a672, #ffe3c4, #c47447, #ebb88b); }
.holo-card[data-rarity="explorer"] { background: linear-gradient(135deg, #5cc2b9, #d7f7f2, #4592c7, #f5bf45); }

.holo-inner {
  position: relative;
  overflow: hidden;
  border-radius: 19.5px;
  background: linear-gradient(180deg, #fffcf3 0%, #fff6e2 100%);
  padding: 14px 16px 14px;
}
.holo-shine {
  position: absolute;
  inset: 0;
  border-radius: 19.5px;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: var(--op);
  background:
    radial-gradient(circle at var(--px) var(--py), rgba(255, 255, 255, 0.9), rgba(255, 232, 165, 0.28) 30%, transparent 65%),
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0) 0 18px, rgba(255, 220, 140, 0.18) 18px 26px, rgba(110, 212, 216, 0.16) 26px 34px);
}
.holo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.holo-top small { color: var(--coral-ink); font-weight: 700; font-size: 12.5px; letter-spacing: 0.06em; }
.rank-pill {
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(245, 191, 69, 0.28);
  border: 1px solid rgba(217, 154, 31, 0.34);
  color: #5c3d04;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.holo-photo {
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid #fff;
  box-shadow: 0 8px 20px rgba(47, 77, 104, 0.16);
  aspect-ratio: 16 / 9;
  background: #bfe3ec;
  margin-bottom: 10px;
}
.holo-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

.result .holo-inner h2 { font-size: clamp(20px, 4.2vw, 25px); margin: 2px 0 0; }
.result .holo-inner .big { font-size: 38px; margin: 2px 0 0; }
.result .holo-inner .remark { margin: 2px 0 8px; font-size: 13.5px; }
.result .holo-inner dl,
.postcard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0 2px;
  text-align: center;
}
.result .holo-inner dl > div,
.postcard-stats > div {
  padding: 7px 6px;
  border-radius: 12px;
  background: rgba(47, 77, 104, 0.055);
  border: 1px solid rgba(122, 96, 62, 0.1);
}
.postcard-stats dt { font-size: 11.5px; color: var(--ink-dim); }
.postcard-stats dd { margin: 2px 0 0; font-size: 15.5px; font-weight: 700; color: #2f4d68; }
.result .holo-inner dd { font-size: 17px; color: #2f4d68; }
.result .quote { margin: 0 0 12px; font-size: 15.5px; line-height: 1.65; }

.vs-result {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(245, 191, 69, 0.16);
  border: 1.5px solid rgba(217, 154, 31, 0.36);
  text-align: center;
}
.vs-result.is-tie { background: rgba(63, 154, 148, 0.12); border-color: rgba(63, 154, 148, 0.32); }
.vs-result.is-close { background: rgba(233, 99, 74, 0.1); border-color: rgba(233, 99, 74, 0.28); }
.vs-result strong { display: block; font-size: 15px; color: #2f4d68; margin-bottom: 8px; }
.vs-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.vs-grid > div {
  padding: 8px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vs-grid em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-grid b { font-size: 15px; }
.vs-grid span { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }
.vs-badge {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--coral); color: #fff; font-style: normal; font-size: 11.5px; font-weight: 800;
}

.share-dock {
  margin: 0 0 16px;
  padding: 14px 15px;
  border-radius: 22px;
  background: rgba(47, 77, 104, 0.055);
  border: 1px solid rgba(122, 96, 62, 0.14);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.share-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.captain-edit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-dim);
  flex: 1 1 200px;
}
.captain-name-input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(122, 96, 62, 0.22);
  background: #fff;
  color: var(--ink);
  font: 600 14px var(--font);
  outline: none;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}
.captain-name-input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(63, 154, 148, 0.22); }
.share-status {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-dim);
  white-space: nowrap;
}
.share-status.ready { color: var(--teal); }

.share-hero-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.share-copy-btn {
  width: 100%;
  min-height: 50px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #e9634a, #f37d53);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px rgba(233, 99, 74, 0.34), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}
.share-copy-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #f06d54, #f9895f);
  color: #fff;
}
.share-vs-btn {
  width: 100%;
  min-height: 48px;
  padding: 11px 18px;
  font-size: 15.5px;
  font-weight: 800;
  background: linear-gradient(135deg, #2f4d68, #3d6487);
  border-color: transparent;
  color: #fff8ea;
  box-shadow: 0 8px 20px rgba(47, 77, 104, 0.28);
}
.share-vs-btn:hover:not(:disabled) { background: linear-gradient(135deg, #254057, #355878); color: #fff; }

.share-img-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.share-img-btn {
  min-height: 46px;
  padding: 10px 14px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 16px;
  background: #fff;
  border: 1.5px solid rgba(122, 96, 62, 0.2);
  color: #2f4d68;
  box-shadow: 0 4px 12px rgba(74, 58, 34, 0.09);
}
.share-img-btn:hover:not(:disabled) { background: #fffbf0; border-color: var(--sun); }

.share-social-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.social-pill {
  min-height: 46px;
  padding: 10px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 16px;
  border: 0;
  color: #fff;
  box-shadow: 0 5px 14px rgba(47, 77, 104, 0.16);
}
.social-pill svg { flex: none; display: block; }
.social-pill.is-x { background: #1d2229; }
.social-pill.is-x:hover:not(:disabled) { background: #0d1014; color: #fff; }
.social-pill.is-line { background: #06c755; }
.social-pill.is-line:hover:not(:disabled) { background: #05b34c; color: #fff; }
.social-pill.is-threads { background: #26262a; }
.social-pill.is-threads:hover:not(:disabled) { background: #111114; color: #fff; }
.social-pill.is-bsky { background: #1185fe; }
.social-pill.is-bsky:hover:not(:disabled) { background: #0070e8; color: #fff; }

/* ───────── WebView 安全高清卡预览弹窗（支持长按保存） ───────── */
.share-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  pointer-events: auto;
}
.share-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 46, 62, 0.56);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.share-preview-card {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 20px 22px 22px;
  border-radius: 26px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 24px 64px rgba(24, 42, 58, 0.34);
  text-align: center;
}
.share-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.share-preview-head b { font-size: 18px; color: #2f4d68; }
.share-preview-close {
  width: 38px; height: 38px; padding: 0; font-size: 22px; line-height: 1;
  box-shadow: none; background: rgba(59, 67, 82, 0.08); border-color: transparent;
}
.share-preview-img {
  display: block;
  max-width: 100%;
  max-height: 54dvh;
  margin: 0 auto 12px;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(47, 77, 104, 0.2);
  user-select: auto;
  -webkit-user-select: auto;
  -webkit-touch-callout: default;
}
.share-preview-hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.5;
}
.share-preview-card .actions { justify-content: center; }
.share-preview-card .actions button { min-height: 46px; padding: 11px 22px; font-size: 15px; }

@media (max-width: 760px) {
  .bar .cam-pill { height: 36px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
}

@media (max-width: 560px) {
  .vs-banner { flex-direction: column; align-items: stretch; }
  .vs-banner-actions { justify-content: flex-end; }
  .card.result, .card.postcard-modal, .card.challenge-modal { padding: 16px 16px 18px; }
  .ch-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share-social-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share-img-row { grid-template-columns: 1fr; }
}
