:root {
  color-scheme: dark;
  --bg: #05070a;
  --bg-2: #0a0d12;
  --panel: rgba(12, 15, 19, 0.97);
  --panel-2: rgba(8, 10, 13, 0.98);
  --text: #f5f7fa;
  --muted: #a6b0bb;
  --green: #42d59b;
  --amber: #e8ba5a;
  --red: #e07575;
  --cyan: #7bcce0;
  --violet: #8f92ff;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 28px 110px rgba(0, 0, 0, 0.68);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 10%, rgba(77, 220, 255, 0.14), transparent 22%),
    radial-gradient(circle at 85% 20%, rgba(139, 92, 246, 0.12), transparent 18%),
    radial-gradient(circle at 50% 105%, rgba(34, 197, 94, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft JhengHei UI", "Noto Sans TC", system-ui, sans-serif;
}

body {
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.03), transparent 18%),
    radial-gradient(circle at 84% 10%, rgba(255, 255, 255, 0.025), transparent 14%),
    radial-gradient(circle at 50% 102%, rgba(255, 255, 255, 0.02), transparent 20%),
    linear-gradient(180deg, #05070a 0%, #080c11 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.014), transparent 20%, transparent 80%, rgba(255, 255, 255, 0.01));
  opacity: 0.10;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 35%, rgba(0, 0, 0, 0.18) 100%);
  pointer-events: none;
}

.app-shell {
  position: relative;
  width: min(740px, 100%);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.024), transparent 22%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.018), transparent 18%),
    linear-gradient(180deg, rgba(12, 16, 22, 0.98), rgba(6, 8, 12, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(104%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 14px rgba(0, 0, 0, 0.24),
    var(--shadow);
  padding: 20px;
  overflow: hidden;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.012) 50%, transparent 100%);
  opacity: 0.08;
  pointer-events: none;
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: calc(var(--radius) - 6px);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.015) inset;
}

.app-shell .hero::before,
.app-shell .hero::after,
.card::before,
.card::after {
  content: "";
}

.app-shell > * {
  position: relative;
  z-index: 1;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.eyebrow {
  margin: 0 0 6px;
  color: rgba(186, 194, 201, 0.78);
  letter-spacing: 0.20em;
  text-transform: uppercase;
  font-size: 8px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 6.3vw, 62px);
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.20);
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d9e0e6;
  text-align: right;
  font-size: 12px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(138, 203, 214, 0.06);
}

.updated {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cards {
  display: grid;
  gap: 12px;
}

.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(13, 17, 22, 0.98), rgba(8, 10, 13, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 18px 18px 17px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 14px 28px rgba(0, 0, 0, 0.28);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0 47%, rgba(255, 255, 255, 0.014) 50%, transparent 53%);
  transform: translateX(-120%);
  animation: sweep 14s linear infinite;
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.card-head::before,
.card-head::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 10px;
  height: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.card-head {
  position: relative;
}

.card-head::before {
  left: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.card-head::after {
  right: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.window-name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.window-meta {
  margin: 6px 0 0;
  color: #a3acb5;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.percent {
  font-size: clamp(42px, 8vw, 70px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.05em;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.18);
}

.battery {
  position: relative;
  width: 100%;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), transparent),
    #06090d;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.battery::after {
  content: "";
  position: absolute;
  right: -12px;
  top: 14px;
  width: 10px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.10);
}

.battery-fill {
  width: 0%;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(90deg, #58dbc7, #4dd4a3);
  border-radius: 12px;
  box-shadow: none;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: #9ca6af;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.updated-at:empty {
  display: none;
}

.label {
  color: #b0c7cf;
  font-weight: 700;
}

.hint {
  margin: 16px 0 0;
  color: #8f98a2;
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.08em;
}

.source {
  color: #b3bcc4;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card[data-level="amber"] .battery,
.card[data-level="amber"] .battery::after {
  border-color: var(--amber);
  background: #111111;
}

.card[data-level="amber"] .battery-fill {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.10), transparent 28%),
    linear-gradient(90deg, #fbe07a, #f0b34a);
}

.card[data-level="red"] .battery,
.card[data-level="red"] .battery::after {
  border-color: var(--red);
  background: #111111;
}

.card[data-level="red"] .battery-fill {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.10), transparent 28%),
    linear-gradient(90deg, #ff9a9a, #e46363);
}

