:root {
  --kingdom-navy: #071426;
  --kingdom-blue: #102b50;
  --kingdom-blue-soft: #183b67;
  --kingdom-gold: #e3b85e;
  --kingdom-gold-bright: #ffd98a;
  --kingdom-paper: #f4e5bf;
  --kingdom-paper-deep: #d8bd82;
  --kingdom-ink: #2b1b0e;
  --kingdom-line: rgba(227, 184, 94, 0.38);
}

.kingdom-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(32, 76, 128, 0.6), transparent 34rem),
    linear-gradient(180deg, #06101f 0%, #08182c 52%, #050b15 100%);
  color: #f8edd2;
}

.kingdom-page .site-header {
  background: rgba(4, 12, 24, 0.93);
  border-bottom: 1px solid var(--kingdom-line);
  backdrop-filter: blur(14px);
}

.kingdom-page .site-footer {
  background: #040b14;
  border-top: 1px solid var(--kingdom-line);
}

.kingdom-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0 72px;
}

.kingdom-hero {
  position: relative;
  overflow: hidden;
  padding: 42px 24px 38px;
  border: 1px solid var(--kingdom-line);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(8, 23, 44, 0.92), rgba(13, 40, 75, 0.88)),
    radial-gradient(circle at 75% 15%, rgba(255, 217, 138, 0.2), transparent 24rem);
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.42), inset 0 0 60px rgba(18, 60, 108, 0.28);
}

.kingdom-hero::before,
.kingdom-hero::after {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(227, 184, 94, 0.18);
  border-radius: 50%;
  transform: rotate(28deg);
}

.kingdom-hero::before { right: -80px; top: -92px; }
.kingdom-hero::after { left: -130px; bottom: -145px; }

