:root {
  --ink: #f7f2e8;
  --muted: #a8b0a4;
  --void: #070b10;
  --panel: rgba(15, 22, 25, 0.78);
  --panel-strong: rgba(22, 31, 32, 0.92);
  --line: rgba(218, 245, 221, 0.16);
  --cyan: #57f3ff;
  --lime: #c7ff5a;
  --gold: #ffc857;
  --rose: #ff6b8a;
  --bad: #ff6b6b;
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(199, 255, 90, 0.06), transparent 32%),
    radial-gradient(circle at 80% 8%, rgba(87, 243, 255, 0.22), transparent 30%),
    radial-gradient(circle at 12% 78%, rgba(255, 200, 87, 0.13), transparent 28%),
    var(--void);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 72%);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.ambient { position: fixed; border-radius: 999px; filter: blur(60px); opacity: 0.22; pointer-events: none; }
.ambient-one { width: 360px; height: 360px; right: -140px; top: 120px; background: var(--cyan); }
.ambient-two { width: 420px; height: 420px; left: -180px; bottom: 20px; background: var(--lime); }

.app-shell { width: min(1420px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 80px; }
.reveal { animation: rise 560ms ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.hero-card, .api-hero {
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 28px;
  align-items: end;
  padding: clamp(28px, 5vw, 72px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(247, 242, 232, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(20, 30, 31, 0.82), rgba(8, 12, 16, 0.92));
  box-shadow: 0 40px 120px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}

.hero-card::after, .api-hero::after {
  content: "API";
  position: absolute;
  right: -30px;
  top: -44px;
  font-family: Georgia, serif;
  font-size: clamp(120px, 20vw, 280px);
  line-height: 1;
  color: rgba(255,255,255,0.035);
}

.kicker { margin: 0 0 14px; color: var(--lime); text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.74rem; font-weight: 800; }
h1, h2, h3 { margin: 0; letter-spacing: -0.055em; }
h1 { max-width: 930px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 8vw, 7.6rem); line-height: 0.86; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 3vw, 3.4rem); line-height: 0.95; }
h3 { font-size: 1.35rem; }
.hero-text { max-width: 620px; margin: 22px 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }

.id-search, .secret-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  background: rgba(5, 9, 12, 0.58);
  backdrop-filter: blur(18px);
  z-index: 1;
}
.id-search label, .secret-card span { display: block; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 10px; }
.search-row { display: flex; gap: 10px; }
input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  padding: 14px 18px;
}
button, .key-footer a, .back-link {
  border: 1px solid rgba(199,255,90,0.42);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(199,255,90,0.22), rgba(87,243,255,0.08));
  color: var(--ink);
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}
button:hover, .key-footer a:hover, .back-link:hover { transform: translateY(-2px); border-color: var(--lime); }
.id-search p { margin: 12px 4px 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.login-form-card { display: grid; gap: 12px; align-content: start; }
.login-form-card button { margin-top: 6px; }
.login-shell-page { padding-top: 52px; }
.login-hero { align-items: center; }
.session-card { display: grid; gap: 14px; }
.session-head, .top-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.session-head strong { font-size: 1.1rem; }

.notice-card { margin-top: 22px; padding: 24px; border: 1px solid rgba(255,107,107,0.45); border-radius: var(--radius-lg); background: rgba(255,107,107,0.08); color: #ffd0d0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.metric-grid-wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card, .key-card, .data-panel, .window-card, .trend-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.06);
}
.metric-card { padding: 22px; position: relative; overflow: hidden; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent, var(--cyan)); }
.accent-cyan { --accent: var(--cyan); } .accent-lime { --accent: var(--lime); } .accent-gold { --accent: var(--gold); } .accent-rose { --accent: var(--rose); }
.metric-card span, .quota-line span, th { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; }
.metric-card strong { display: block; margin: 8px 0 4px; font-family: Georgia, serif; font-size: clamp(2rem, 3vw, 3.1rem); letter-spacing: -0.06em; line-height: 1; }
.metric-card em { color: var(--muted); font-style: normal; }

.section-head, .panel-title, .card-topline, .key-footer, .api-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.section-head { margin: 48px 0 18px; }
.pill, .mini-badge, .status-dot { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--muted); background: rgba(255,255,255,0.05); }
.status-dot { display: inline-flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 18px currentColor; }
.is-good { color: var(--lime); } .is-warn { color: var(--gold); } .is-bad { color: var(--bad); } .is-muted { color: var(--muted); }

