:root {
  --bg-top: #f8f5ee;
  --bg-bottom: #dde9f7;
  --ink: #1f2937;
  --muted: #556070;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-border: rgba(31, 41, 55, 0.1);
  --accent: #0f766e;
  --accent-2: #0ea5a4;
  --danger: #b91c1c;
  --ok: #166534;
  --shadow: 0 10px 30px rgba(28, 33, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(14, 165, 164, 0.2), transparent 35%),
    radial-gradient(circle at 90% 20%, rgba(15, 118, 110, 0.15), transparent 30%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

.page {
  width: min(900px, 92vw);
  margin: 28px auto;
  display: grid;
  gap: 18px;
}

.hero {
  padding: 6px 2px;
  animation: rise 420ms ease-out both;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  letter-spacing: 0.2px;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  animation: rise 420ms ease-out both;
}

.panel:nth-of-type(2) {
  animation-delay: 70ms;
}

.panel:nth-of-type(3) {
  animation-delay: 140ms;
}

.panel:nth-of-type(4) {
  animation-delay: 210ms;
}

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

h2 {
  margin: 0;
  font-size: 1.05rem;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

input {
  flex: 1;
  border: 1px solid #ccd7e5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.96rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.94rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  opacity: 0.92;
}

.btn.secondary {
  background: #334155;
}

.btn.on {
  background: linear-gradient(120deg, #15803d, #22c55e);
}

.btn.off {
  background: linear-gradient(120deg, #b91c1c, #ef4444);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  background: #e2e8f0;
}

.badge.ok {
  color: #064e3b;
  background: #d1fae5;
}

.badge.err {
  color: #7f1d1d;
  background: #fee2e2;
}

.output {
  margin: 0;
  min-height: 180px;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 12px;
  padding: 12px;
  color: #e6edf7;
  background: #0f172a;
  border: 1px solid #1e293b;
}

.control-panel .controls {
  display: flex;
  gap: 10px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  border: 1px solid #d8e1ed;
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
}

.metric-card h3,
.usage-head h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.metric-value {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
}

.metric-value.small {
  font-size: 1rem;
  font-weight: 700;
}

.metric-sub {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.resource-grid > .usage-grid {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 0;
}

.usage-card {
  border: 1px solid #d8e1ed;
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
}

.usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.usage-head span {
  font-weight: 700;
  color: #0f172a;
}

.usage-bar {
  margin-top: 8px;
  height: 11px;
  width: 100%;
  border-radius: 999px;
  background: #dbe6f3;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5a4, #14b8a6);
  transition: width 260ms ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .row,
  .control-panel .controls {
    flex-direction: column;
  }

  .metric-grid,
  .resource-grid,
  .usage-grid {
    grid-template-columns: 1fr;
  }

  .btn,
  input {
    width: 100%;
  }
}
