/* ========== 基础重置 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 底：近黑深蓝灰 */
  --bg:        #0b0f14;
  --bg-elev:   #121a23;
  --bg-elev-2: #1a2430;
  --line:      #2a3644;
  --text:      #e8eef4;
  --text-dim:  #8b9aab;
  --text-faint:#5c6b7c;

  --accent:    #f5c518;   /* 机票黄：航班号、时间 */
  --accent-2:  #35d0ba;   /* 青绿：进度、勾选完成 */
  --pending:   #c9a227;   /* 待确认（暗琥珀，不用红） */
  --danger:    #ff6b6b;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", sans-serif;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(0, 0, 0, .45);
  --stub-w: 116px;
}

body {
  background: radial-gradient(1200px 500px at 50% -10%, #16202c 0%, var(--bg) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

/* ========== 容器 ========== */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}

/* ========== Header ========== */
#trip-head {
  text-align: center;
  padding: 18px 0 8px;
  margin-bottom: 22px;
}
.trip-route {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: 6px;
}
.trip-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .04em;
}
.trip-dates {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}
.trip-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.trip-countdown.is-soon {
  border-color: var(--accent);
  color: var(--accent);
}
.trip-countdown.is-live {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.trip-countdown .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ========== 时间轴 ========== */
#timeline {
  position: relative;
  padding-left: 52px;
}
#timeline::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 10px;
  bottom: 10px;
  border-left: 2px dashed var(--line);
}

.stage {
  position: relative;
  margin-bottom: 28px;
}
.stage:last-child { margin-bottom: 8px; }

.stage-node {
  position: absolute;
  left: -52px;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elev-2);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  z-index: 1;
}
.stage.is-current .stage-node {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px rgba(245, 197, 24, .12);
}

.stage-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-top: 4px;
}
.stage-label {
  font-size: 16px;
  font-weight: 600;
}
.stage-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
}

.stage-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ========== 通用卡片 ========== */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: 14px;
  text-transform: none;
}

/* FIDS 小标签 */
.fids {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}

/* ========== 待确认 pill ========== */
.pill-pending {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px dashed var(--pending);
  color: var(--pending);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  padding: 1px 8px;
  white-space: nowrap;
}
.pill-pending .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .pill-pending .dot { animation: none; }
}

/* ========== 待确认卡 ========== */
.pending-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pending-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.pending-list .p-label {
  font-size: 14px;
}
.pending-list .p-hint {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}
.pending-empty {
  font-size: 13px;
  color: var(--text-faint);
  padding: 6px 0;
}