.kingdom-crest {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border: 2px solid var(--kingdom-gold);
  border-radius: 22px 22px 32px 32px;
  color: var(--kingdom-gold-bright);
  font-family: Georgia, serif;
  font-size: 29px;
  font-weight: 900;
  background: linear-gradient(145deg, #17365f, #08162b);
  box-shadow: inset 0 0 0 4px rgba(227, 184, 94, 0.08), 0 10px 24px rgba(0, 0, 0, 0.28);
}

.kingdom-kicker {
  margin: 0 0 8px;
  color: var(--kingdom-gold);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.kingdom-hero h1 {
  margin: 0;
  max-width: 760px;
  color: #fff7e7;
  font-size: clamp(36px, 7vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.kingdom-hero .lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: #e8dcc2;
  font-size: clamp(16px, 2.2vw, 21px);
  line-height: 1.75;
}

.kingdom-motto {
  display: inline-flex;
  margin-top: 22px;
  padding: 10px 16px;
  border: 1px solid rgba(227, 184, 94, 0.35);
  border-radius: 999px;
  color: var(--kingdom-gold-bright);
  background: rgba(1, 7, 15, 0.44);
  font-weight: 800;
}

.kingdom-notice-space { margin-top: 18px; }

.kingdom-panel,
.kingdom-card {
  border: 1px solid var(--kingdom-line);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(17, 42, 76, 0.96), rgba(7, 20, 38, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.25);
}

.kingdom-panel {
  margin-top: 22px;
  padding: 22px;
}

.kingdom-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.kingdom-session strong { color: #fff4d8; }
.kingdom-session p { margin: 4px 0 0; color: #b7c8dc; }

.kingdom-auth-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

.kingdom-auth-providers {
  display: grid;
  gap: 12px;
}

.kingdom-provider {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(227, 184, 94, 0.3);
  border-radius: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
  cursor: pointer;
}

.kingdom-provider:hover { background: rgba(255, 255, 255, 0.11); }
.kingdom-provider-line { border-color: rgba(58, 214, 118, 0.45); }

.kingdom-email-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.2);
}

.kingdom-page .field span { color: #f6e7c4; }
.kingdom-page .field input {
  border-color: rgba(227, 184, 94, 0.25);
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.kingdom-page .field input::placeholder { color: #8ca0ba; }

.kingdom-page .btn-primary {
  border-color: #e8c36f;
  color: #1c1205;
  background: linear-gradient(180deg, #f5d990, #d9a943);
}
.kingdom-page .btn-ghost {
  border-color: rgba(227, 184, 94, 0.34);
  color: #f8e8c4;
  background: rgba(255, 255, 255, 0.04);
}

.kingdom-dashboard {
  display: grid;
  gap: 20px;
  margin-top: 22px;
}

.kingdom-profile-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.kingdom-profile-card::after {
  content: '';
  position: absolute;
  right: -80px;
  top: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227, 184, 94, 0.16), transparent 67%);
}

.kingdom-profile-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.kingdom-avatar {
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 2px solid var(--kingdom-gold);
  border-radius: 24px;
  color: var(--kingdom-gold-bright);
  background: linear-gradient(145deg, #1c4478, #07152a);
  font-size: 34px;
  box-shadow: inset 0 0 0 5px rgba(227, 184, 94, 0.07);
}

.kingdom-profile-name {
  margin: 0;
  color: #fff5dc;
  font-size: clamp(26px, 5vw, 42px);
}

.kingdom-profile-meta {
  margin: 5px 0 0;
  color: #b8c8da;
}

.kingdom-level-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.kingdom-level-row strong {
  color: var(--kingdom-gold-bright);
  font-size: 28px;
}

.kingdom-exp-track {
  height: 18px;
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid rgba(227, 184, 94, 0.28);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.kingdom-exp-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f74bf, #6eb7ff 55%, #f1ca74);
  box-shadow: 0 0 20px rgba(110, 183, 255, 0.45);
  transition: width 0.7s ease;
}

.kingdom-exp-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: #b8c8da;
  font-size: 14px;
}

.kingdom-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kingdom-stat {
  padding: 16px;
}

.kingdom-stat span {
  display: block;
  color: #aebfd2;
  font-size: 13px;
}
.kingdom-stat strong {
  display: block;
  margin-top: 6px;
  color: #fff1cf;
  font-size: 22px;
}
.kingdom-stat small { color: #8096af; }

.kingdom-lower-grid {
  display: grid;
  gap: 20px;
}

.kingdom-qr-card,
.kingdom-ledger-card { padding: 22px; }

.kingdom-qr-wrap {
  width: 210px;
  max-width: 100%;
  margin: 18px auto 0;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
}

.kingdom-qr-wrap canvas,
.kingdom-qr-wrap img { width: 100% !important; height: auto !important; display: block; }

.kingdom-qr-help {
  margin: 12px 0 0;
  color: #aebfd2;
  text-align: center;
  font-size: 14px;
}

.kingdom-ledger-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.kingdom-ledger-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(227, 184, 94, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}
.kingdom-ledger-item p { margin: 3px 0 0; color: #8fa4bc; font-size: 13px; }
.kingdom-ledger-exp { color: #8bd3ff; font-weight: 900; }
.kingdom-ledger-exp.is-negative { color: #ff9b8e; }

.kingdom-create-layout {
  display: grid;
  gap: 20px;
  margin-top: 22px;
}

.kingdom-form-card { padding: 22px; }
.kingdom-section-title { margin: 0 0 6px; color: #fff1ce; }
.kingdom-section-help { margin: 0 0 16px; color: #aebfd2; }

.kingdom-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kingdom-choice {
  position: relative;
  display: block;
  cursor: pointer;
}
.kingdom-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.kingdom-choice-body {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(227, 184, 94, 0.2);
  border-radius: 16px;
  color: #dbe7f4;
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}
.kingdom-choice-icon { color: var(--kingdom-gold-bright); font-size: 30px; }
.kingdom-choice input:checked + .kingdom-choice-body {
  border-color: var(--kingdom-gold-bright);
  background: linear-gradient(145deg, rgba(38, 88, 145, 0.65), rgba(21, 48, 85, 0.92));
  box-shadow: inset 0 0 0 2px rgba(255, 217, 138, 0.13), 0 0 22px rgba(227, 184, 94, 0.12);
}

.kingdom-class-grid { display: grid; gap: 12px; }
.kingdom-class .kingdom-choice-body {
  min-height: 130px;
  align-items: flex-start;
  text-align: left;
}
.kingdom-class strong { color: #fff0c9; font-size: 18px; }
.kingdom-class small { color: #aebfd2; line-height: 1.5; }

.kingdom-preview {
  padding: 22px;
  text-align: center;
}
.kingdom-preview .kingdom-avatar { margin: 0 auto 14px; }
.kingdom-preview h2 { margin: 0; color: #fff1cf; }
.kingdom-preview p { color: #aebfd2; }

.kingdom-empty-state {
  padding: 30px 22px;
  text-align: center;
}
.kingdom-empty-state h2 { color: #fff1cf; }
.kingdom-empty-state p { color: #aebfd2; }

.kingdom-page [hidden] { display: none !important; }

@media (min-width: 760px) {
  .kingdom-shell { padding-top: 38px; }
  .kingdom-hero { padding: 56px; }
  .kingdom-auth-grid { grid-template-columns: 0.85fr 1.15fr; }
  .kingdom-dashboard { grid-template-columns: 1.4fr 0.8fr; }
  .kingdom-profile-card { padding: 30px; }
  .kingdom-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-column: 1 / -1; }
  .kingdom-lower-grid { grid-template-columns: 0.8fr 1.2fr; grid-column: 1 / -1; }
  .kingdom-create-layout { grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr); align-items: start; }
  .kingdom-choice-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kingdom-class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kingdom-preview { position: sticky; top: 24px; }
}
