/* ════════════════════════════════════════════════════════════
   INKIN.CSS
   Format director for TramTracker — Ancient Gothenburg.
   Inkin owns all base styling: layout, card, nav, ticker,
   lock screen, tabs, tram stop cards.
   Device-specific overrides live in separate bucket files
   loaded by inkin.js after full paint.

   tramtracker.saraskonstigheter.com — SK Universe
   ════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'DynaPuff';
  src: url('../DynaPuff-VariableFont_wdth,wght.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #1A1510;
  --bg-rgb: 26, 21, 16;
  --text-dark: #FFFFFF;
  --text-mid: #E8E4DE;
  --text-soft: #B0A898;
  --accent: #D4A853;
  --font: 'DynaPuff', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #CDC0F1;
  font-family: var(--font);
  color: var(--text-dark);
  overflow-x: hidden;
}

/* ── MAIN APP ── */
#app {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 100px 16px 90px;
  box-sizing: border-box;
}

/* ── SPLASH SCREEN ── */
#splash-screen {
  position: fixed;
  inset: 0;
  top: 56px;
  background: #CDC0F1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: splashFade 2s ease forwards;
  animation-delay: 5s;
  animation-fill-mode: both;
}

.splash-inner {
  max-width: 480px;
  width: 100%;
  aspect-ratio: 9/19;
  background: url('splash.png') center center / contain no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 40px;
}

#splash-screen.hidden { display: none; }

@keyframes splashFade {
  from { opacity: 1; pointer-events: all; }
  to   { opacity: 0; pointer-events: none; }
}

.splash-byline { display: none; }
.splash-logo   { display: none; }

/* ── BOTTOM NAV ── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 150;
  background: #000000;
  display: none;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  padding: 0 8px;
}

#bottom-nav.visible { display: flex; }

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s;
  padding: 8px 0;
  border: none;
  background: none;
}

.nav-tab.active { color: #D4A853; }

/* ── TAB SCREENS ── */
.tab-screen {
  position: fixed;
  top: 58px;
  left: 0;
  right: 0;
  bottom: 72px;
  background: #FAF7F2;
  z-index: 140;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  align-items: center;
}

.tab-screen.active { display: flex; }

