:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-raised: #131c2e;
  --line: #243049;
  --text: #e8eefc;
  --muted: #94a3b8;
  --accent: #2dd4bf;
  --accent-ink: #042f2e;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  overscroll-behavior-x: none;
  touch-action: pan-y pinch-zoom;
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.16), transparent 28rem),
    var(--bg);
  color: var(--text);
}

img,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

:where(p, h1, h2, h3, li, span, strong, article, label, footer, time) {
  overflow-wrap: anywhere;
  word-break: keep-all;
}

code {
  color: #dbeafe;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  background: #1e293b;
  color: var(--muted);
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.wrap {
  width: min(46rem, calc(100% - 1.5rem));
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
}

.hero {
  padding: 1.25rem 0 0.5rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: Palatino, "Palatino Linotype", serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

h1 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(2rem, 7vw, 4.2rem);
  line-height: 1.1;
}

h2 {
  margin: 0 0 0.85rem;
  font-size: 1.45rem;
}

.lede {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hint,
.panel-head p,
.guide p,
footer {
  max-width: 100%;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.1rem;
  max-width: 100%;
}

.actions button {
  max-width: 100%;
}

.hint {
  min-height: 1.2rem;
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.card,
.panel {
  background: rgba(19, 28, 46, 0.92);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  box-shadow: var(--shadow);
}

.card {
  min-width: 0;
  padding: 0.95rem 1rem;
}

.card span,
.panel-head p,
.note time,
.empty,
#cache-list {
  color: var(--muted);
}

.card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.05rem;
}

.card strong[data-state="online"],
.card strong[data-state="installed"],
.card strong[data-state="active"] {
  color: var(--accent);
}

.card strong[data-state="offline"],
.card strong[data-state="waiting"] {
  color: var(--warn);
}

.panel {
  min-width: 0;
  max-width: 100%;
  padding: 1.1rem;
  margin-top: 0.9rem;
  overflow-wrap: anywhere;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  min-width: 0;
}

.panel-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-head > button {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.composer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.2rem 0 0.9rem;
  min-width: 0;
  max-width: 100%;
}

.composer input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: #0b1220;
  color: var(--text);
}

.notes,
#cache-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 0.8rem;
  align-items: center;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.note > div:first-child {
  min-width: 0;
  max-width: 100%;
}

.note p {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.note time {
  font-size: 0.8rem;
}

.note button {
  padding: 0.4rem 0.75rem;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(251, 113, 133, 0.35);
}

.empty {
  margin: 0.4rem 0 0;
}

#cache-list li {
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
  word-break: break-all;
  max-width: 100%;
}

.guide {
  display: grid;
  gap: 0.75rem;
}

.guide article {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.guide h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.guide p,
footer {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

footer {
  margin-top: 1.4rem;
  font-size: 0.92rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero,
.status,
.guide,
.notes {
  max-width: 100%;
  min-width: 0;
}

.eyebrow {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .wrap {
    width: min(46rem, 100%);
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }

  .status {
    grid-template-columns: 1fr;
  }

  .panel-head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .composer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .composer button,
  .panel-head button {
    width: 100%;
  }

  .note {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .note button {
    justify-self: end;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: clamp(1.75rem, 9vw, 2.4rem);
  }

  .card strong,
  .panel {
    font-size: 0.98rem;
  }
}