.key-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.key-card { min-width: 0; max-width: 100%; padding: 22px; display: grid; gap: 18px; overflow: hidden; contain: inline-size; }
.key-card > * { min-width: 0; max-width: 100%; }
.key-card h3 {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
  hyphens: auto;
  line-height: 1.08;
}
.card-topline { min-width: 0; color: var(--muted); font-size: 0.86rem; flex-wrap: wrap; align-items: flex-start; }
.card-topline > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.secret-row, .secret-card { min-width: 0; display: grid; gap: 12px; }
code { display: block; min-width: 0; width: 100%; max-width: 100%; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; border: 1px dashed rgba(87,243,255,0.28); border-radius: var(--radius-md); background: rgba(87,243,255,0.06); color: #d9fbff; padding: 14px; font-family: "Courier New", monospace; line-height: 1.55; }
.code-block { margin: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px dashed rgba(87,243,255,0.28); border-radius: var(--radius-md); background: rgba(87,243,255,0.06); color: #d9fbff; padding: 14px; font-family: "Courier New", monospace; line-height: 1.55; }
.inline-code { display: inline; padding: 2px 6px; border-radius: 8px; border: 1px dashed rgba(87,243,255,0.22); background: rgba(87,243,255,0.06); }
.key-card code {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: clamp(0.76rem, 1.6vw, 0.9rem);
  line-height: 1.45;
}
.copy-button { width: max-content; max-width: 100%; padding: 9px 14px; }
.quota-stack { display: grid; gap: 14px; }
.quota-line { min-width: 0; display: grid; gap: 8px; }
.quota-line div:first-child { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-items: start; }
.quota-line strong { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-all; text-align: left; }
.compact-metrics { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 6px; }
.compact-metrics strong { font-size: clamp(0.78rem, 1.5vw, 0.96rem); line-height: 1.35; }
.meter { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.meter i { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--lime), var(--cyan)); }
.key-footer { min-width: 0; padding-top: 4px; color: var(--muted); }
.key-footer span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; line-height: 1.45; }
.stacked-footer { display: grid; gap: 12px; align-items: start; }

.two-column { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px; margin-top: 22px; }
.example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.data-panel { padding: 22px; overflow: auto; }
.example-card { display: grid; align-content: start; gap: 12px; min-height: 100%; }
.panel-title { margin-bottom: 18px; }
.panel-title span { color: var(--muted); }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 13px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); text-align: left; vertical-align: top; }
td { color: rgba(247,242,232,0.9); font-size: 0.94rem; }
.dashboard-request-table { min-width: 1360px; }
.dashboard-request-key-label {
  width: 10rem;
  max-width: 10rem;
  min-width: 8rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}
.dashboard-request-table th:nth-child(13),
.dashboard-request-table td:nth-child(13) {
  min-width: 7rem;
  white-space: nowrap;
}
.dashboard-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.page-link {
  border: 1px solid rgba(199,255,90,0.42);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(199,255,90,0.16), rgba(87,243,255,0.06));
  color: var(--ink);
  padding: 8px 12px;
}
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.empty-block { color: var(--muted); padding: 16px 0; }
.back-link { display: inline-flex; margin-bottom: 18px; }
.api-hero { min-height: 260px; grid-template-columns: 1fr auto; align-items: end; margin-bottom: 18px; }
.api-hero h1 { font-size: clamp(3rem, 7vw, 6rem); }
.secret-card { margin-bottom: 20px; }
.window-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.window-card { padding: 18px; background: rgba(255,255,255,0.035); }
.window-card h3 { margin-bottom: 12px; }
.trend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.trend-card { padding: 18px; background: rgba(255,255,255,0.035); }
.trend-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--muted); }
.trend-bar-group { display: grid; gap: 12px; }
.trend-bar-group div { display: grid; gap: 6px; }
.trend-bar-group em, .distribution-row em { color: var(--muted); font-style: normal; font-size: 0.9rem; }
.trend-meter { height: 10px; }
.trend-meter.alt i { background: linear-gradient(90deg, var(--gold), var(--cyan)); }
.trend-meter.muted i { background: linear-gradient(90deg, var(--rose), var(--gold)); }
.distribution-list { display: grid; gap: 14px; }
.distribution-row { display: grid; gap: 10px; }
.distribution-copy { min-width: 0; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.distribution-copy strong, .distribution-copy span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.distribution-copy span { color: var(--muted); font-size: 0.9rem; }
.distribution-meter { height: 10px; }
.distribution-meter i { background: linear-gradient(90deg, var(--cyan), var(--lime)); }
.top-actions { margin-bottom: 18px; }
.top-actions form, .session-head form { margin: 0; }
.config-path { display: block; color: var(--muted); font-size: 0.85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-note { margin-top: 0; font-size: 0.94rem; line-height: 1.5; }

@media (max-width: 1180px) {
  .hero-card, .api-hero, .two-column, .example-grid { grid-template-columns: 1fr; }
  .metric-grid, .key-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app-shell { width: min(100% - 24px, 1420px); padding-top: 18px; }
  .hero-card, .api-hero { padding: 24px; min-height: auto; }
  .search-row, .section-head, .panel-title, .key-footer { align-items: stretch; flex-direction: column; }
  .metric-grid, .key-grid, .window-grid { grid-template-columns: 1fr; }
  h1 { font-size: 3rem; }
}
