/* 通勤路線投票卡片（.cc-*）；手機是底部彈出，桌機（≥720px）是置中卡片 */

.cc-wrap {
  position: fixed;
  z-index: 7; /* 高於底部抽屜（z-index 2）與 toast；「抵達！」動畫（z-index 5）播完後才出現 */
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-b));
  display: flex;
  justify-content: center;
  pointer-events: none; /* 卡片外的地圖照常可以點 */
}
/* 卡片是直排彈性盒：標題與底部按鈕固定，只有中間的段清單捲動，手機上按鈕不用捲動就看得到 */
.cc-box {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 62vh;
  overflow: hidden;
  padding: 18px 18px 16px;
  border: 3px solid var(--btn-line);
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 8px 0 var(--btn-line), 0 16px 40px rgba(16, 42, 67, 0.3);
  animation: cc-in 0.3s ease both;
}
.cc-title { flex: none; font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--sea); line-height: 1.35; }
.cc-title b { font-size: 28px; color: #c2410c; }
.cc-sub { flex: none; margin: 6px 0 0; font-size: 14px; color: var(--muted); line-height: 1.5; }

.cc-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; list-style: none; margin: 10px 0 0; padding: 0; }

/* 一段一列：標題區（點了移到該段）＋ +1 按鈕；下面是「看路口」收合列 */
.cc-seg { padding: 6px 0; border-top: 1px solid #e2e8f0; }
.cc-seg.is-sel { box-shadow: inset 4px 0 0 var(--btn-blue-top); padding-left: 8px; }
.cc-seg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cc-seg-name {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 44px;
  padding: 4px;
  border: none;
  background: none;
  box-shadow: none;
  text-shadow: none;
  font: inherit;
  text-align: left;
  color: var(--ink);
}
button.cc-seg-name:active:not(:disabled) { transform: none; box-shadow: none; }
.cc-seg-title { font-size: 16px; font-weight: 700; color: var(--sea); line-height: 1.3; overflow-wrap: anywhere; }
.cc-seg-toggle {
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: none;
  box-shadow: none;
  text-shadow: none;
  font-size: 14px;
  color: var(--sea);
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.cc-seg-toggle:active:not(:disabled) { transform: none; box-shadow: none; }
.cc-cells { list-style: none; margin: 2px 0 0; padding: 0 0 0 10px; border-left: 3px solid #e2e8f0; }

.cc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 6px 0;
  border-top: 1px solid #e2e8f0;
}
.cc-info { display: flex; flex: 1 1 auto; flex-direction: column; align-items: flex-start; min-width: 0; }
.cc-name {
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: none;
  box-shadow: none;
  text-shadow: none;
  font: inherit;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--sea);
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.cc-name:active:not(:disabled) { transform: none; box-shadow: none; }
.cc-meta { font-size: 14px; color: var(--muted); padding-left: 4px; }

.cc-bind {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 112px;
  padding: 6px 12px;
  border-radius: 14px;
}
.cc-bind-text { font-size: 18px; }
.cc-bind-cost { font-family: system-ui, "PingFang TC", "Noto Sans TC", sans-serif; font-size: 12px; font-weight: 700; text-shadow: none; }

.cc-more {
  flex: none;
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  font-size: 16px;
  color: var(--sea);
}

.cc-credits { flex: none; margin-top: 10px; font-family: var(--font-display); font-size: 18px; color: var(--sea); font-variant-numeric: tabular-nums; }
.cc-locked {
  flex: none;
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.cc-actions { flex: none; display: flex; gap: 10px; margin-top: 14px; }
.cc-actions button {
  flex: 1;
  min-height: 52px;
  border-radius: 14px;
  font-size: 18px;
}

@keyframes cc-in { from { transform: translateY(24px); opacity: 0; } }

@media (min-width: 720px) {
  .cc-wrap {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    align-items: center;
  }
  .cc-box { width: 380px; max-height: 70vh; }
}
@media (prefers-reduced-motion: reduce) {
  .cc-box { animation: none; }
}

/* 遮罩：只有手機有（桌機的卡片不擋地圖） */
.cc-backdrop { display: none; }

/* 手機：底部 sheet。把手在頂端、遮罩點一下關閉、最高 80vh，清單捲動，按鈕在底部 */
@media (max-width: 719px) {
  .cc-wrap { left: 0; right: 0; top: 0; bottom: 0; align-items: flex-end; }
  .cc-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(15, 39, 71, 0.45);
    pointer-events: auto;
  }
  .cc-box {
    position: relative;
    width: 100%;
    max-height: 80vh;
    padding: 22px max(16px, env(safe-area-inset-right, 0px)) calc(16px + var(--safe-b)) max(16px, env(safe-area-inset-left, 0px));
    border-bottom: none;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -4px 0 var(--btn-line), 0 -8px 30px rgba(16, 42, 67, 0.2);
    animation: cc-in 0.3s ease backwards;
  }
  .cc-name { display: block; width: 100%; text-align: left; }
}
