/* Plain, functional styling — no gradients, no icons-as-decoration, mobile-first. */

:root {
  --bg: #f4f4f2;
  --panel-bg: #ffffff;
  --fg: #1b1b1b;
  --muted: #6b6b6b;
  --border: #d8d8d4;
  --accent: #2f5d3a;
  --accent-fg: #ffffff;
  --error: #a3312c;
  --error-bg: #fbeceb;
  --ok: #2f5d3a;
  --ok-bg: #e9f3ec;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --panel-bg: #1f2123;
    --fg: #ece9e4;
    --muted: #9a9a94;
    --border: #34363a;
    --accent: #6fae82;
    --accent-fg: #10130f;
    --error: #e08079;
    --error-bg: #3a2020;
    --ok: #6fae82;
    --ok-bg: #1e2c22;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--accent); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--fg);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.site-nav a, .link-button {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover, .link-button:hover { color: var(--accent); }

.inline-form { display: inline; margin: 0; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.site-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

.site-footer {
  max-width: 720px;
  margin: 2rem auto 1rem;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.hero { padding: 1rem 0 1.5rem; text-align: center; }
.hero h1 { margin-bottom: 0.25rem; }
.hero p { color: var(--muted); }

.option-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .option-grid { grid-template-columns: 1fr 1fr; }
}

.option-card, .panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.option-card h2 { margin-top: 0; font-size: 1.1rem; }
.option-card p, .panel > p.muted, p.muted { color: var(--muted); font-size: 0.9rem; }

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  min-height: 44px;
}

textarea { min-height: 80px; resize: vertical; }

button, .button {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  font-size: 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  min-height: 44px;
}

button:hover, .button:hover { opacity: 0.9; }

button.secondary, .button.secondary {
  background: transparent;
  color: var(--accent);
}

button.danger, .button.danger {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.error-text {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
}

.flash {
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
}

.flash-ok { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok); }

.profile-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

img.avatar {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  image-rendering: pixelated;
  vertical-align: middle;
  margin-right: 0.4rem;
}

.profile-head h1 { margin: 0 0 0.25rem; }
.stat-line { margin: 0; color: var(--muted); font-size: 0.9rem; }

.skin-panel {
  display: flex;
  justify-content: center;
}

#skin-canvas {
  max-width: 100%;
  touch-action: pan-y;
}

.cosmetic-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cosmetic-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.cosmetic-item p { margin: 0.1rem 0 0; }

.swatch {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-top: 0.15rem;
  background: repeating-linear-gradient(45deg, #b8b8b0, #b8b8b0 4px, #d6d6ce 4px, #d6d6ce 8px);
}

.swatch-amethyst { background: #9a5cc6; }
.swatch-copper { background: #c17c53; }
.swatch-diamond { background: #5fd6d6; }
.swatch-emerald { background: #3fae56; }
.swatch-gold { background: #e6c229; }
.swatch-iron { background: #d8d8d0; }
.swatch-lapis { background: #2f56c0; }
.swatch-netherite { background: #4a4a4d; }
.swatch-quartz { background: #efece4; }
.swatch-redstone { background: #b3312c; }
.swatch-resin { background: #e08a2e; }
.swatch-leather { background: #8b5a3c; }
.swatch-chainmail { background: #9a9a9a; }

.cosmetic-icon {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 0.15rem;
  image-rendering: pixelated;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

th { color: var(--muted); font-weight: 600; }

/* Below the breakpoint, tables become stacked cards so nothing scrolls sideways. */
@media (max-width: 640px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.6rem;
  }
  td {
    border-bottom: none;
    padding: 0.3rem 0;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.85rem;
    flex: none;
    margin-right: 0.75rem;
  }
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge-active { color: var(--ok); border-color: var(--ok); }
.badge-inactive { color: var(--error); border-color: var(--error); }

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.qr-box img {
  width: 220px;
  height: 220px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.field-row label { font-size: 0.9rem; color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-tile {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}

.stat-tile strong { display: block; font-size: 1.3rem; }
.stat-tile span { color: var(--muted); font-size: 0.8rem; }

.admin-nav {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.note-form textarea { margin-bottom: 0.5rem; }

.db-banner {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