@keyframes sweep {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@media (max-width: 560px) {
  body {
    padding: 12px;
  }

  .app-shell {
    padding: 14px;
    border-radius: 0;
  }

  .hero {
    flex-direction: column;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  body {
    padding: 8px;
    place-items: stretch center;
  }

  .app-shell {
    width: min(100%, 1180px);
    padding: 12px 12px 10px;
    border-radius: 16px;
  }

  .hero {
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  h1 {
    font-size: clamp(28px, 4vw, 38px);
  }

  .eyebrow {
    font-size: 8px;
    margin-bottom: 0;
  }

  .status {
    font-size: 10px;
    gap: 6px;
  }

  .dot {
    width: 10px;
    height: 10px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .cards[data-count="0"],
  .cards[data-count="1"] {
    grid-template-columns: 1fr;
  }

  .cards[data-count="1"] .card,
  .cards[data-count="0"] .card {
    grid-column: 1 / -1;
  }

  .card {
    padding: 14px 14px 12px;
    border-radius: 14px;
  }

  .card-head {
    margin-bottom: 8px;
  }

  .window-name {
    font-size: 14px;
  }

  .window-meta {
    font-size: 10px;
  }

  .percent {
    font-size: clamp(30px, 5vw, 46px);
  }

  .battery {
    height: 38px;
    border-radius: 12px;
  }

  .footer {
    margin-top: 8px;
    font-size: 9px;
  }

  .hint {
    display: none;
  }
}

@media (orientation: landscape) and (pointer: coarse), (orientation: landscape) and (max-width: 1100px) {
  body {
    padding: 6px;
    place-items: stretch;
  }

  .app-shell {
    width: calc(100vw - 12px);
    max-width: none;
    height: calc(100dvh - 12px);
    padding: 10px 10px 8px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .hero {
    flex: 0 0 auto;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  h1 {
    font-size: clamp(22px, 3.3vw, 34px);
  }

  .eyebrow {
    font-size: 7px;
    margin-bottom: 0;
  }

  .status {
    font-size: 9px;
    gap: 6px;
  }

  .cards {
    flex: 1 1 auto;
    grid-template-columns: 1fr !important;
    gap: 6px;
    align-content: start;
    min-height: 0;
    overflow: hidden;
  }

  .card {
    padding: 10px 10px 8px;
    border-radius: 12px;
  }

  .card-head {
    margin-bottom: 6px;
  }

  .window-name {
    font-size: 12px;
  }

  .window-meta {
    font-size: 9px;
    margin-top: 4px;
  }

  .percent {
    font-size: clamp(24px, 4vw, 36px);
  }

  .battery {
    height: 30px;
    border-radius: 10px;
  }

  .footer {
    margin-top: 6px;
    font-size: 8px;
  }

  .hint {
    display: none;
  }
}

html.mobile-landscape body {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

html.mobile-landscape .app-shell {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  padding: 10px 12px 12px;
  border-radius: 0;
  overflow: hidden;
  margin: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

html.mobile-landscape .hero {
  margin-bottom: 6px;
  padding-bottom: 6px;
}

html.mobile-landscape h1 {
  font-size: clamp(24px, 3.5vw, 36px);
}

html.mobile-landscape .eyebrow {
  font-size: 7px;
  margin-bottom: 0;
}

html.mobile-landscape .status {
  font-size: 9px;
  gap: 6px;
}

html.mobile-landscape .cards {
  flex: 1 1 auto;
  grid-template-columns: 1fr !important;
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  align-content: stretch;
  overflow: hidden;
  margin-bottom: 0;
}

html.mobile-landscape .card {
  padding: 12px 12px 10px;
  border-radius: 10px;
  min-height: 0;
  height: 100%;
}

html.mobile-landscape .card-head {
  margin-bottom: 8px;
}

html.mobile-landscape .window-name {
  font-size: 14px;
}

html.mobile-landscape .window-meta {
  font-size: 10px;
  margin-top: 5px;
}

html.mobile-landscape .percent {
  font-size: clamp(28px, 4.5vw, 40px);
}

html.mobile-landscape .battery {
  height: 40px;
  border-radius: 8px;
}

html.mobile-landscape .footer {
  margin-top: 8px;
  font-size: 8px;
}

html.mobile-landscape .hint {
  display: none;
}