.tab-header {
  width: 100%;
  background: #D4C8F0;
  padding: 28px 20px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tab-title {
  font-family: var(--font);
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 700;
  color: #FFFEF8;
  text-shadow: 0 4px 24px rgba(100,80,160,0.3), 0 2px 0 rgba(100,80,160,0.15);
  animation: textFloat 5s ease-in-out infinite;
  text-align: center;
}

.tab-scallop {
  width: 100%;
  height: 24px;
  background:
    radial-gradient(circle at 10px 0, #D4C8F0 10px, transparent 11px),
    radial-gradient(circle at 30px 0, #D4C8F0 10px, transparent 11px);
  background-size: 40px 24px;
  background-color: #FAF7F2;
  background-repeat: repeat-x;
  background-position: top left;
}

.tab-content {
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.readme-card {
  width: 100%;
  background: white;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.readme-card-title {
  font-family: var(--font);
  font-size: 13px;
  color: #000000;
  margin-bottom: 6px;
}

.readme-card-text {
  font-family: var(--font);
  font-size: 11px;
  color: #666;
  line-height: 1.6;
}

.settings-row {
  width: 100%;
  background: white;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  font-family: var(--font);
  font-size: 12px;
  color: #3A2820;
}

/* ── LOCK SCREEN ── */
#lock-screen {
  position: fixed;
  inset: 0;
  background: #FAF7F2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  z-index: 100;
  transition: opacity 0.6s ease;
  overflow-y: auto;
  padding-top: 56px !important;
  padding-bottom: 80px !important;
}

/* ── TRAM SHOP ── */
.shop-window {
  width: 100%;
  background: #D4C8F0;
  padding: 24px 20px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.shop-window-title {
  font-family: var(--font);
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 700;
  color: #FFFEF8;
  text-shadow: 0 4px 24px rgba(100,80,160,0.3), 0 2px 0 rgba(100,80,160,0.15);
  text-align: center;
  animation: textFloat 5s ease-in-out infinite;
}

@keyframes textFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.shop-window-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  justify-content: center;
}

.shop-scroll::-webkit-scrollbar { display: none; }

.shop-arrow {
  background: none;
  border: none;
  font-size: 24px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 0 4px;
  font-family: var(--font);
}

.pack-card {
  flex: 0 0 calc(50% - 5px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  background: white;
  border-radius: 4px;
  padding: 18px 12px 14px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.pack-card.selected { border-color: #3A2820; }

.pack-card-img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8e0f8, #d4c8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.pack-card-name {
  font-size: 10px;
  color: #3A2820;
  text-align: center;
  font-family: var(--font);
}

.pack-card-price {
  background: #000000;
  color: white;
  font-family: var(--font);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: none;
  box-shadow: 0 3px 0 #333;
  transition: transform 0.1s, box-shadow 0.1s;
}

.pack-card-price:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #333;
}

.scallop-divider {
  width: 100%;
  height: 24px;
  background:
    radial-gradient(circle at 10px 0, #D4C8F0 10px, transparent 11px),
    radial-gradient(circle at 30px 0, #D4C8F0 10px, transparent 11px);
  background-size: 40px 24px;
  background-color: #FAF7F2;
  background-repeat: repeat-x;
  background-position: top left;
}

.lock-gate {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-gate img { width: 100%; height: 100%; object-fit: contain; }

.lock-title {
  font-family: var(--font);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 700;
  color: #1A1510;
  text-align: center;
}

.lock-subtitle {
  font-family: var(--font);
  font-size: 13px;
  color: #5A4A3A;
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}

.key-input-wrap {
  width: 100%;
  max-width: 280px;
}

#key-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #D4C8F0;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.1em;
  outline: none;
  background: white;
  color: #1A1510;
}

#key-input:focus { border-color: #D4A853; }

.error-msg {
  font-family: var(--font);
  font-size: 11px;
  color: #E8435A;
  min-height: 16px;
  text-align: center;
}

.unlock-btn {
  background: #1A1510;
  color: white;
  font-family: var(--font);
  font-size: 14px;
  padding: 12px 32px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 0 #0a0806;
  transition: transform 0.1s, box-shadow 0.1s;
}

.unlock-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #0a0806;
}

/* ── CARD ── */
.card {
  position: relative;
  width: min(390px, 94vw);
  min-height: 600px;
  border-radius: 28px;
  overflow: hidden;
  background: #1A1510;
  box-shadow:
    0 8px 40px rgba(0,0,0,0.28),
    0 2px 0 rgba(255,255,255,0.06) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  z-index: 0;
}

/* ── TOP BAR ── */
.top-bar {
  position: relative;
  z-index: 5;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 0;
}

.city {
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
}

.clock {
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.75);
}

/* ── TRAM STOP CARDS ── */
#tram-stops-container {
  position: relative;
  z-index: 5;
  width: 100%;
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tram-stop-card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.1);
}

.tram-stop-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tram-stop-name {
  font-family: var(--font);
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.04em;
}

.tram-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.tram-edit-btn:hover { opacity: 1; }

.tram-departures {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tram-dep {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.tram-line {
  min-width: 32px;
  text-align: center;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  /* Glow effect — each line's color comes from Västtrafik API inline style */
  box-shadow: 0 0 8px currentColor;
  filter: brightness(1.1);
}

.tram-dest {
  flex: 1;
  color: rgba(255,255,255,0.8);
  font-family: var(--font);
  font-size: 11px;
}

.tram-time {
  color: #D4A853;
  font-family: var(--font);
  font-size: 11px;
  white-space: nowrap;
}

.tram-empty, .tram-loading {
  font-family: var(--font);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
}

/* ── SEARCH PANEL ── */
#tram-search-panel {
  position: relative;
  z-index: 5;
  width: 100%;
  padding: 12px 16px;
}

#tram-search-panel.hidden { display: none; }

#tram-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 13px;
  margin-bottom: 8px;
  outline: none;
  background: rgba(255,255,255,0.1);
  color: white;
}

#tram-search-input::placeholder { color: rgba(255,255,255,0.35); }
#tram-search-input:focus { border-color: #D4A853; }

#tram-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.tram-result-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.tram-result-btn:hover { background: rgba(255,255,255,0.14); }

#tram-search-cancel {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  width: 100%;
  text-align: center;
}

/* ── ACTION BUTTONS ── */
.action-buttons {
  position: relative;
  z-index: 5;
  width: 100%;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.btn-install {
  width: 100%;
  max-width: 320px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  font-family: var(--font);
  font-size: 12px;
  padding: 12px 20px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.2s;
}

.btn-install:hover { background: rgba(255,255,255,0.16); }
.btn-install.hidden { display: none; }

/* ── TRUST STRIP (top nav) ── */
#tb-yellow {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 301;
  background: #000000;
  padding: 0 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.08em;
  height: 28px;
}

#tb-yellow a {
  color: #FFFFFF;
  text-decoration: none;
  text-transform: uppercase;
  transition: opacity 0.2s;
}

#tb-yellow a:hover { opacity: 0.6; }

/* ── TRUST FOOTER ── */
#tb-trust {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 299;
  background: #000000;
  padding: 8px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
  font-family: var(--font);
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.06em;
}

#tb-trust a { color: rgba(255,255,255,0.7); text-decoration: none; }
#tb-trust a:hover { color: white; }

/* ── TICKER ── */
.ticker-wrap {
  position: fixed;
  top: 28px;
  left: 0; right: 0;
  z-index: 299;
  background: #FAF7F2;
  overflow: hidden;
  border-bottom: 1.5px solid rgba(0,0,0,0.08);
  white-space: nowrap;
  height: 30px;
  display: flex;
  align-items: center;
}

.ticker-content {
  display: inline-block;
  animation: tickerScroll 28s linear infinite;
  font-family: var(--font);
  font-size: 11px;
  color: #000000;
  letter-spacing: 0.08em;
}

@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.shop-bee {
  position: absolute;
  font-size: 1rem;
  animation: tramRide 32s linear infinite;
  pointer-events: none;
  z-index: 10;
  right: -40px;
}

@keyframes tramRide {
  0%   { right: -40px; }
  100% { right: 110%; }
}

/* ── RESPONSIVE ── */
@media (min-width: 600px) {
  #app {
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
  }
  .card { border-radius: 32px; }
}