/* ============================================
   iPhone Dashboard – Light Glassmorphism Theme
   iOS-inspired clean design by Deni
   ============================================ */

:root {
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --border: rgba(255, 255, 255, 0.85);
  --border-soft: rgba(0, 0, 0, 0.07);
  --text: #111827;
  --text-dim: rgba(17, 24, 39, 0.55);
  --text-faint: rgba(17, 24, 39, 0.36);
  --accent: #007AFF;
  --accent-2: #5856d6;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius: 22px;
  --radius-sm: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  background: #e8edf8;
}

/* ---------- Hintergrund ---------- */

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(145deg, #dce8f8 0%, #ede8f8 40%, #deeef8 80%, #e8f0fb 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.7;
  animation: drift 24s ease-in-out infinite alternate;
}

.blob-1 {
  width: 60vh; height: 60vh;
  top: -20vh; left: -20vw;
  background: radial-gradient(circle, rgba(99, 163, 255, 0.4) 0%, transparent 70%);
}

.blob-2 {
  width: 55vh; height: 55vh;
  top: 30vh; right: -25vw;
  background: radial-gradient(circle, rgba(168, 130, 255, 0.3) 0%, transparent 70%);
  animation-delay: -8s;
}

.blob-3 {
  width: 50vh; height: 50vh;
  bottom: -15vh; left: 5vw;
  background: radial-gradient(circle, rgba(60, 190, 255, 0.3) 0%, transparent 70%);
  animation-delay: -16s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(6vw, 4vh) scale(1.15); }
}

/* ---------- Layout ---------- */

.dashboard {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 360px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 0;
}

.greeting {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.header-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.refresh-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease, color 0.25s ease, background 0.2s ease;
}

.refresh-btn:active {
  transform: scale(0.88) rotate(180deg);
  color: var(--accent);
  background: rgba(255,255,255,0.95);
}

.refresh-btn.spinning svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Karten ---------- */

.card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  opacity: 0;
  transform: translateY(16px);
  animation: cardIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.card-icon {
  font-size: 1rem;
}

.card-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.1);
  border: 1px solid rgba(0, 122, 255, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: none;
  white-space: nowrap;
}

.card-badge:empty { display: none; }

/* ---------- Uhr ---------- */

.card-clock {
  text-align: center;
  padding: 26px 18px 22px;
}

.clock {
  font-size: clamp(3.4rem, 18vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: linear-gradient(135deg, #111827 20%, #007AFF 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.clock-sec {
  font-size: 0.45em;
  font-weight: 600;
  opacity: 0.7;
}

.clock-date {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ---------- Wetter ---------- */

.weather-now {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.weather-temp {
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.weather-cond {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.weather-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.weather-meta b { color: var(--text); font-weight: 600; }

.weather-loc {
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- System ---------- */

.sys-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.85rem;
}

.sys-row:last-child { border-bottom: none; }

.sys-label { color: var(--text-dim); }
.sys-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.sys-value.ok { color: var(--green); }
.sys-value.warn { color: var(--orange); }
.sys-value.bad { color: var(--red); }

.battery-bar {
  width: 44px; height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 7px;
}

.battery-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--green);
  transition: width 0.6s ease;
}

/* ---------- Fussball ---------- */

.match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.match:last-child { border-bottom: none; }

.match-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.match-team.away { flex-direction: row-reverse; text-align: right; }

.match-team img {
  width: 24px; height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.match-team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-center {
  text-align: center;
  min-width: 66px;
}

.match-score {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.match-status {
  font-size: 0.66rem;
  color: var(--text-faint);
  margin-top: 2px;
  white-space: nowrap;
}

.match.live .match-status {
  color: var(--red);
  font-weight: 700;
}

.match.live .match-score { color: var(--text); }

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 4px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.match-league-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 4px 2px;
}

/* ---------- News ---------- */

.news-item {
  display: block;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.news-item:last-child { border-bottom: none; }
.news-item:active { opacity: 0.5; }

.news-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 0.72rem;
  color: var(--text-faint);
}

.news-source {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Videos ---------- */

.video-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  /* Kein sichtbarer Scrollbalken */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.video-scroll::-webkit-scrollbar {
  display: none;
}

.video-card {
  flex-shrink: 0;
  width: 200px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-card:active {
  transform: scale(0.96);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.video-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0,0,0,0.06);
  overflow: hidden;
}

.video-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.22);
  transition: background 0.2s ease;
}

.video-card:active .video-play-btn {
  background: rgba(0,0,0,0.35);
}

.video-play-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.video-play-icon svg {
  width: 16px; height: 16px;
  fill: var(--text);
  margin-left: 2px;
}

.video-info {
  padding: 9px 10px 11px;
}

.video-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  font-size: 0.68rem;
  color: var(--text-faint);
}

.video-source {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Video Modal ---------- */

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-modal.open {
  opacity: 1;
  pointer-events: all;
}

.video-modal-inner {
  width: 100%;
  max-width: 480px;
  background: #111;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(30px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.video-modal.open .video-modal-inner {
  transform: translateY(0) scale(1);
}

.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
}

.video-modal-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px;
}

.video-modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.2s ease;
}

.video-modal-close:active { background: rgba(255,255,255,0.3); }

.video-modal-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
  background: #000;
}

/* ---------- Schnellzugriffe ---------- */

.shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 380px) {
  .shortcuts { grid-template-columns: repeat(3, 1fr); }
}

.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 13px 4px 11px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.06);
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, background 0.2s ease;
}

.shortcut:active {
  transform: scale(0.92);
  background: rgba(255,255,255,0.85);
}

.shortcut-icon { font-size: 1.5rem; line-height: 1; }

.shortcut-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ---------- Skeleton Loading ---------- */

.skeleton {
  border-radius: 10px;
  background: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0.05) 40%,
    rgba(0, 0, 0, 0.10) 50%,
    rgba(0, 0, 0, 0.05) 60%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  height: 16px;
  margin: 10px 0;
}

.skeleton.big { height: 40px; }
.skeleton.w60 { width: 60%; }
.skeleton.w80 { width: 80%; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- Fehlerzustand ---------- */

.error-box {
  text-align: center;
  padding: 16px 8px;
  color: var(--text-dim);
  font-size: 0.83rem;
}

.error-box .error-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 8px;
}

.retry-btn {
  margin-top: 12px;
  padding: 8px 22px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.7);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.retry-btn:active { transform: scale(0.93); }

.empty-hint {
  text-align: center;
  padding: 14px 8px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-faint);
  padding-top: 6px;
}

/* ---------- Reduzierte Bewegung ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
  .card { opacity: 1; transform: none; }
}