/* ========== 登机牌 ========== */
.ticket {
  display: grid;
  grid-template-columns: 1fr var(--stub-w);
  background: linear-gradient(135deg, var(--bg-elev), var(--bg-elev-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
/* 撕票缺口：对齐主票与存根接缝的上下两端 */
.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  z-index: 2;
  left: calc(100% - var(--stub-w) - 8px - 1px);
}
.ticket::before { top: -8px; }
.ticket::after  { bottom: -8px; }

.ticket-main {
  padding: 16px 16px 14px;
  min-width: 0;
}
.ticket-stub {
  border-left: 2px dashed var(--line);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  min-width: 0;
}

.ticket-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ticket-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: .06em;
}
.ticket-flight {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .04em;
}
.ticket-airline {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 6px;
}

/* 航段三列 */
.seg {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
}
.seg-end.is-arr { text-align: right; }
.seg-code {
  font-family: var(--mono);
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.1;
}
.seg-name {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.3;
}
.seg-meta {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.seg-end.is-arr .seg-meta { justify-content: flex-end; }
.seg-time {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 2px;
}
.seg-term {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

/* 中间航路 */
.seg-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
  min-width: 54px;
}
.seg-path .line {
  width: 48px;
  border-top: 2px dashed var(--line);
  position: relative;
}
.seg-path .plane {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: -10px;
  background: var(--bg-elev);
  padding: 0 4px;
}
.seg-path .dur {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* 票面底部 tips */
.ticket-tips {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ticket-tips li {
  font-size: 12px;
  color: var(--text-dim);
  padding-left: 12px;
  position: relative;
}
.ticket-tips li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-faint);
}

/* 存根字段 */
.stub-field { width: 100%; }
.stub-field .val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.stub-field .val.accent { color: var(--accent); }
.stub-field .val.big {
  font-size: 16px;
  line-height: 1.25;
}

/* 船票存根主角：登船口 */
.ticket--ferry .ticket-stub .gate {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
  letter-spacing: .02em;
}

/* ========== 落地条 ========== */
.arrival-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 15px;
  color: var(--accent-2);
  letter-spacing: .04em;
}
.arrival-strip .tag {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* ========== 当日安排 ========== */
.day-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.day-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  min-height: 44px;
}
.day-item:first-child { border-top: 0; padding-top: 2px; }
.day-time {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  padding-top: 2px;
}
.day-body .t {
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.day-body .p {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.day-body .n {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ========== 目的地清单 ========== */
.place-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.place-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-top: 1px solid var(--line);
  min-height: 44px;
}
.place-item:first-child { border-top: 0; }
.place-item.is-optional { opacity: .55; }
.place-main { flex: 1; min-width: 0; }
.place-name {
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.place-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.place-note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}
.tag-pill {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.tag-pill.must {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== 物品清单 ========== */
.pack-progress {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.pack-progress .txt {
  font-size: 13px;
  color: var(--text-dim);
}
.pack-progress .txt.is-done {
  color: var(--accent-2);
}
.pack-progress .txt .mono { color: var(--text); font-weight: 600; }
.pack-progress .must-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.pack-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 16px;
}
.pack-bar .fill {
  height: 100%;
  width: 0;
  background: var(--accent-2);
  border-radius: 2px;
  transition: width .25s ease;
}
@media (prefers-reduced-motion: reduce) {
  .pack-bar .fill { transition: none; }
}

.pack-group { margin-bottom: 14px; }
.pack-group:last-child { margin-bottom: 0; }
.pack-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.pack-group-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .04em;
}
.pack-group-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.pack-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 4px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
}
.pack-item:active { background: var(--bg-elev-2); }
.pack-item input { position: absolute; opacity: 0; pointer-events: none; }
.pack-item input:focus-visible + .pack-box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pack-box {
  flex: 0 0 18px;
  width: 18px; height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.pack-box::after {
  content: "";
  width: 10px; height: 5px;
  border-left: 2px solid var(--bg);
  border-bottom: 2px solid var(--bg);
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.pack-item.is-checked .pack-box {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.pack-item.is-checked .pack-box::after { opacity: 1; }

.pack-body { flex: 1; min-width: 0; }
.pack-name {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pack-note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 1px;
}
.pack-item.is-checked .pack-name {
  text-decoration: line-through;
  color: var(--text-faint);
}
.pack-item.is-checked .pack-note { opacity: .5; }

.badge-must {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  line-height: 1.5;
}

.btn-ghost {
  font-family: var(--sans);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  cursor: pointer;
  line-height: 1.5;
}
.btn-ghost:active { background: rgba(255, 107, 107, .1); }

/* ========== 回程提醒 ========== */
.tip-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tip-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
  padding: 6px 0;
}
.tip-list li::before {
  content: "";
  flex: 0 0 6px;
  width: 6px; height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ========== Footer ========== */
footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}
footer code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ========== 响应式：手机（≤560px）========== */
@media (max-width: 560px) {
  .ticket {
    grid-template-columns: 1fr;
  }
  /* 桌面版那对竖排缺口关掉，改用 stub 上的横排缺口 */
  .ticket::before,
  .ticket::after { display: none; }

  .ticket-stub {
    position: relative;
    border-left: 0;
    border-top: 2px dashed var(--line);
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 8px;
    padding: 14px 12px;
    text-align: center;
  }
  /* 撕票缺口骑在水平接缝的左右两端 */
  .ticket-stub::before,
  .ticket-stub::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--line);
    z-index: 2;
    top: -9px;
  }
  .ticket-stub::before { left: -9px; }
  .ticket-stub::after  { right: -9px; }

  .ticket--ferry .ticket-stub .gate { font-size: 15px; }

  .day-item {
    grid-template-columns: 72px 1fr;
    gap: 8px;
  }
  .seg-path { min-width: 40px; }
  .seg-path .line { width: 32px; }
}
