/* 돛단배 — design width 390px, stage viewport scale */

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/MonaS12.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/MonaS12-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/MonaS12TextKR.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ui-scale: 1;
  --design-w: 390px;
  --ship-zone-h: 300px;
  --stage-scale: 1;
  --h-app-pad-x: 20px;
  --h-app-pad-top: 40px;
  --h-app-pad-bottom: 36px;
  --h-app-gap: 14px;
  --h-app-max-width: 480px;
  --h-title-size: 26px;
  --h-title-margin-bottom: 4px;
  --h-hint-size: 14px;
  --h-badge-size: 12px;
  --h-btn-size: 16px;
  --h-btn-pad-y: 12px;
  --h-btn-pad-x: 16px;
  --h-field-size: 14px;
  --h-label-size: 12px;
  --h-ship-owner-size: 18px;
  --h-ship-zone-min-height: 300px;
  --h-ship-zone-max-height: 420px;
  --h-ship-zone-radius: 16px;
  --h-ship-zone-border: 2px;
  --h-icon-btn-size: 14px;
  --bg: #cfefff;
  --card: #e9f7ff;
  --main: #6fb8de;
  --main-dark: #2e6f91;
  --accent: #7ec8ee;
  --accent-dark: #4fa6d5;
  --text: #1f4e68;
  --warn-bg: #fff8e6;
  --warn-border: #f0c96a;
  --shadow: 0 8px 24px rgba(21, 58, 86, 0.15);
  --fs-12: 12px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-24: 24px;
  --sail-icon-size: 44px;
  --paper-bg: #e8f6ff;
  --paper-line: rgba(46, 111, 145, 0.1);
  --letter-envelope: #b5dff2;
  --letter-envelope-dark: #8ec5e6;
  --letter-envelope-top: #d2edfb;
  --letter-ink: #1f4e68;
  --letter-ink-soft: #3a6a84;
  --letter-max-chars: 200;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Mona Sans", system-ui, -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
}

html.file-open #wrongOpenHelp {
  display: block;
}

