:root {
  --bg: #f0ebe0;
  --card: #c9b898;
  --brd: #2e2218;
  --lbl: #d6cfc4;
  --gothic: "UnifrakturMaguntia", serif;
  --body: "IM Fell English", serif;
  --muted: #6b5c4c;
  --dsh: #b0a090;
  --accent: #8a6020;
  --danger: #8a3010;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.site-body {
  margin: 0;
  min-height: 100vh;
  color: var(--brd);
  font-family: var(--body);
  background: var(--bg);
  padding: 14px;
}

a { color: inherit; text-decoration: none; }

.site-header,
.site-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 0 10px;
  margin-bottom: 14px;
}

.brand {
  font-family: var(--gothic);
  font-size: 1.9rem;
  text-decoration: none;
  line-height: 1.15;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.site-nav a,
.ghost-btn {
  font-size: 0.95rem;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--brd);
  border-bottom: 1px dashed rgba(46, 34, 24, 0.35);
}

.ghost-btn {
  border: none;
  font-family: inherit;
}

.ghost-btn:hover {
  color: var(--accent);
}

.site-shell {
  padding: 0 0 40px;
}

.hero-card,
.panel,
.stat-card {
  background: var(--lbl);
  border: 1.5px solid var(--brd);
  box-shadow: none;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.hero-card {
  padding: 28px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 16px;
}

.hero-card h1,
.panel h1,
.panel h2 {
  margin: 0 0 12px;
  line-height: 1.1;
  font-family: var(--gothic);
}

.panel h1 { font-size: 1.8rem; }
.panel h2 { font-size: 1.4rem; }

.hero-card h1 { font-size: clamp(2.8rem, 7vw, 5rem); max-width: 780px; }
.panel h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.panel h2 { font-size: 1.8rem; }

.eyebrow,
.muted-note {
  margin: 0;
  font-size: 0.85rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: normal;
}

.muted-note {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

.hero-copy {
  max-width: 620px;
  margin: 0 0 24px;
  font-size: 0.95rem;
}

.hero-actions,
.action-row,
.panel-header,
.stats-grid,
.dashboard-grid {
  display: flex;
  gap: 10px;
}

.hero-actions,
.action-row {
  flex-wrap: wrap;
  align-items: center;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-link,
.danger-icon {
  border: 1.5px solid var(--brd);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
  font-family: var(--body);
  font-size: 0.95rem;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-link {
  padding: 10px 16px;
}

.primary-btn {
  color: #f5ead0;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-btn:hover {
  background: #7a5518;
  border-color: #7a5518;
}

.secondary-btn,
.ghost-link,
.ghost-btn {
  color: var(--brd);
  border: 1.5px solid var(--brd);
  background: #e0d9cf;
}

.secondary-btn:hover,
.ghost-btn:hover {
  background: #cfc8be;
}

.danger-btn {
  color: #f5ead0;
  background: var(--danger);
  border-color: var(--danger);
}

.danger-btn:hover {
  background: #6a2810;
}

.danger-icon {
  width: 40px;
  height: 40px;
  background: rgba(138, 48, 16, 0.12);
  padding: 0;
}

.danger-icon:hover {
  background: rgba(138, 48, 16, 0.25);
}

.narrow-panel {
  width: min(520px, 100%);
  margin: 0 auto;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.stack-form label {
  display: grid;
  gap: 4px;
}

.stack-form label span {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stack-form input {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid var(--brd);
  background: #ede8df;
  color: var(--brd);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}

.stack-form input:focus {
  background: #fff;
  border-color: var(--accent);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.flash {
  padding: 10px 14px;
  border: 1.5px solid var(--brd);
  background: #ede8df;
  font-size: 0.95rem;
}

.flash-error { 
  border-color: #8a3010;
  background: rgba(138, 48, 16, 0.1);
  color: #8a3010;
}

.flash-success { 
  border-color: #4a6b2a;
  background: rgba(74, 107, 42, 0.1);
  color: #4a6b2a;
}

.dashboard-grid {
  align-items: start;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.dashboard-grid > * {
  flex: 1 1 300px;
}

.character-list-panel.deletion-mode .delete-col {
  display: table-cell;
}

.delete-col {
  display: none;
  width: 60px;
  text-align: center;
}

.panel-header {
  justify-content: space-between;
  align-items: end;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-header > div {
  flex: 1;
}

.character-table-wrap {
  overflow-x: auto;
}

.character-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.character-table th,
.character-table td {
  padding: 8px 10px;
  border: 1.5px solid var(--brd);
  text-align: left;
  border-right: 1px solid var(--brd);
}

.character-table th {
  background: var(--lbl);
  font-weight: bold;
}

.character-table th:last-child,
.character-table td:last-child {
  border-right: 1.5px solid var(--brd);
}

.character-row {
  transition: background 0.15s ease;
}

.character-row:hover {
  background: rgba(201, 184, 152, 0.25);
  cursor: pointer;
}

.emoji-cell {
  font-size: 1.3rem;
  text-align: center;
  width: 50px;
}

.empty-state {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  padding: 16px;
  text-align: center;
}

.stats-grid {
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-card {
  flex: 1 1 180px;
  padding: 12px;
  background: var(--card);
  border: 1.5px solid var(--brd);
  text-align: center;
}

.stat-card span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card strong {
  display: block;
.stat-card {
  flex: 1 1 180px;
  padding: 12px;
  background: var(--card);
  border: 1.5px solid var(--brd);
  text-align: center;
}

.stat-card span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card strong {
  display: block;
  font-size: 1.6rem;
  color: var(--brd);
  font-weight: bold;
}

.inline-danger-form {
  margin-top: 12px;
}



@media (max-width: 760px) {
  .site-header {
    padding-top: 0;
  }

  .hero-card {
    padding: 24px;
    min-height: auto;
  }

  .site-shell,
  .site-header {
    width: calc(100% - 28px);
  }

  .dashboard-grid {
    flex-direction: column;
  }

  .dashboard-grid > * {
    flex: 1 1 auto;
  }

  .telegram-link {
    font-size: 1.1rem;
  }
}

/* Portrait Styles for Account Page */
.portrait-cell {
  width: 60px;
  text-align: center;
  vertical-align: middle;
  padding: 8px;
}

.portrait-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--dsh);
}

.portrait-cell .emoji {
  font-size: 2.2rem;
  line-height: 1;
}
