* { box-sizing: border-box; }

:root {
  color-scheme: light dark;
  --bg-a: #f6f7fa;
  --bg-b: #e6e9ef;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.68);
  --field: rgba(255, 255, 255, 0.55);
  --line: rgba(20, 20, 26, 0.12);
  --text: #1b1b1f;
  --muted: #5f636b;
  --accent: #3d8bfd;
  --green: #39d98a;
  --red: #ff6b6b;
  --gold: #e9b949;
  --silver: #c9d1d9;
  --copper: #c97c4a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-a: #24242c;
    --bg-b: #131318;
    --glass: rgba(36, 36, 44, 0.55);
    --glass-strong: rgba(36, 36, 44, 0.72);
    --field: rgba(10, 10, 14, 0.3);
    --line: rgba(255, 255, 255, 0.1);
    --text: #eaeaee;
    --muted: #9a9da6;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 6% -12%, rgba(61, 139, 253, 0.24), transparent 64%),
    radial-gradient(900px 620px at 102% 6%, rgba(240, 138, 155, 0.14), transparent 62%),
    radial-gradient(850px 560px at 50% 112%, rgba(57, 217, 138, 0.12), transparent 62%),
    linear-gradient(155deg, var(--bg-a), var(--bg-b));
  background-attachment: fixed;
  color: var(--text);
  font: 13px/1.45 "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 20px 30px;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.top h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

button {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

button.primary {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}

button.primary:focus-visible,
button.quiet:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

button.quiet {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
}

button.quiet:hover { color: var(--text); }

input {
  height: 28px;
  padding: 0 9px;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

input:focus { border-color: var(--accent); }

.add {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
}

.add input { width: 220px; }

.error {
  font-size: 11px;
  color: var(--red);
  margin: 0;
}

.empty {
  font-size: 11px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 160px;
  padding: 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 7px;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.panel.online {
  border-color: rgba(57, 217, 138, 0.55);
  box-shadow: 0 0 0 1px rgba(57, 217, 138, 0.3), 0 0 14px rgba(57, 217, 138, 0.14);
}

.panel header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 20px;
}

.panel .name {
  min-width: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.panel .name:hover { color: var(--accent); }

.panel .lvl {
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.panel .coins {
  margin-left: auto;
  align-self: center;
}

.panel .remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 107, 107, 0.72);
  cursor: pointer;
}

.panel .remove:hover { color: var(--red); }

.panel .remove svg { display: block; }

.meter {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
}

.meter .label {
  font-size: 10px;
  color: var(--muted);
}

.meter .value {
  font-size: 10px;
  color: var(--muted);
  text-align: right;
}

.track {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.track i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.hp i { background: #39d98a; }
.mp i { background: #3d8bfd; }
.exp i { background: linear-gradient(90deg, #f08a9b, #f7dc9b); }

.coins {
  display: flex;
  gap: 6px;
  font-size: 11px;
  min-height: 16px;
}

.coins .g { color: var(--gold); }
.coins .s { color: var(--silver); }
.coins .c { color: var(--copper); }

.status {
  font-size: 11px;
  color: var(--text);
  min-height: 16px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.seen {
  font-size: 10px;
  color: var(--muted);
}

body.login {
  display: grid;
  place-items: center;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 260px;
  padding: 18px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.login-card h1 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
}

.login-card input { width: 100%; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.32);
}

.modal[hidden] { display: none; }

.sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(320px, 100%);
  max-height: min(640px, 86vh);
  overflow: auto;
  padding: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.sheet header {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.sheet h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sheet .lvl {
  font-size: 11px;
  color: var(--muted);
}

.sheet .close {
  margin-left: auto;
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
}

.sheet .close:hover { color: var(--red); }

.sheet .body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 11px;
  color: var(--muted);
}

.stat .v { color: var(--text); }

.sheet hr {
  width: 100%;
  margin: 2px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