.wrong-open {
  margin: 12px auto;
  max-width: 520px;
  padding: 14px;
  background: var(--warn-bg);
  border: 2px solid var(--warn-border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.asset-blocker[hidden] {
  display: none !important;
}

.asset-blocker {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(191, 232, 255, 0.92);
}

.asset-blocker-card {
  max-width: 400px;
  padding: 20px;
  background: #fff;
  border-radius: 14px;
  border: 2px solid var(--warn-border);
  box-shadow: var(--shadow);
  text-align: center;
}

.asset-blocker-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
}

.asset-blocker-text {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-all;
}

.asset-blocker-hint {
  margin: 0;
  font-size: 13px;
  opacity: 0.85;
  line-height: 1.5;
}

.asset-blocker-hint code {
  font-size: 12px;
  word-break: break-all;
}

.asset-blocker-link {
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.asset-blocker-link a {
  color: var(--main-dark);
}

.asset-blocker-dismiss {
  margin-top: 14px;
  width: 100%;
}

.stage-viewport {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(8px, env(safe-area-inset-top)) 0 max(12px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.stage {
  width: var(--design-w);
  transform: scale(var(--stage-scale));
  transform-origin: top center;
  flex-shrink: 0;
}

.app {
  width: min(var(--design-w), 100%);
  max-width: var(--h-app-max-width);
  margin: 0 auto;
  padding: var(--h-app-pad-top) var(--h-app-pad-x) var(--h-app-pad-bottom);
  display: flex;
  flex-direction: column;
  gap: var(--h-app-gap);
}

.page-header {
  text-align: center;
  margin-bottom: 10px;
}

.context-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  font-size: var(--h-badge-size);
  font-weight: 700;
  color: var(--main-dark);
}

.page-title {
  margin: 0 0 10px;
  font-size: var(--h-title-size);
  font-weight: 800;
  line-height: 1.2;
}

.context-hint,
.page-hint {
  margin: 0;
  font-size: var(--h-hint-size);
  line-height: 1.45;
  opacity: 0.9;
  text-align: center;
  color: #3c7fa3;
}

/*
 * 역할 하네스 — 2가지 화면
 * mine  : 내 편지함  — 받은 편지 보기, 링크 공유 (편지 폼은 테스트 시만)
 * friend: 친구 보기  — 꾸밈 아이콘, 하단 편지 폼 (공유 버튼 없음)
 */

.deck-owner-only,
.deck-guest-compose {
  width: 100%;
}

/* ── 공유: 주인(mine) 화면만 ── */
.deck-share-invite,
.share-invite-block,
.deck-owner-only {
  display: none;
}

.app[data-page-role="mine"] .deck-share-invite,
.app[data-page-role="mine"] .deck-owner-only {
  display: grid;
  gap: 10px;
}

.app[data-page-role="friend"] .deck-share-invite,
.app[data-page-role="friend"] .deck-owner-only,
.app[data-page-role="friend"] #shareInviteBlock {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.share-invite-hint {
  margin: 0;
  font-size: var(--fs-14);
  color: #4a7f9a;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.share-invite-hint strong {
  color: #2e6f91;
}

.btn-mine-letter-test {
  font-size: 14px;
  font-weight: 700;
}

/* ── 편지 폼: 친구 화면 기본 노출 / 주인은 테스트 토글 시만 ── */
.app[data-page-role="mine"] .deck-letter-compose {
  display: none !important;
}

.app[data-page-role="mine"].mine-letter-test-open .deck-letter-compose {
  display: block !important;
}

.app[data-page-role="mine"].mine-letter-test-open .deck-letter-compose::before {
  content: "테스트 편지 (내 돛단배에만 표시·전송)";
  display: block;
  text-align: center;
  font-size: var(--fs-14);
  font-weight: 800;
  color: #2e6f91;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.app[data-page-role="friend"] .deck-letter-compose {
  display: block;
  margin-top: 2px;
  padding-top: 14px;
  border-top: 2px dashed rgba(46, 111, 145, 0.22);
}

.app[data-page-role="friend"] .deck-letter-compose .letter-form {
  display: grid !important;
}

.app[data-page-role="friend"] .deck-letter-compose::before {
  content: "편지 남기기";
  display: block;
  text-align: center;
  font-size: var(--fs-14);
  font-weight: 800;
  color: #2e6f91;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

/* ── 컨트롤 버튼 노출 규칙 ── */
.app[data-page-role="mine"] #renameNicknameButton { display: inline-flex; }
.app[data-page-role="mine"] #myBoxButton          { display: none; }

.app[data-page-role="friend"] #renameNicknameButton { display: none; }
.app[data-page-role="friend"] #myBoxButton          { display: inline-flex; }

/* 구형 페이지바 — 완전 숨김 (JS 내부 참조용으로만 DOM 잔존) */
#sailPageBar {
  display: none !important;
}

/* 페이지 화살표 바 */
.sail-page-dots {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 2px;
}

.sail-page-dots[hidden] {
  display: none !important;
}

.sail-page-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: #2e6f91;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(21, 58, 86, 0.1);
  transition: background 0.1s ease, transform 0.08s ease;
  flex-shrink: 0;
}

.sail-page-dot:hover {
  background: #eaf6fd;
}

.sail-page-dot:active {
  transform: scale(0.91);
}

.sail-page-dot[hidden] {
  visibility: hidden;   /* 자리 유지 + 투명 */
  pointer-events: none;
}

.sail-icons-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.ship-zone {
  position: relative;
  width: 100%;
  min-height: var(--h-ship-zone-min-height);
  max-height: var(--h-ship-zone-max-height);
  height: var(--ship-zone-h, var(--h-ship-zone-min-height));
  border-radius: var(--h-ship-zone-radius);
  background: #bfe8ff;
  border: var(--h-ship-zone-border) solid #96cde9;
  overflow: visible;
  user-select: none;
}

.boat-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.ship-owner-label {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  font-size: var(--h-ship-owner-size);
  font-weight: 800;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 내용이 없으면 흰 바가 보이지 않도록 숨김 */
.ship-owner-label:empty {
  display: none;
}

/* 새 편지 도착 — 배 정중앙 흰색 라벨만 (하단 토스트·박스 없음) */
.empty-letter-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  margin: 0;
  padding: 12px 22px;
  border-radius: 12px;
  background: #fff;
  font-size: var(--fs-14);
  font-weight: 700;
  color: #2a4a5c;
  white-space: nowrap;
  border: none;
  box-shadow: 0 4px 16px rgba(21, 58, 86, 0.14);
  pointer-events: none;
}

.empty-letter-hint.letter-arrival-hint {
  animation: letter-arrival-pop 0.35s ease-out;
}

@keyframes letter-arrival-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.empty-letter-hint[hidden] {
  display: none !important;
}

.sail-icons-left,
.sail-icons-right {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.sail-letter-icon {
  position: absolute;
  width: var(--sail-icon-size, 44px);
  height: var(--sail-icon-size, 44px);
  margin: calc(var(--sail-icon-size, 44px) / -2) 0 0 calc(var(--sail-icon-size, 44px) / -2);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.12s ease;
}

.sail-letter-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.sail-letter-icon:active {
  transform: scale(0.92);
}

.app[data-page-role="friend"] .sail-letter-icon {
  cursor: default;
  pointer-events: none;
}

.share-invite-block {
  position: relative;
  z-index: 8;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.btn-main {
  background: var(--main);
  color: #fff;
  font-size: var(--h-btn-size);
  padding: var(--h-btn-pad-y) var(--h-btn-pad-x);
}

/* 링크 공유 · 배 이름 변경 — 연한 파랑 */
#shareInviteButton,
#renameNicknameButton {
  background: #a8d9f0;
  color: #1f5a7a;
}

/* 편지 보내기 — 공유 버튼과 구분되는 진한 색 */
.btn-letter-send,
#letterSubmit.btn-letter-send {
  background: linear-gradient(180deg, #3d8fb8 0%, #2e6f91 100%);
  color: #fff;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.15),
    0 4px 14px rgba(46, 111, 145, 0.28);
}

.share-modal-lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #3a6a84;
  text-align: center;
}

.share-modal-lead strong {
  color: #2e6f91;
}

.btn-sub {
  background: #fff;
  color: var(--main-dark);
  font-size: var(--h-btn-size);
  padding: var(--h-btn-pad-y) var(--h-btn-pad-x);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

.controls-row {
  display: flex;
  gap: 10px;
}

.controls-row .btn {
  flex: 1;
}

#arcadeButton {
  display: none;
  width: 100%;
  justify-content: center;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.app[data-page-role="mine"] #arcadeButton {
  display: inline-flex;
  background: #a8d9f0;
  color: #1f5a7a;
  font-size: var(--h-btn-size);
  padding: var(--h-btn-pad-y) var(--h-btn-pad-x);
}

.app[data-page-role="friend"] #arcadeButton {
  display: inline-flex;
  background: #fff;
  color: var(--main-dark);
  font-size: var(--h-btn-size);
  padding: var(--h-btn-pad-y) var(--h-btn-pad-x);
}

