:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f2f4f8;
  background: #0b111b;
  --surface: #111b28;
  --line: #2b394a;
  --muted: #aebcce;
  --accent: #f5bc79;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 48% 0%, #172638 0%, #0b111b 65%); }
.site-header, main { width: min(100%, 1168px); margin-inline: auto; padding-inline: 1.5rem; }
.site-header { min-height: 76px; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.site-header nav, .site-brand { display: flex; align-items: center; gap: .75rem; }
.site-header nav a { color: var(--muted); text-decoration: none; padding-block: .65rem; font-size: .875rem; }
.site-header nav a:hover { color: #fff; }
.site-brand { color: #f2f4f8; font-weight: 700; text-decoration: none; white-space: nowrap; }
.account-info { max-width: 16rem; overflow: hidden; color: var(--muted); font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid #765a41; border-radius: 9px; color: var(--accent); background: #2c2630; font-size: .8125rem; font-weight: 800; letter-spacing: .08em; }
main { padding-block: 1.2rem 3rem; }
a { color: var(--accent); font-weight: 700; }
h2, h3 { margin: 0 0 .8rem; }
h3 { font-size: 1rem; }
p { color: var(--muted); }
section { min-width: 0; padding: 1.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; }
form { display: grid; gap: .8rem; }
label, input, textarea { display: block; width: 100%; }
input, textarea { font: inherit; padding: .55rem .65rem; margin-top: .25rem; border: 1px solid var(--line); border-radius: .45rem; background: #0b131e; }
textarea { resize: vertical; }
button { cursor: pointer; font: inherit; font-weight: 650; width: fit-content; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: .45rem; background: var(--accent); color: #221608; }
button:disabled { opacity: .45; cursor: default; }
.secondary, button[aria-pressed="false"] { color: #f2f4f8; background: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: stretch;
  padding: 0;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 26px 68px #0005;
}
.auth-hero {
  display: grid;
  align-content: end;
  min-height: 490px;
  padding: clamp(1.5rem, 4.8vw, 3.75rem);
  background: linear-gradient(0deg, #09111ef5, #0b162943 63%, transparent),
    #182c42 url('./clan-valley.webp') 65% center / cover no-repeat;
}
.hero-copy::before { content: ''; display: block; width: 46px; height: 3px; margin-bottom: 1.15rem; border-radius: 2px; background: var(--accent); }
.hero-copy h1 { margin: 0; font-size: clamp(2.5rem, 4.6vw, 4.5rem); line-height: 1.1; letter-spacing: .025em; }
.hero-copy p { max-width: 28em; margin: 1rem 0 0; color: #d5deea; font-size: clamp(.875rem, 1.35vw, 1rem); }
.auth-card { min-width: 0; align-self: center; padding: clamp(1.5rem, 4.1vw, 3.25rem); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; background: #0b131e; border: 1px solid var(--line); border-radius: .75rem; }
.auth-tabs button { width: 100%; min-height: 40px; border: 1px solid transparent; border-radius: .5rem; color: var(--muted); background: transparent; }
.auth-tabs button[aria-selected="true"] { border-color: #485362; color: #f8dbb7; background: #263140; }
.auth-tabs button:hover:not(:disabled) { color: #fff; }
.auth-panel { padding-top: 1.65rem; }
.auth-panel h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); margin-bottom: 1.35rem; line-height: 1.25; }
.auth-panel form { gap: 0; }
.auth-panel label { margin-bottom: .4rem; font-size: .875rem; font-weight: 650; }
.auth-panel input { margin-top: 0; min-height: 49px; padding-inline: .875rem; border-color: #3a4a5d; border-radius: .65rem; }
.auth-panel input::placeholder { color: #8393a7; }
.auth-panel label:not(:first-child) { margin-top: .9rem; }
.password-field { position: relative; }
.password-field input { padding-inline-end: 4.2rem; }
.password-field .password-toggle { position: absolute; inset: 0 .25rem 0 auto; min-width: 3.5rem; border: 0; background: transparent; color: #c9d4e3; font-size: .875rem; }
.password-field .password-toggle:hover { color: #fff; }
.auth-hint { margin: .45rem 0 0; font-size: .8125rem; }
.signin-hint { margin-top: 1rem; }
.signin-hint code { color: #f8dbb7; }
.auth-submit { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-height: 49px; margin-top: 1.25rem; padding-inline: 1rem; border: 0; border-radius: .65rem; background: linear-gradient(100deg, #f8cb8e, #f0ab66); color: #221608; font-weight: 750; }
.auth-submit:hover:not(:disabled) { background: #f9cb8d; }
.auth-submit span { font-size: 1.2rem; line-height: 1; }
.notice { margin: 0 0 1rem; padding: .75rem; border: 1px solid #665240; border-radius: .65rem; color: var(--accent); background: #2a2425; overflow-wrap: anywhere; }
.notice[data-error] { border-color: #804b4d; color: #ffb9ac; }
.auth-card .notice { margin: .85rem 0 0; font-size: .875rem; }

.dashboard-heading { margin: .5rem 0 1.4rem; font-size: clamp(2rem, 5vw, 3rem); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1rem; align-items: start; }
.guest-layout { grid-template-columns: minmax(0, 1fr); margin-top: 1.5rem; }
#leaderboard { scroll-margin-top: 1rem; }
#history { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.clan-summary { display: grid; gap: .35rem; margin-bottom: 1rem; }
.clan-summary p { margin: 0; }
.clan-summary-name { color: #f2f4f8; font-size: 1.05rem; font-weight: 700; }
.clan-summary-tag { color: var(--accent); font-size: .9rem; font-weight: 600; }
.clan-summary-description { color: var(--muted); }
.clan-summary #edit-profile { margin-top: .35rem; }

#invites, #members, .referee { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
#code { margin-bottom: .5rem; }
ul { list-style: none; margin: 0 0 .75rem; padding: 0; }
li { padding: .4rem 0; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
li span { overflow-wrap: anywhere; }
li button { flex: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; text-align: left; border-collapse: collapse; overflow-wrap: anywhere; }
th, td { padding: .45rem .3rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); }
.row-link { padding: 0; border: 0; color: var(--accent); background: transparent; text-align: left; }

@media (max-width: 760px) {
  .site-header, main { padding-inline: .85rem; }
  .account-info { max-width: 8.5rem; }
  .site-header { min-height: 60px; }
  main { padding-top: .3rem; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  section { padding: .85rem; }
  .auth-shell { grid-template-columns: minmax(0, 1fr); padding: 0; border-radius: 1.15rem; }
  .auth-hero { min-height: 180px; padding: 1.15rem; background-position: center, 65% 40%; }
  .hero-copy::before { width: 32px; margin-bottom: .65rem; }
  .hero-copy h1 { font-size: clamp(2rem, 7.6vw, 3rem); }
  .hero-copy p { margin-top: .55rem; }
  .auth-card { padding: 1.15rem; }
  .auth-panel { padding-top: 1.25rem; }
  .auth-panel h2 { margin-bottom: 1rem; }
  .auth-tabs button { min-height: 44px; }
  .guest-layout { margin-top: 1rem; }
}
