:root {
  --ink: #061827;
  --navy: #092b45;
  --panel: rgba(7, 30, 48, .9);
  --line: rgba(137, 197, 226, .18);
  --text: #eef9ff;
  --muted: #92acbb;
  --gold: #ffc857;
  --orange: #ff8f42;
  --cyan: #4ed8e8;
  --green: #4ad19b;
  --red: #ff7381;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(18, 125, 157, .24), transparent 35%),
    linear-gradient(118deg, rgba(3, 18, 31, .94) 0%, rgba(4, 28, 45, .78) 52%, rgba(3, 20, 33, .88) 100%),
    url("account-harbor-bg.jpg") center center / cover fixed no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .11;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
}

.sea-glow { position: fixed; width: 440px; height: 440px; border-radius: 50%; filter: blur(110px); opacity: .14; pointer-events: none; }
.sea-glow-one { left: -180px; bottom: -180px; background: var(--cyan); }
.sea-glow-two { right: -160px; top: 22%; background: var(--orange); }
.is-hidden { display: none !important; }

.topbar {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 58px; height: 52px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.brand span { display: grid; line-height: 1; }
.brand strong { font-size: 22px; letter-spacing: .06em; }
.brand small { margin-top: 7px; color: var(--gold); letter-spacing: .19em; font-size: 9px; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; transition: color .2s ease; }
.back-link:hover { color: var(--gold); }

.page-shell { position: relative; width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 70px; min-height: calc(100vh - 155px); }
.center-card { min-height: 60vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-layout { min-height: 650px; display: grid; place-items: center; }
.login-copy { min-width: 0; padding: 28px 0; }
.eyebrow, .section-kicker { display: block; color: var(--gold); letter-spacing: .22em; font-size: 11px; font-weight: 800; }
.account-hero { position: relative; isolation: isolate; overflow: hidden; max-width: 720px; padding: 44px; border: 1px solid rgba(137,197,226,.18); border-radius: 28px; background: linear-gradient(145deg, rgba(10,44,68,.72), rgba(5,25,40,.56)); box-shadow: 0 28px 80px rgba(0,0,0,.18); }
.account-hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--cyan), var(--gold) 48%, transparent 88%); }
.account-hero::after { content: ""; position: absolute; z-index: -1; width: 330px; height: 330px; right: -150px; top: -155px; border-radius: 50%; background: radial-gradient(circle, rgba(78,216,232,.13), transparent 68%); }
.hero-orbit { position: absolute; right: 38px; top: 38px; width: 72px; height: 72px; display: grid; place-items: center; border: 1px solid rgba(255,200,87,.24); border-radius: 50%; color: var(--gold); background: rgba(255,200,87,.05); }
.hero-orbit::before, .hero-orbit::after { content: ""; position: absolute; inset: 9px; border: 1px dashed rgba(78,216,232,.25); border-radius: 50%; }
.hero-orbit::after { inset: 27px; border-style: solid; background: rgba(78,216,232,.1); }
.hero-orbit span { position: relative; z-index: 1; color: var(--cyan); }
.hero-badge { width: max-content; display: flex; align-items: center; gap: 8px; margin-bottom: 28px; padding: 7px 12px; border: 1px solid rgba(78,216,232,.2); border-radius: 999px; color: #9edce4; background: rgba(78,216,232,.06); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.hero-badge span { color: var(--gold); font-size: 14px; }
.login-copy h1 { margin: 14px 0 16px; max-width: 600px; font-size: clamp(44px, 5vw, 68px); line-height: 1.02; letter-spacing: -.04em; }
.login-copy h1 em { color: var(--gold); font-style: normal; text-shadow: 0 0 32px rgba(255,145,66,.14); }
.account-hero > p { max-width: 530px; margin: 0; color: #acc3cf; font-size: 16px; line-height: 1.75; }
.account-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 30px; }
.account-features article { min-width: 0; padding: 16px 14px; border: 1px solid rgba(137,197,226,.13); border-radius: 15px; background: rgba(1,16,28,.32); }
.feature-icon { width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 9px; color: var(--cyan); background: rgba(78,216,232,.1); font-weight: 900; }
.account-features strong, .account-features small { display: block; }
.account-features strong { overflow: hidden; color: #dcecf4; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.account-features small { margin-top: 5px; color: #6f8f9f; font-size: 9px; line-height: 1.45; }
.hero-security { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 13px 15px; border: 1px solid rgba(74,209,155,.16); border-radius: 14px; background: rgba(74,209,155,.055); }
.hero-security > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #8ae4bd; background: rgba(74,209,155,.11); font-weight: 900; }
.hero-security strong, .hero-security small { display: block; }
.hero-security strong { color: #bfe9da; font-size: 11px; }
.hero-security small { margin-top: 3px; color: #719b91; font-size: 9px; }

.panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(10,40,62,.94), rgba(5,24,39,.93)); box-shadow: 0 24px 70px rgba(0,0,0,.28); border-radius: 22px; }
.login-panel { position: relative; width: min(100%, 520px); padding: 42px; overflow: hidden; }
.login-panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--gold), var(--orange), transparent); }
.panel-mark { position: absolute; right: 34px; top: 32px; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(255,200,87,.28); border-radius: 50%; color: var(--gold); background: rgba(255,200,87,.08); }
.login-panel h2, .security-copy h2 { margin: 8px 0 3px; font-size: 30px; }
.muted, .form-note { color: var(--muted); }
.form-note { margin: 16px 0 0; text-align: center; font-size: 11px; }
label { display: grid; gap: 8px; margin-top: 20px; }
label span { color: #c5d8e2; font-size: 13px; font-weight: 700; }
input {
  width: 100%;
  border: 1px solid rgba(137,197,226,.2);
  border-radius: 13px;
  outline: none;
  padding: 14px 15px;
  color: var(--text);
  font: inherit;
  background: rgba(1,15,26,.62);
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus { border-color: rgba(78,216,232,.65); box-shadow: 0 0 0 3px rgba(78,216,232,.1); }
.primary-button { width: 100%; margin-top: 22px; border: 0; border-radius: 13px; padding: 14px 18px; color: #142234; font: inherit; font-weight: 900; cursor: pointer; background: linear-gradient(135deg, var(--gold), var(--orange)); box-shadow: 0 10px 30px rgba(255,143,66,.2); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.alert { margin-top: 16px; padding: 11px 13px; border: 1px solid rgba(255,115,129,.35); border-radius: 11px; color: #ffc0c6; background: rgba(255,115,129,.1); font-size: 13px; }
.alert.is-success { border-color: rgba(74,209,155,.35); color: #a7f2d3; background: rgba(74,209,155,.1); }

.dashboard { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 34px; align-items: start; }
.account-nav { position: sticky; top: 24px; padding: 20px 14px; }
.player-badge { display: flex; align-items: center; gap: 12px; padding: 8px 8px 22px; border-bottom: 1px solid var(--line); }
.avatar { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; color: #13263a; background: linear-gradient(135deg, var(--gold), var(--orange)); font-size: 22px; }
.player-badge div:last-child { min-width: 0; display: grid; gap: 3px; }
.player-badge small, .player-badge span { color: var(--muted); font-size: 10px; }
.player-badge strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-nav nav { display: grid; gap: 6px; margin: 18px 0 70px; }
.nav-button, .logout-button { border: 0; text-align: left; color: var(--muted); background: transparent; border-radius: 12px; padding: 12px 13px; cursor: pointer; font: inherit; }
.nav-button span { display: inline-block; width: 25px; color: var(--cyan); }
.nav-button:hover, .nav-button.is-active { color: var(--text); background: rgba(78,216,232,.09); }
.nav-button.is-active { box-shadow: inset 3px 0 var(--cyan); }
.logout-button { width: 100%; color: #ff9ea8; border: 1px solid rgba(255,115,129,.18); text-align: center; }

.dashboard-content { min-width: 0; }
.dashboard-heading { min-height: 82px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dashboard-heading h1 { margin: 8px 0 0; font-size: clamp(29px, 4vw, 44px); }
.status-pill { border: 1px solid rgba(74,209,155,.24); border-radius: 999px; padding: 8px 13px; color: #8ae4bd; background: rgba(74,209,155,.08); font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin: 16px 0 34px; }
.stat-card { min-height: 142px; display: flex; flex-direction: column; justify-content: center; padding: 23px; border: 1px solid var(--line); border-radius: 18px; background: rgba(7,31,50,.72); }
.stat-card small { color: var(--muted); }
.stat-card strong { margin: 9px 0 4px; overflow: hidden; text-overflow: ellipsis; font-size: clamp(25px, 3vw, 38px); }
.stat-card span { color: #6f8c9b; font-size: 11px; }
.stat-card.accent { border-color: rgba(255,200,87,.3); background: linear-gradient(145deg, rgba(255,200,87,.12), rgba(7,31,50,.78)); }
.stat-card.accent strong { color: var(--gold); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 0 0 15px; }
.section-heading span { color: var(--cyan); font-size: 10px; letter-spacing: .16em; }
.section-heading h2 { margin: 4px 0 0; font-size: 21px; }
.ghost-button { border: 1px solid var(--line); border-radius: 10px; padding: 8px 13px; color: var(--muted); cursor: pointer; background: rgba(7,31,50,.5); }
.ghost-button:hover { color: var(--text); border-color: rgba(78,216,232,.45); }

.character-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.character-card { position: relative; overflow: hidden; min-height: 196px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(10,42,66,.86), rgba(5,25,40,.9)); }
.character-card::after { content: attr(data-server); position: absolute; right: 14px; bottom: -22px; color: rgba(255,255,255,.035); font-size: 96px; font-weight: 900; }
.character-top { display: flex; justify-content: space-between; gap: 14px; }
.server-tag { color: var(--gold); font-size: 11px; letter-spacing: .1em; }
.character-card h3 { margin: 8px 0 2px; font-size: 23px; }
.character-id { color: var(--muted); font-size: 11px; font-family: Consolas, monospace; }
.level-ring { width: 56px; height: 56px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; border: 2px solid rgba(78,216,232,.55); color: var(--cyan); font-weight: 900; background: rgba(78,216,232,.06); }
.character-meta { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 25px; }
.character-meta div { padding: 10px; border-radius: 11px; background: rgba(0,0,0,.16); }
.character-meta small { display: block; color: var(--muted); font-size: 9px; }
.character-meta strong { display: block; margin-top: 3px; font-size: 13px; }

.table-wrap { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 17px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-size: 10px; letter-spacing: .08em; background: rgba(255,255,255,.02); }
td { color: #c7dae4; }
.payment-status { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 10px; }
.payment-status.completed { color: #8ae4bd; background: rgba(74,209,155,.1); }
.payment-status.pending { color: #ff9ea8; background: rgba(255,115,129,.1); }
.payment-status.cancelled, .payment-status.expired { color: #ff9ea8; background: rgba(255,115,129,.1); }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }
.table-wrap .empty-state { border: 0; }

.security-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(360px, 1fr); gap: 18px; }
.security-copy, .password-panel { padding: 30px; }
.security-copy p, .security-copy li { color: var(--muted); line-height: 1.75; }
.security-copy ul { padding-left: 20px; }

footer { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 32px; color: #5d7887; border-top: 1px solid var(--line); text-align: center; font-size: 11px; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; gap: 10px; }
  .login-copy { padding: 25px 0 10px; }
  .account-hero { max-width: none; }
  .login-copy h1 { font-size: 54px; }
  .dashboard { grid-template-columns: 1fr; }
  .account-nav { position: static; }
  .account-nav nav { grid-template-columns: repeat(3, 1fr); margin: 18px 0; }
  .nav-button { text-align: center; font-size: 12px; }
  .nav-button span { display: block; width: auto; margin-bottom: 5px; }
  .security-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar, .page-shell, footer { width: min(100% - 24px, 1280px); }
  .topbar { min-height: 72px; }
  .brand img { width: 44px; height: 42px; }
  .brand strong { font-size: 17px; }
  .back-link { font-size: 12px; }
  .page-shell { padding-top: 22px; }
  .account-hero { padding: 28px 22px; border-radius: 22px; }
  .hero-orbit { right: 22px; top: 24px; width: 58px; height: 58px; }
  .login-copy h1 { font-size: 42px; }
  .account-hero > p { font-size: 14px; }
  .account-features { grid-template-columns: 1fr; }
  .account-features article { display: flex; align-items: center; gap: 12px; }
  .feature-icon { flex: 0 0 auto; margin: 0; }
  .login-panel { padding: 29px 22px; }
  .stat-grid, .character-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 116px; }
  .dashboard-heading { align-items: center; }
  .account-nav nav { overflow-x: auto; grid-template-columns: repeat(3, minmax(110px, 1fr)); }
  .table-wrap { overflow-x: auto; }
  table { min-width: 680px; }
}
