/* ============================================================
   COMPONENTS : shared building blocks. Screens compose these.
   ============================================================ */

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 800; font-size: 15px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, filter .2s ease;
  user-select: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); }

.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow-pop), var(--shadow-1);
}
.btn-danger {
  background: var(--danger); color: var(--accent-ink);
  box-shadow: var(--shadow-pop), var(--shadow-1);
}
.btn-warm { background: var(--warm); color: var(--accent-ink); box-shadow: var(--shadow-pop), var(--shadow-1); }
.btn-blue { background: var(--blue); color: var(--accent-ink); box-shadow: var(--shadow-pop), var(--shadow-1); }
.btn-ghost {
  background: var(--card); color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-1);
}
.btn-ghost:hover { background: var(--card-2); }
.btn-big { width: 100%; padding: 15px 20px; font-size: 16.5px; border-radius: var(--r-lg); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: var(--r-sm); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 17px;
  background: var(--card); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-1);
  transition: transform .15s ease, background .2s ease;
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn:active { transform: scale(.94); }

/* ---------- cards & panels ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 16px;
}

.card-hero { border-radius: var(--r-xl); padding: 20px; }

.kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800;
  background: var(--accent-soft); color: var(--accent);
}
.badge-warm { background: var(--warm-soft); color: var(--warm); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line-soft);
  font-weight: 800; font-size: 13.5px;
  box-shadow: var(--shadow-1);
}

/* ---------- segmented choices (durations, options) ---------- */

.seg { display: grid; grid-auto-flow: column; gap: 8px; }
.seg-option {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 10px 6px; border-radius: var(--r-md);
  background: var(--card); border: 1.5px solid var(--line-soft);
  font-weight: 800; transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.seg-option b { font-size: 17px; }
.seg-option small { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.seg-option:hover { transform: translateY(-1px); }
.seg-option.selected {
  border-color: var(--accent); background: var(--accent-soft);
}
.seg-option.selected b { color: var(--accent); }

/* ---------- transport list ---------- */

.transport-option {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 10px 12px; margin-top: 8px;
  border-radius: var(--r-md);
  background: var(--card); border: 1.5px solid var(--line-soft);
  font-weight: 800; font-size: 14.5px;
  transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.transport-option:hover { transform: translateX(2px); }
.transport-option .t-ico {
  width: 32px; height: 32px; border-radius: 9px; font-size: 16px;
  display: grid; place-items: center; background: var(--bg-2);
}
.transport-option .t-check { margin-left: auto; opacity: 0; color: var(--accent); font-size: 16px; transition: opacity .2s ease; }
.transport-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.transport-option.selected .t-check { opacity: 1; }

/* ---------- avatars ---------- */

.avatar {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 19px;
  border: 2px solid var(--card);
  box-shadow: var(--shadow-1);
  background: linear-gradient(135deg, var(--blue-soft), var(--warm-soft));
}
.avatar-sm { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-right: -8px; }

/* ---------- progress ---------- */

.progress {
  height: 9px; border-radius: 999px; background: var(--bg-2);
  overflow: hidden; position: relative;
}
.progress > i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width .4s ease;
}
.progress.warm > i { background: var(--warm); }
.progress.blue > i { background: var(--blue); }
.progress.gold > i { background: var(--gold); }

/* ---------- flag chip ----------
   Windows has no glyph for regional-indicator pairs, so 🇯🇵 renders as "JP".
   Screens draw flags with data.js `flagCss` instead:
   <span class="flag" style="--flag:${flagCss[d.flagKey]}"></span>          */

.flag {
  display: inline-block;
  width: 1.45em; height: 1em;
  border-radius: 3px;
  background: var(--flag, var(--line));
  box-shadow: inset 0 0 0 1px var(--line-hairline), 0 1px 2px var(--shadow-warm-1);
  vertical-align: -.12em;
  flex: none;
}
.flag-lg { width: 2.1em; height: 1.45em; border-radius: 4px; }

/* ---------- scene frame (the heart of every screen) ---------- */

.scene-frame {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-2);
  min-height: 320px;
  isolation: isolate;
}
.scene-frame .scene-art { position: absolute; inset: 0; z-index: -1; }
.scene-float {
  position: absolute;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: 10px 14px;
}

/* soft floating animation for cute scene props */
.floaty { animation: floaty 4.5s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.puff { animation: puff 2.6s ease-in-out infinite; opacity: .8; }
@keyframes puff {
  0% { transform: translateY(0) scale(1); opacity: .7; }
  60% { opacity: .35; }
  100% { transform: translateY(-14px) scale(1.25); opacity: 0; }
}

/* ---------- timer ---------- */

.timer-digits {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 1px;
}

/* ---------- ring (focus %) ---------- */

.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-track { stroke: var(--bg-2); }
.ring .ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring .ring-center { position: absolute; text-align: center; }

/* ---------- toast ---------- */

.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 11px 20px;
  font-weight: 800; font-size: 14px;
  box-shadow: var(--shadow-2);
  animation: toast-in .3s ease both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(.95); }
  to { opacity: 1; transform: none; }
}
.toast.leaving { animation: toast-out .3s ease both; }
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-12px) scale(.95); }
}

/* ---------- misc ---------- */

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.soft { color: var(--ink-soft); }
.divider { height: 1px; background: var(--line-soft); margin: 12px 0; }
