:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(15, 27, 46, 0.9);
  --panel-strong: #101f35;
  --line: rgba(148, 163, 184, 0.2);
  --text: #edf4ff;
  --muted: #9eacc1;
  --accent: #58a6ff;
  --accent-strong: #2388f5;
  --success: #3ddc97;
  --warning: #f7c65c;
  --danger: #ff7474;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(35, 136, 245, 0.18), transparent 32rem),
    radial-gradient(circle at 95% 10%, rgba(61, 220, 151, 0.1), transparent 25rem),
    var(--bg);
}

button, input, textarea { font: inherit; }
button { touch-action: manipulation; }

.page-shell {
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 38px 0 calc(32px + env(safe-area-inset-bottom));
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 4px 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(30px, 6vw, 50px); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin: 0; font-size: 19px; }
.subtitle { max-width: 700px; margin: 14px 0 0; color: var(--muted); font-size: 15px; line-height: 1.72; }

.status-pill {
  flex: 0 0 auto;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(15, 27, 46, .75);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.status-pill.success { color: var(--success); border-color: rgba(61, 220, 151, .38); }
.status-pill.loading { color: var(--accent); border-color: rgba(88, 166, 255, .4); }
.status-pill.error { color: var(--danger); border-color: rgba(255, 116, 116, .4); }
.status-pill.warning-state { color: var(--warning); border-color: rgba(247, 198, 92, .42); }

.card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: linear-gradient(150deg, rgba(17, 34, 57, .94), rgba(11, 23, 40, .9));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2);
  backdrop-filter: blur(12px);
}

.form-card form { display: grid; gap: 17px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 14px; font-weight: 760; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }
code { color: #b9d9ff; }

input, textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: rgba(3, 12, 25, .64);
  transition: border-color .16s ease, box-shadow .16s ease;
}
input { min-height: 48px; padding: 11px 13px; }
textarea { resize: vertical; padding: 13px; line-height: 1.55; word-break: break-all; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88, 166, 255, .13); }

.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 3px; }
.button-row.compact { margin-top: 11px; }

button {
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, .23);
  border-radius: 11px;
  padding: 9px 14px;
  color: var(--text);
  background: rgba(25, 43, 68, .92);
  font-weight: 730;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
button:hover { border-color: rgba(88, 166, 255, .65); background: rgba(33, 56, 88, .96); }
button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: .6; }
button.primary { border-color: transparent; background: linear-gradient(135deg, var(--accent-strong), #4b70f6); }
button.primary:hover { background: linear-gradient(135deg, #3297fa, #5a7cff); }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.text-button, .delete-button { min-height: 34px; border: 0; padding: 6px 8px; color: var(--muted); background: transparent; font-size: 12px; }
.delete-button:hover, .text-button:hover { color: var(--danger); background: rgba(255, 116, 116, .08); }

.notice { margin-top: 14px; border-radius: 11px; padding: 11px 13px; font-size: 12px; line-height: 1.55; }
.notice.warning { border: 1px solid rgba(247, 198, 92, .27); color: #f4d994; background: rgba(247, 198, 92, .07); }

.history-list { display: grid; gap: 8px; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 7px 8px 7px 12px; background: rgba(3, 12, 25, .4); }
.history-main { display: grid; justify-items: start; gap: 4px; min-width: 0; min-height: 42px; border: 0; padding: 4px 0; text-align: left; background: transparent; }
.history-main:hover { background: transparent; }
.history-main strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-main span { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.ip-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ip-item { display: flex; align-items: center; justify-content: flex-start; gap: 9px; min-width: 0; padding: 10px 11px; background: rgba(3, 12, 25, .48); }
.ip-item span { color: var(--muted); font-size: 11px; }
.ip-item strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; }

.empty-state { border: 1px dashed rgba(148, 163, 184, .23); border-radius: 12px; padding: 18px; color: var(--muted); text-align: center; font-size: 13px; }
.error-text { color: var(--danger); }
.hidden { display: none !important; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 18px; padding: 22px 5px 0; color: #738197; font-size: 11px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100% - 30px);
  border: 1px solid rgba(61, 220, 151, .32);
  border-radius: 12px;
  padding: 11px 15px;
  color: #dffbed;
  background: rgba(14, 45, 35, .96);
  box-shadow: 0 15px 35px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: opacity .18s ease, transform .18s ease;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 116, 116, .35); color: #ffe5e5; background: rgba(69, 24, 30, .97); }

@media (max-width: 720px) {
  .page-shell { width: min(100% - 20px, 920px); padding-top: 20px; }
  .hero { display: grid; gap: 14px; margin-bottom: 18px; }
  .status-pill { justify-self: start; }
  .card { padding: 16px; border-radius: 15px; }
  .ip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .button-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .button-row button { min-width: 0; padding-inline: 8px; font-size: 12px; }
}

@media (max-width: 430px) {
  h1 { font-size: 31px; }
  .subtitle { font-size: 14px; }
  .ip-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
}
