:root {
  color-scheme: dark;
  --bg: #080b11;
  --panel: #101620;
  --panel-2: #151d29;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3f6fb;
  --muted: #8995a8;
  --cyan: #2de2c5;
  --cyan-soft: rgba(45, 226, 197, 0.13);
  --amber: #ffc857;
  --red: #ff6b7a;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans Myanmar", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -10%, rgba(45, 226, 197, 0.11), transparent 32rem),
    radial-gradient(circle at 92% 10%, rgba(65, 105, 225, 0.1), transparent 30rem),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 32px;
}

.hero {
  max-width: 800px;
  margin-bottom: 38px;
}

.eyebrow,
.label,
.metric-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cyan);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 6px rgba(45, 226, 197, 0.1);
}

h1 {
  margin: 16px 0 14px;
  font-size: clamp(2.35rem, 7vw, 5.3rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h1 span {
  color: var(--cyan);
}

.intro {
  max-width: 680px;
  margin: 0;
  color: #aab4c3;
  font-size: clamp(0.98rem, 2vw, 1.1rem);
  line-height: 1.85;
}

.status-panel,
.card,
.metrics article,
.notice {
  border: 1px solid var(--line);
  background: rgba(16, 22, 32, 0.88);
  backdrop-filter: blur(12px);
}

.status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-radius: var(--radius);
  transition: border-color 180ms ease, background 180ms ease;
}

.status-panel.success {
  border-color: rgba(45, 226, 197, 0.36);
  background: linear-gradient(110deg, rgba(45, 226, 197, 0.08), rgba(16, 22, 32, 0.9) 48%);
}

.status-panel.error {
  border-color: rgba(255, 107, 122, 0.36);
  background: linear-gradient(110deg, rgba(255, 107, 122, 0.08), rgba(16, 22, 32, 0.9) 48%);
}

.status-main {
  display: flex;
  align-items: center;
  gap: 18px;
}

.status-icon {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 18px;
  color: var(--cyan);
  background: var(--cyan-soft);
  font-size: 1.3rem;
  font-weight: 900;
}

.error .status-icon {
  color: var(--red);
  background: rgba(255, 107, 122, 0.12);
}

.status-main h2 {
  margin: 5px 0 4px;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
}

.status-main p {
  margin: 0;
  color: var(--muted);
  font-size: 0.91rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #abb5c4;
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: pointer;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #222b38;
  transition: 160ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d8dee8;
  content: "";
  transition: 160ms ease;
}

.switch-row input:checked + .switch {
  border-color: rgba(45, 226, 197, 0.42);
  background: var(--cyan);
}

.switch-row input:checked + .switch::after {
  transform: translateX(18px);
  background: #07110f;
}

#testButton {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  color: #06110f;
  background: var(--cyan);
  font-weight: 850;
  cursor: pointer;
}

#testButton:hover {
  filter: brightness(1.08);
}

#testButton:disabled {
  cursor: wait;
  opacity: 0.6;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.metrics article {
  min-width: 0;
  padding: 20px;
  border-radius: 18px;
}

.metrics strong {
  display: block;
  overflow: hidden;
  margin: 10px 0 3px;
  font-size: clamp(1.35rem, 4vw, 2.05rem);
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
}

.metrics .time-value {
  font-size: clamp(1.12rem, 3vw, 1.45rem);
}

.metrics small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: 14px;
}

.card {
  min-width: 0;
  padding: 22px;
  border-radius: var(--radius);
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.card-heading h3 {
  margin: 5px 0 0;
  font-size: 1.22rem;
}

.heading-translation {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.updated {
  overflow: hidden;
  max-width: 52%;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

pre {
  min-height: 190px;
  max-height: 300px;
  margin: 0;
  padding: 20px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  color: #c9f9ec;
  background: #090e15;
  font: 500 0.82rem/1.72 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-button {
  padding: 6px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  cursor: pointer;
}

.cache-insight {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  margin-bottom: 8px;
  padding: 14px;
  border: 1px solid rgba(45, 226, 197, 0.18);
  border-radius: 14px;
  background: rgba(45, 226, 197, 0.055);
}

.cache-badge {
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(45, 226, 197, 0.12);
  font: 800 0.68rem ui-monospace, monospace;
  white-space: nowrap;
}

.cache-insight strong {
  display: block;
  color: #d7dee8;
  font-size: 0.78rem;
  line-height: 1.55;
}

.cache-insight p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.history-list {
  display: grid;
  max-height: 310px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: start;
  gap: 11px;
  padding: 13px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
}

.history-list li:last-child {
  border-bottom: 0;
}

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  margin-top: 5px;
}

.history-dot.error {
  background: var(--red);
}

.history-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.history-message {
  color: #d9e0e9;
  font-size: 0.8rem;
  line-height: 1.5;
}

.history-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  color: var(--muted);
  font: 600 0.72rem ui-monospace, monospace;
  padding-top: 2px;
  white-space: nowrap;
}

.history-list .empty-history {
  display: block;
  border: 0;
  color: var(--muted);
}

.notice {
  margin-top: 14px;
  padding: 19px 22px;
  border-radius: 18px;
  color: #b8c1cf;
}

.notice strong {
  color: var(--amber);
}

.notice p {
  margin: 7px 0 0;
  font-size: 0.86rem;
  line-height: 1.75;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 3px 0;
  color: var(--muted);
  font-size: 0.75rem;
}

footer code {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 850px) {
  .shell {
    padding-top: 46px;
  }

  .status-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .controls {
    justify-content: space-between;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 520px) {
  .shell {
    width: min(100% - 22px, 1120px);
    padding-top: 34px;
  }

  .hero {
    margin-bottom: 28px;
  }

  .status-panel,
  .card {
    padding: 18px;
  }

  .status-main {
    align-items: flex-start;
  }

  .status-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .switch-row {
    justify-content: space-between;
  }

  .metrics article {
    padding: 16px;
  }

  pre {
    min-height: 180px;
    padding: 15px;
    font-size: 0.75rem;
  }

  .cache-insight {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .cache-badge {
    justify-self: start;
  }

  .history-list li {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .history-meta {
    grid-column: 2;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