.app[data-page-role="send"] #arcadeButton {
  display: none;
}

.form,
.letter-form {
  margin-top: 0;
  display: grid;
  gap: 14px;
  background: linear-gradient(180deg, #eef9ff 0%, #e3f4fc 100%);
  padding: 18px 16px;
  border-radius: 14px;
  border: 2px solid #9fd0ea;
  text-align: left;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: var(--fs-14);
  font-weight: 700;
  color: #3a6a84;
  padding-left: 1.5px;
}

.field input,
.field textarea {
  width: 100%;
  border: 2px solid rgba(31, 78, 104, 0.15);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: var(--h-field-size);
  color: var(--text);
  background: #fff;
}

.field textarea {
  resize: vertical;
  min-height: 168px;
  line-height: 1.65;
  text-align: left;
  direction: ltr;
  unicode-bidi: isolate;
}

.letter-form .field-message-hint {
  margin: -4px 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--letter-ink-soft);
  text-align: right;
}

/* 편지 보내기 제출 버튼 — 마지막 필드와 여백 */
.letter-form #letterSubmit {
  margin-top: 6px;
}

.cloud-hint {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  font-size: 13px;
  line-height: 1.45;
}

.sync-harness-panel {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f0f4ff;
  border: 1px dashed #6b8cce;
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
  max-height: 220px;
  overflow: auto;
}

.sync-harness-panel pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
}

.status-line {
  margin: 0;
  font-size: 12px;
  text-align: center;
  opacity: 0.75;
  min-height: 1.2em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 11000;
  max-width: min(340px, calc(100vw - 24px));
  padding: 10px 14px;
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  color: #0d3f5a;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid #7ec8ee;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(21, 58, 86, 0.2);
  pointer-events: none;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 45, 65, 0.45);
  pointer-events: none;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  max-height: min(88vh, 640px);
  overflow: auto;
  padding: 20px 18px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

.modal-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 800;
  padding-right: 28px;
}

.share-lead {
  margin: 0 0 12px;
  font-size: var(--fs-14);
  line-height: 1.45;
}

.share-channels {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 16px;
  padding: 8px 0 4px;
}

.share-channel-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: #e8f4fc;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  color: var(--main-dark);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(21, 58, 86, 0.12);
  transition: background 0.12s ease, transform 0.1s ease;
}

.share-channel-btn:active {
  transform: scale(0.93);
  background: #d0e9f8;
}

