/*
 * The account server's look: the game's "green banner parchment" (web/src/styles/tokens.css),
 * only what these few pages need. Light on :root, dark when the device asks for it.
 */
@font-face {
  font-family: 'Alegreya Sans';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/alegreya-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/alegreya-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/alegreya-sans-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya SC';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/alegreya-sc-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Uncial Antiqua';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/uncial-antiqua-latin-400-normal.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --color-bg: #f4eee2;
  --color-surface: #fdfaf3;
  --color-well: #eee5d3;
  --color-border: #d6c9b0;
  --color-divider: #ece3d2;
  --color-stain: rgba(110, 90, 60, 0.07);
  --color-text: #29241e;
  --color-text-muted: #6f665a;
  --color-title: #2b4537;
  --color-accent: #2f5d45;
  --color-on-accent: #fffaf2;
  --color-danger: #b42318;
  --color-on-danger: #fffaf2;
  --color-danger-bg: #fbeae6;
  --color-success: #2f6b46;
  --color-success-bg: #e6f0e3;
  --color-bar: #2f4a3c;
  --color-bar-edge: #253c30;
  --color-on-bar: #f3ecdc;
  --color-highlight: #e9c46a;
  --shadow-panel: 0 1px 3px rgba(60, 40, 20, 0.08), inset 0 0 14px var(--color-stain);
  --font-brand: 'Uncial Antiqua', 'Alegreya SC', Georgia, serif;
  --font-head: 'Alegreya SC', Georgia, serif;
  --font-body: 'Alegreya Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 0.75rem;
  --radius-pill: 999px;
  --touch-target: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-bg: #1a1713;
    --color-surface: #24201b;
    --color-well: #302a23;
    --color-border: #4a4135;
    --color-divider: #302a23;
    --color-stain: rgba(0, 0, 0, 0.3);
    --color-text: #eee6d6;
    --color-text-muted: #aaa08f;
    --color-title: #e9c46a;
    --color-accent: #e9c46a;
    --color-on-accent: #1a1713;
    --color-danger: #f97066;
    --color-on-danger: #1a1713;
    --color-danger-bg: #2a1a19;
    --color-success: #7fc79b;
    --color-success-bg: #1a2a20;
    --color-bar: #18261f;
    --color-bar-edge: #111b16;
    --color-on-bar: #e6dfcd;
    --shadow-panel: inset 0 0 14px var(--color-stain);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.bar {
  background: var(--color-bar);
  border-bottom: 3px solid var(--color-highlight);
  box-shadow: inset 0 -1px 0 var(--color-bar-edge);
  color: var(--color-on-bar);
  padding: 0.75rem 1rem;
  text-align: center;
}

.brand {
  font-family: var(--font-brand);
  font-size: 1.6rem;
  color: var(--color-on-bar);
  text-decoration: none;
  letter-spacing: 0.02em;
}

main {
  flex: 1;
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

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

h1,
h2,
h3 {
  font-family: var(--font-head);
  color: var(--color-title);
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1.05rem;
  margin: 1rem 0 0.5rem;
}

p {
  margin: 0 0 0.75rem;
}

.muted,
.hint {
  color: var(--color-text-muted);
}

.hint {
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
}

label {
  display: block;
  font-weight: 500;
  margin: 0.9rem 0 0.3rem;
}

input[type='text'],
input[type='email'],
input[type='password'] {
  width: 100%;
  min-height: var(--touch-target);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.field-error {
  color: var(--color-danger);
  font-size: 0.95rem;
  margin: 0.3rem 0 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target);
  margin-top: 1.1rem;
  padding: 0.5rem 1.4rem;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.wide {
  width: 100%;
}

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

button.danger {
  border-color: var(--color-danger);
  background: transparent;
  color: var(--color-danger);
}

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

.links {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.links li {
  margin: 0.4rem 0;
}

.links a {
  display: inline-block;
  min-height: var(--touch-target);
  line-height: var(--touch-target);
}

.notice {
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
}

.notice.ok {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.notice.problem {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.facts {
  margin: 0;
}

.facts dt {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.facts dd {
  margin: 0 0 0.6rem;
  overflow-wrap: anywhere;
}

/* the career page: one panel per realm */
.realm-world {
  margin-top: -0.4rem;
}

.result {
  font-weight: 700;
}

/* the battle totals of a realm (1.5 statistics), one line under its facts */
.battles {
  margin: 0 0 0.6rem;
  font-variant-numeric: tabular-nums;
}

.result.won {
  color: var(--color-success);
}

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

@media (min-width: 26rem) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.badges li {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-well);
  padding: 0.2rem 0.7rem;
  font-size: 0.95rem;
}

.badges .level {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.badges li.level-3 {
  border-color: var(--color-highlight);
}

footer {
  padding: 1rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

footer a {
  display: inline-block;
  min-height: var(--touch-target);
  line-height: var(--touch-target);
  margin: 0 0.6rem;
  color: var(--color-text-muted);
}
