:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --border: #d9dee7;
  --accent: #2457c5;
  --accent-dark: #1c4296;
  --accent-soft: #e8efff;
  --player: #f3f4f6;
  --admin: #e8efff;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.15rem;
}

p {
  margin: 0.35rem 0;
}

code,
.uuid {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84em;
  word-break: break-all;
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  align-items: center;
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  min-height: 60px;
}

.brand {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: flex-end;
}

.nav a,
.link-button {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav a:hover,
.link-button:hover {
  color: var(--text);
  text-decoration: none;
}

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

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

main.wrap {
  padding: 1.5rem 0 3rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  padding: 1.25rem 0 2rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.2rem;
}

.panel.narrow {
  margin-left: auto;
  margin-right: auto;
  max-width: 430px;
}

.page-head {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.84rem;
}

.nowrap {
  white-space: nowrap;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.breadcrumbs span {
  margin: 0 0.35rem;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.toolbar label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.grid.two {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.field label,
.composer label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
select,
textarea {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 0.6rem 0.7rem;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 87, 197, 0.12);
  outline: none;
}

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

.checkbox {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.88rem;
  gap: 0.4rem;
  white-space: nowrap;
}

.checkbox input {
  width: auto;
}

.button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.55rem 0.9rem;
  text-align: center;
  white-space: nowrap;
}

.button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  text-decoration: none;
}

.button.secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.button.secondary:hover {
  background: var(--bg);
}

.button.small {
  font-size: 0.82rem;
  padding: 0.4rem 0.65rem;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.stack > * {
  margin-bottom: 0.85rem;
}

.field-errors ul,
.errorlist {
  color: var(--danger);
  font-size: 0.84rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.messages {
  margin-bottom: 1rem;
}

.message-banner {
  background: var(--accent-soft);
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.8rem;
}

.message-banner.success {
  background: var(--ok-soft);
  border-color: #bbf7d0;
  color: var(--ok);
}

.message-banner.error {
  background: var(--danger-soft);
  border-color: #fecdca;
  color: var(--danger);
}

.message-banner.warning {
  background: var(--warn-soft);
  border-color: #fde68a;
  color: var(--warn);
}

.badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.12rem 0.55rem;
  white-space: nowrap;
}

.badge.pending {
  background: var(--warn-soft);
  border-color: #fde68a;
  color: var(--warn);
}

.badge.answered {
  background: var(--ok-soft);
  border-color: #bbf7d0;
  color: var(--ok);
}

.table-wrap {
  overflow-x: auto;
  padding: 0;
}

table {
  border-collapse: collapse;
  font-size: 0.9rem;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #fafbfc;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.preview {
  color: #344054;
  max-width: 380px;
}

.empty {
  color: var(--muted);
  padding: 2rem 1rem;
  text-align: center;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 1rem 0;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.message-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}

.message-card.player {
  background: var(--player);
  margin-right: 2.5rem;
}

.message-card.admin {
  background: var(--admin);
  border-color: #c7d7fe;
  margin-left: 2.5rem;
}

.message-card header {
  align-items: baseline;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.message-card .author {
  font-size: 0.84rem;
  font-weight: 700;
}

.message-card .meta {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.message-content {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.composer {
  margin-top: 1rem;
}

.status {
  font-size: 0.88rem;
  min-height: 1.35rem;
  padding: 0.15rem 0;
}

.status.error {
  color: var(--danger);
}

@media (max-width: 720px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem 0;
  }

  .nav {
    justify-content: flex-start;
  }

  .page-head {
    flex-direction: column;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .message-card.player {
    margin-right: 0;
  }

  .message-card.admin {
    margin-left: 0;
  }

  .preview {
    max-width: 220px;
  }
}
