/* Colour variables taken from the TTRPG Chat mockups. Every screen uses these,
   so dark mode is just a different set of values. */
:root,
[data-theme="light"] {
  --bg: #F5F0E6;
  --surface: #FFFDF8;
  --surface-2: #EDE6D8;
  --border: #D9CFBE;
  --text: #231F1A;
  --muted: #5C5348;
  --accent: #1D5C57;
  --on-accent: #FFFDF8;
  --danger: #A33A2A;
  --topbar: #F5F0E6;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #17140F;
  --surface: #221E18;
  --surface-2: #2C2720;
  --border: #3A332A;
  --text: #F1EBDD;
  --muted: #B8AE9C;
  --accent: #5FB3AB;
  --on-accent: #10201E;
  --danger: #F2B9AC;
  --topbar: #221E18;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  flex: 1;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 18px;
}

.status-dot {
  font-size: 12px;
  color: var(--muted);
}

.content {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero { text-align: center; padding: 24px 0 8px; }

.wordmark {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 44px;
  line-height: 1.05;
}

.tagline { margin: 10px 0 0; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title { margin: 0; font-size: 16px; font-weight: 600; }

.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.strong { font-weight: 600; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  flex: none;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 24px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  border: 0;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn:focus-visible, .segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-outline { background: var(--surface); border: 1.5px solid var(--text); }
.btn-text { background: transparent; color: var(--accent); min-height: 44px; padding: 0 8px; }
.btn-small { min-height: 44px; padding: 0 16px; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 24px;
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}
.segmented input:checked + span { background: var(--accent); color: var(--on-accent); }

.kv {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  font-size: 14px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

.footer { text-align: center; padding: 16px; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 448px;
  margin: 0 auto;
  padding: 8px 8px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: 28px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
