:root {
  color-scheme: dark;
  --bg: #111014;
  --panel: #1c1a20;
  --line: #302d35;
  --text: #f6f3f8;
  --muted: #9d98a4;
  --orange: #ff7338;
  --blue: #3b9cff;
  --green: #39ce82;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% -10%, #3a241e 0, transparent 34rem),
    radial-gradient(circle at 95% 5%, #142a3b 0, transparent 30rem), var(--bg);
  color: var(--text);
}
.shell { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }
header, .panel-title, .actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions form { margin: 0; }
h1 { margin: 4px 0 8px; font-size: clamp(30px, 5vw, 48px); letter-spacing: -1px; }
h2 { margin: 0 0 7px; font-size: 20px; }
p { margin: 0; }
.eyebrow { color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: 2.4px; }
.sub, .panel-title p { color: var(--muted); }
.badge { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--green); border-color: #286849; background: #173326; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 34px 0 16px; }
.stats article, .panel { background: rgba(28,26,32,.92); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 55px #0004; }
.stats article { padding: 21px 24px; }
.stats span { display: block; color: var(--muted); font-size: 14px; }
.stats strong { display: block; margin-top: 7px; font-size: 32px; }
.stats article:nth-child(2) strong { color: var(--orange); }
.stats article:nth-child(3) strong { color: var(--green); }
.panel { padding: 24px; margin-top: 16px; }
textarea, input {
  width: 100%; color: var(--text); background: #131217; border: 1px solid var(--line);
  border-radius: 12px; outline: none; transition: border-color .2s;
}
textarea:focus, input:focus { border-color: var(--blue); }
textarea { height: 210px; margin: 20px 0 12px; padding: 16px; resize: vertical; font: 13px/1.55 ui-monospace, SFMono-Regular, monospace; }
input { max-width: 280px; padding: 11px 13px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.settings-grid label span { display: block; margin: 0 0 7px 3px; color: var(--muted); font-size: 13px; }
.settings-grid input { max-width: none; }
.settings-grid .wide { grid-column: 1 / -1; }
.settings-actions { margin-top: 18px; }
button {
  border: 0; border-radius: 11px; padding: 11px 17px; background: var(--orange);
  color: white; font-weight: 700; cursor: pointer; white-space: nowrap;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: wait; }
button.secondary { background: #29262e; color: #d9d4dd; border: 1px solid #3b3741; }
.actions { justify-content: flex-start; flex-wrap: wrap; }
.feedback { min-height: 21px; margin-top: 11px; color: var(--green); }
.feedback.error { color: #ff6666; }
.villages { margin-top: 18px; }
.village { border-top: 1px solid var(--line); padding-top: 19px; margin-top: 19px; }
.village:first-child { margin-top: 0; }
.village-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.village-head h3 { margin: 0; font-size: 18px; }
.village-head span { color: var(--muted); font-size: 13px; }
.upgrade { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 13px; align-items: center; padding: 13px 4px; border-bottom: 1px solid #29262e; }
.icon { display: grid; place-items: center; width: 42px; height: 42px; background: #2b2730; border-radius: 12px; font-size: 20px; }
.upgrade-name { font-weight: 700; }
.meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.time { color: var(--orange); font-variant-numeric: tabular-nums; text-align: right; min-width: 98px; }
.time small { display: block; margin-top: 3px; color: var(--muted); }
.time.done { color: var(--green); }
.delete { padding: 7px 10px; background: transparent; color: #77717d; border: 0; }
.empty { padding: 35px 0; text-align: center; color: var(--muted); }
.login-page { display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(440px, 100%); padding: 38px; background: rgba(28,26,32,.96);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 80px #0007;
}
.login-card h1 { margin-top: 8px; font-size: 32px; }
.login-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 22px; border-radius: 18px; background: #34251f; font-size: 28px; }
.login-form { display: grid; gap: 17px; margin-top: 28px; }
.login-form label span { display: block; margin: 0 0 7px 3px; color: var(--muted); font-size: 13px; }
.login-form input { max-width: none; }
.login-form button { width: 100%; margin-top: 4px; padding: 13px; }
.login-error { color: #ff6666; font-size: 14px; }
@media (max-width: 640px) {
  .shell { padding-top: 30px; }
  header { align-items: flex-start; }
  .header-actions { align-items: flex-end; flex-direction: column; }
  .stats { gap: 8px; }
  .stats article { padding: 15px; }
  .stats strong { font-size: 25px; }
  .panel { padding: 18px; border-radius: 16px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .wide { grid-column: auto; }
  .panel-title { align-items: flex-start; }
  .upgrade { grid-template-columns: 40px 1fr auto; }
  .delete { display: none; }
}
