:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --panel-bg: #ffffff;
  --text: #1c1e21;
  --muted: #6b7280;
  --accent: #d52b1e; /* Swiss red */
  --border: #e2e4e8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel-bg: #1e2126;
    --text: #f0f1f3;
    --muted: #9aa0a8;
    --border: #2c2f36;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  position: relative;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #b9793f;
  background-image:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.12) 0, rgba(0,0,0,0.12) 2px, transparent 2px, transparent 160px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.12' numOctaves='4' seed='7' result='n'/%3E%3CfeColorMatrix in='n' type='matrix' values='0 0 0 0 0.55  0 0 0 0 0.35  0 0 0 0 0.16  0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");
  background-size: auto, 280px 280px;
  background-blend-mode: multiply, normal;
  background-attachment: fixed, fixed;
}

@media (prefers-color-scheme: dark) {
  body::before { filter: brightness(0.5) contrast(1.1); }
}

.dashboard {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px 20px;
}

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

.link-btn.hotel-link {
  background: #003580;
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
  padding: 12px 16px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  text-align: center;
  width: 100%;
}

.dashboard__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.install-guide {
  flex: 1;
  min-width: 0;
}

.install-guide h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--text);
}

.install-guide dl {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.install-guide dt {
  font-weight: 700;
  color: var(--text);
  display: inline;
}

.install-guide dd {
  margin: 0 0 4px;
  display: inline;
}

.install-guide dd::after {
  content: "";
  display: block;
}

.qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qr-code {
  display: block;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
  border: 1px solid var(--border);
}

.qr-caption {
  margin: 0;
  max-width: 110px;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
}

.dashboard__header h1 {
  margin: 0;
  font-size: 1.4rem;
  color: #3b2312;
  text-shadow: 0 1px 0 rgba(255, 224, 178, 0.4), 0 2px 5px rgba(0, 0, 0, 0.45);
}

.subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: #4a2c17;
  text-shadow: 0 1px 0 rgba(255, 224, 178, 0.35), 0 1px 4px rgba(0, 0, 0, 0.4);
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.tz {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: normal;
}

.digital-time {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  text-align: center;
}

.digital-date-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 1px;
}

.status-light {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.status-light.status-green { background: #2ea043; }
.status-light.status-yellow { background: #d4a72c; }
.status-light.status-red { background: var(--accent); }

.digital-date {
  color: var(--muted);
  font-size: 0.88rem;
}

.digital-date.is-holiday {
  color: var(--accent);
  font-weight: 700;
}

.holiday-label {
  text-align: center;
  color: var(--accent);
  font-size: 0.78rem;
  margin-top: 1px;
}

.sun-times {
  text-align: center;
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

.clock-combo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.clock-combo__digital {
  text-align: center;
}

.sbb-clock-wrap {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

.sbb-clock {
  width: 96px;
  height: 96px;
}

.sbb-face {
  fill: #ffffff;
  stroke: #1c1e21;
  stroke-width: 2;
}

.sbb-tick-major {
  stroke: #1c1e21;
  stroke-width: 3;
}

.sbb-tick-minor {
  stroke: #1c1e21;
  stroke-width: 1.2;
}

.sbb-hand {
  stroke-linecap: round;
}

.sbb-hand--hour {
  stroke: #1c1e21;
  stroke-width: 7;
}

.sbb-hand--minute {
  stroke: #1c1e21;
  stroke-width: 5;
}

.sbb-hand--second {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.sbb-second-dot {
  fill: var(--accent);
}

.sbb-hub {
  fill: #1c1e21;
}

.sbb-note, .fx-note {
  font-size: 0.66rem;
  color: var(--muted);
  text-align: center;
  margin: 4px 0 0;
  line-height: 1.3;
}

.fx-headline-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 44px;
  padding: 0 0 2px;
}

@media (max-width: 400px) {
  .fx-headline-row {
    gap: 10px;
  }
}

.fx-headline {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fx-oanda-link {
  flex-shrink: 0;
  margin-bottom: 0;
}

.fx-calc {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 2px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 1px;
}

.link-btn:hover {
  opacity: 0.9;
}

.panel h2 .link-btn {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 4px 9px;
}

.fx-calc__field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fx-calc__field label {
  font-size: 0.7rem;
  color: var(--muted);
}

.fx-calc__input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--bg);
}

.fx-calc__input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.fx-calc__input-wrap input::-webkit-outer-spin-button,
.fx-calc__input-wrap input::-webkit-inner-spin-button {
  margin: 0;
}

.fx-calc__unit {
  color: var(--muted);
  font-size: 0.78rem;
  margin-left: 6px;
  white-space: nowrap;
}

.fx-calc__eq {
  padding-bottom: 9px;
  color: var(--muted);
  font-weight: 700;
}

.fx-updated {
  text-align: right;
  color: var(--muted);
  font-size: 0.7rem;
  margin: 4px 0 0;
}

.weather-current {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 2px 0 6px;
}

.weather-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.weather-current-info {
  text-align: left;
}

.weather-temp {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.weather-pressure, .weather-extra {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.weather-desc {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 1px;
}

.weather-moon {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.moon-emoji {
  font-size: 1.6rem;
  vertical-align: middle;
  line-height: 1;
}

.weather-forecast {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.forecast-day {
  text-align: center;
  min-width: 54px;
}

.forecast-day .fd-label {
  font-size: 0.68rem;
  color: var(--muted);
}

.forecast-day .fd-icon {
  font-size: 1.2rem;
  margin: 1px 0;
}

.forecast-day .fd-temps {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.forecast-day .fd-temps .max {
  font-weight: 700;
}

.forecast-day .fd-temps .min {
  color: var(--muted);
}

.webcam-frame {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.webcam-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.webcam-linkcard {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.webcam-linkcard:hover {
  border-color: var(--accent);
}

.webcam-linkcard__icon {
  font-size: 1.6rem;
  line-height: 1;
}

.webcam-linkcard__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
}

.webcam-linkcard__text span:last-child {
  color: var(--muted);
  font-size: 0.74rem;
}

.bus-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bus-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.bus-item:last-child {
  border-bottom: none;
}

.bus-item--loading {
  color: var(--muted);
  justify-content: center;
}

.bus-line {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 44px;
  text-align: center;
}

.bus-dest {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bus-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  min-width: 88px;
}

.bus-countdown {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 84px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bus-delay {
  color: var(--accent);
  font-size: 0.78rem;
  margin-left: 4px;
}

@media (max-width: 480px) {
  .bus-dest { white-space: normal; }
}
