/* The English Navy — zero external dependencies, no imported fonts. */

:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --brass: #c9a227;
  --ink: #0a0f1a;
  --paper: #f4f1e8;
  --paper-2: #fbfaf5;
  --line: #d9d3c2;
  --danger: #9b2226;
  --ok: #1b5e20;
  --header-bg: #0b2545;
  --header-text: #f4f1e8;
  --nav-hover: rgba(255, 255, 255, 0.12);
  --input-bg: #fff;
  --primary-bg: #0b2545;
  --primary-text: #fff;
  --code-bg: #ece7d6;
  --alert-error-bg: #f8d7da;
  --alert-error-border: #f1aeb5;
  --alert-ok-bg: #d7f0d9;
  --alert-ok-border: #a6d9ac;
  --shadow: 0 10px 30px rgba(11, 37, 69, 0.18);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="sun"]) {
    --navy: #9ec5ff;
    --navy-2: #c4d4ea;
    --brass: #b98a00;
    --ink: #f5efe0;
    --paper: #030912;
    --paper-2: #091426;
    --line: #1e3452;
    --danger: #ffb4ba;
    --ok: #9bd89f;
    --header-bg: #020a14;
    --header-text: #f5efe0;
    --nav-hover: rgba(255, 255, 255, 0.14);
    --input-bg: #061120;
    --primary-bg: #b98a00;
    --primary-text: #050914;
    --code-bg: #172943;
    --alert-error-bg: #45191d;
    --alert-error-border: #753037;
    --alert-ok-bg: #173c20;
    --alert-ok-border: #316a3d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="moon"] {
  --navy: #9ec5ff;
  --navy-2: #c4d4ea;
  --brass: #b98a00;
  --ink: #f5efe0;
  --paper: #030912;
  --paper-2: #091426;
  --line: #1e3452;
  --danger: #ffb4ba;
  --ok: #9bd89f;
  --header-bg: #020a14;
  --header-text: #f5efe0;
  --nav-hover: rgba(255, 255, 255, 0.14);
  --input-bg: #061120;
  --primary-bg: #b98a00;
  --primary-text: #050914;
  --code-bg: #172943;
  --alert-error-bg: #45191d;
  --alert-error-border: #753037;
  --alert-ok-bg: #173c20;
  --alert-ok-border: #316a3d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 100%);
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--header-bg);
  color: var(--header-text);
  padding: 8px 12px;
  border-radius: 0 0 8px 0;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 4px solid var(--brass);
}

.site-header .bar {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--header-text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand .crest {
  width: 34px;
  height: 34px;
  flex: none;
}

.brand .name {
  font-size: 1.15rem;
}

.nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav a {
  color: var(--header-text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.nav a:hover,
.nav a:focus {
  background: var(--nav-hover);
}

.nav a.active {
  background: var(--brass);
  color: var(--ink);
}

.nav-user {
  color: var(--header-text);
  font-size: 0.88rem;
  font-weight: 700;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  color: var(--header-text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  justify-content: center;
  min-height: 34px;
  padding: 7px;
  width: 34px;
}

.theme-toggle:hover,
.theme-toggle:focus {
  background: var(--nav-hover);
}

.badge-mock {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--brass);
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 999px;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

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

.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 8px;
  color: var(--navy);
}

.hero p {
  font-size: 1.1rem;
  color: var(--navy-2);
  max-width: 640px;
  margin: 0 auto 24px;
}

.hero-actions,
.account-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.account-home {
  text-align: center;
}

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 460px;
  margin: 0 auto;
}

.card h2 {
  margin: 0 0 4px;
  color: var(--navy);
}

.card .subtitle {
  margin: 0 0 20px;
  color: var(--navy-2);
}

.field {
  margin-bottom: 16px;
  text-align: left;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--navy-2);
}

.field input,
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--brass);
  border-color: var(--brass);
}

.field .error {
  color: var(--danger);
  font-size: 0.86rem;
  margin-top: 6px;
  min-height: 1em;
}

.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  padding: 12px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: transform 0.05s ease, filter 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary-bg);
  color: var(--primary-text);
  width: 100%;
}

.btn-primary:hover {
  filter: brightness(1.12);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--navy);
}

.btn-brass {
  background: var(--brass);
  color: var(--ink);
}

.form-foot {
  margin-top: 16px;
  text-align: center;
  color: var(--navy-2);
}

.form-foot a {
  color: var(--navy);
  font-weight: 700;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
}

.alert-error {
  background: var(--alert-error-bg);
  color: var(--danger);
  border: 1px solid var(--alert-error-border);
}

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

.alert-dismissible {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  text-align: left;
}

.alert-dismiss {
  align-items: center;
  background: transparent;
  border: 0;
  color: currentColor;
  cursor: pointer;
  display: inline-flex;
  flex: none;
  justify-content: center;
  padding: 2px;
}

.alert-dismiss:hover,
.alert-dismiss:focus {
  filter: brightness(0.8);
}

.welcome {
  text-align: center;
}

.settings-card {
  max-width: 560px;
}

.settings-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.settings-section + .settings-section {
  margin-top: 24px;
}

.settings-section h3 {
  color: var(--navy);
  margin: 0 0 14px;
}

.welcome .crest-lg {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
}

.invite-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 20px 0;
  padding: 18px 0;
  text-align: left;
}

.invite-panel h3 {
  color: var(--navy);
  margin: 0 0 4px;
}

.invite-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 14px 0;
}

.invite-controls label {
  color: var(--navy-2);
  font-weight: 600;
}

.invite-controls input {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
}

.invite-list {
  list-style: none;
  margin: 12px 0 0;
  max-height: 180px;
  overflow: auto;
  padding: 0;
}

.invite-list li {
  border-top: 1px solid var(--line);
  color: var(--navy-2);
  padding: 8px 0;
}

.invite-row {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.invite-code-meta {
  min-width: 0;
}

.invite-list code {
  background: var(--code-bg);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 700;
  padding: 2px 6px;
}

.copy-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  flex: none;
  justify-content: center;
  padding: 6px;
}

.copy-button:hover,
.copy-button:focus {
  background: var(--code-bg);
}

.copy-buffer {
  left: -9999px;
  position: fixed;
  top: 0;
}

.invite-status {
  min-height: 1.2em;
}

.muted {
  color: var(--navy-2);
  font-size: 0.92rem;
}

.mock-note {
  margin-top: 28px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--navy-2);
}

.mock-note code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 520px) {
  .hero h1 {
    font-size: 1.9rem;
  }
  .nav a {
    padding: 8px;
  }
}