.share-channel-label {
  display: block;
  line-height: 1;
  margin-top: -2px;
}

.share-channel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.share-channel-icon svg {
  width: 26px;
  height: 26px;
}

.modal-card-letter {
  position: relative;
  width: min(320px, calc(var(--design-w) - 28px));
  max-width: 100%;
  max-height: min(640px, 90dvh);
  padding: 0;
  border: none;
  border-radius: 6px 6px 12px 12px;
  background: var(--letter-envelope);
  box-shadow: 0 2px 0 var(--letter-envelope-dark), 0 14px 32px rgba(21, 58, 86, 0.22);
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
  direction: ltr;
}

.modal-card-letter::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  height: 36px;
  background: linear-gradient(180deg, var(--letter-envelope-top) 0%, var(--letter-envelope) 100%);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  border-radius: 2px 2px 0 0;
  pointer-events: none;
}

.letter-modal-head {
  position: relative;
  padding: 20px 16px 10px 52px;
  text-align: left;
}

.letter-stamp {
  position: absolute;
  top: 16px;
  left: 14px;
  width: 32px;
  height: 38px;
  border: 2px dashed rgba(79, 166, 213, 0.65);
  border-radius: 4px;
  background:
    radial-gradient(circle at 50% 45%, rgba(111, 184, 222, 0.35) 0 42%, transparent 43%),
    rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

.letter-stamp::after {
  content: "♥";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--main-dark);
  opacity: 0.8;
}

.letter-to-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--letter-ink-soft);
  text-align: left;
}

.modal-card-letter .modal-letter-title {
  margin: 0;
  font-size: var(--fs-18);
  font-weight: 700;
  color: var(--letter-ink);
  line-height: 1.45;
  text-align: left;
  word-break: break-word;
  overflow-wrap: break-word;
}

.modal-card-letter .modal-letter-title.is-placeholder {
  color: var(--letter-ink-soft);
  font-weight: 600;
  font-size: var(--fs-16);
}

.letter-paper {
  margin: 0 12px;
  padding: 18px 16px 22px;
  min-height: 220px;
  border-radius: 8px;
  border: 1px solid rgba(79, 166, 213, 0.35);
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, var(--paper-line) 27px 28px),
    linear-gradient(180deg, #f3fbff 0%, var(--paper-bg) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  text-align: left;
  overflow-x: hidden;
}

.modal-card-letter .modal-letter-body {
  margin: 0;
  min-height: 180px;
  line-height: 1.7;
  white-space: pre-wrap;
  text-align: left;
  direction: ltr;
  unicode-bidi: isolate;
  word-break: break-word;
  overflow-wrap: break-word;
  color: var(--letter-ink);
  font-size: var(--fs-14);
  font-weight: 600;
  max-width: 100%;
}

.letter-modal-foot {
  padding: 12px 18px 14px;
  text-align: left;
}

.modal-card-letter .modal-letter-meta {
  margin: 0 0 4px;
  font-size: var(--fs-12);
  color: var(--letter-ink-soft);
  line-height: 1.4;
  text-align: left;
}

.modal-card-letter .letter-close-btn {
  width: calc(100% - 24px);
  margin: 0 12px 14px;
  padding: 10px 14px;
  font-size: var(--fs-14);
  border-radius: 8px;
  background: #e8f6ff;
  color: var(--main-dark);
  box-shadow: inset 0 -2px 0 #9fd0ea;
}

.modal-card-nickname {
  --nickname-modal-text: var(--fs-16);
}

.modal-card-nickname .modal-letter-title {
  margin-bottom: 16px;
  font-size: var(--fs-16);
  font-weight: 700;
  text-align: center;
  color: #2e6f91;
  line-height: 1.5;
}

.modal-card-nickname #nicknameInput {
  width: 100%;
  border: 2px solid #a7d2e8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: var(--nickname-modal-text);
  font-weight: 700;
  margin-bottom: 14px;
  outline: none;
  background: #fff;
  color: #1f4e68;
}

.modal-card-nickname .btn-main {
  width: 100%;
}

@media (min-width: 768px) {
  .stage-viewport {
    padding-top: 16px;
  }
}

/* 모바일 가독성 — 글자 크기 상향 (768px 미만) */
@media (max-width: 767px) {
  :root {
    --h-title-size: 30px;
    --h-hint-size: 16px;
    --h-badge-size: 14px;
    --h-btn-size: 18px;
    --h-btn-pad-y: 14px;
    --h-field-size: 16px;
    --h-label-size: 14px;
    --h-ship-owner-size: 21px;
    --h-icon-btn-size: 16px;
    --fs-12: 14px;
    --fs-14: 16px;
    --fs-16: 18px;
    --fs-18: 20px;
    --fs-24: 26px;
  }

  .wrong-open {
    font-size: 16px;
  }

  .asset-blocker-title {
    font-size: 20px;
  }

  .asset-blocker-text {
    font-size: 16px;
  }

  .asset-blocker-hint {
    font-size: 15px;
  }

  .asset-blocker-hint code {
    font-size: 14px;
  }

  .asset-blocker-link {
    font-size: 16px;
  }

  .btn {
    font-size: 19px;
  }

  .share-modal-lead {
    font-size: 15px;
  }

  .letter-form .field-message-hint {
    font-size: 13px;
  }

  .cloud-hint {
    font-size: 15px;
  }

  .sync-harness-panel {
    font-size: 13px;
  }

  .sync-harness-panel pre {
    font-size: 12px;
  }

  .status-line {
    font-size: 14px;
  }

  .modal-title {
    font-size: 22px;
  }

  .share-channel-btn {
    font-size: 13px;
  }

  .letter-to-label {
    font-size: 13px;
  }

  .sailbox-login-eyebrow {
    font-size: 14px;
  }

  .sailbox-login-title {
    font-size: 32px;
  }

  .sailbox-login-lead {
    font-size: 16px;
  }

  .sailbox-login-busy,
  .sailbox-login-error {
    font-size: 15px;
  }

  .sailbox-login-btn {
    font-size: 17px;
    padding: 15px 16px;
  }

  .sailbox-login-note {
    font-size: 13px;
  }

  .sailbox-auth-tab {
    font-size: 15px;
  }

  .sailbox-auth-label {
    font-size: 14px;
  }

  .sailbox-auth-input {
    font-size: 17px;
  }

  .sailbox-account-bar {
    font-size: 13px;
  }

  .sailbox-account-logout {
    font-size: 13px;
    padding: 5px 12px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .page-title {
    font-size: 22px;
  }
  .ship-zone {
    height: 220px;
  }
}

/* ── 진입 로그인 게이트 ── */
body.sailbox-login-pending {
  overflow: hidden;
}

.sailbox-login-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(165deg, #b8e4f8 0%, #7ec8eb 45%, #4aa3d8 100%);
  font-family: "Mona Sans", system-ui, sans-serif;
}

.sailbox-login-gate[hidden] {
  display: none !important;
}

.sailbox-login-card {
  width: min(100%, 360px);
  padding: 28px 22px 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 40px rgba(21, 58, 86, 0.22);
  text-align: center;
}

.sailbox-login-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #3d7fa8;
  letter-spacing: 0.04em;
}

.sailbox-login-title {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  color: #153a56;
}

.sailbox-login-lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: #2e5f7a;
}

.sailbox-login-busy {
  margin: 0 0 12px;
  font-size: 13px;
  color: #3d7fa8;
}

.sailbox-login-error {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #b42318;
}

.sailbox-login-btn {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 2px solid rgba(21, 58, 86, 0.15);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.12s ease;
}

.sailbox-login-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.sailbox-login-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.sailbox-login-btn-start {
  background: linear-gradient(180deg, #5eb8e8 0%, #3a94c9 100%);
  color: #fff;
  border-color: rgba(21, 58, 86, 0.2);
  box-shadow: 0 4px 14px rgba(21, 58, 86, 0.18);
}

.sailbox-login-note {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: #5a8fad;
}

.sailbox-auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.sailbox-auth-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #3d7fa8;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid rgba(94, 184, 232, 0.45);
  border-radius: 10px;
  cursor: pointer;
}

.sailbox-auth-tab.is-active {
  color: #fff;
  background: linear-gradient(180deg, #5eb8e8 0%, #3a94c9 100%);
  border-color: rgba(21, 58, 86, 0.2);
}

.sailbox-auth-field {
  display: block;
  margin-bottom: 10px;
}

.sailbox-auth-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #2d6f94;
}

.sailbox-auth-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 15px;
  border: 2px solid rgba(94, 184, 232, 0.55);
  border-radius: 10px;
  background: #fff;
}

.sailbox-auth-form {
  margin: 0;
}

.sailbox-account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 8px;
  padding: 0 4px;
  font-size: 11px;
}

.sailbox-account-label {
  color: #3d7fa8;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sailbox-account-logout {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #2d6f94;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(94, 184, 232, 0.5);
  border-radius: 8px;
  cursor: pointer;
}
