/* Galaxy Anchor — ruang kemudi. Navy laut dalam + kuningan jangkar. */
:root {
  --abyss: #0E1630;
  --hull: #162042;
  --hull-2: #1C2850;
  --rope: #2B3A66;
  --star: #E8ECF8;
  --mist: #9AA6C8;
  --brass: #D9B45A;
  --brass-dim: #A88A3E;
  --sea: #4FC3A1;
  --signal: #E2585B;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --radius: 6px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--abyss);
  /* bintang tipis di latar, tanpa gambar eksternal */
  background-image: radial-gradient(1px 1px at 12% 18%, #ffffff30 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 8%, #ffffff26 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 62%, #ffffff20 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 84%, #ffffff1c 50%, transparent 51%);
  background-attachment: fixed;
  color: var(--star); font: 16px/1.55 var(--sans);
}
a { color: var(--brass); text-underline-offset: 3px; }
a:hover { color: #F0CF7A; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: .005em; line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.4rem); margin: 0 0 .35rem; }
h2 { font-size: 1.35rem; margin: 0 0 .75rem; }
p { margin: 0 0 .9rem; max-width: 68ch; }
code { font-size: .9em; background: var(--hull-2); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
small, .hint, .meta, .fine { color: var(--mist); font-size: .875rem; }

/* ── Kerangka ── */
body.has-nav { display: grid; grid-template-columns: 232px 1fr; }
.nav {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.5rem 1.1rem; border-right: 1px solid var(--rope); background: #0B1228;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--star); text-decoration: none; font-family: var(--serif); font-size: 1.2rem; }
.nav nav { display: flex; flex-direction: column; gap: .15rem; }
.nav nav a { color: var(--mist); text-decoration: none; padding: .5rem .75rem; border-radius: var(--radius); border-left: 2px solid transparent; }
.nav nav a:hover { color: var(--star); background: var(--hull); }
.nav nav a.is-active { color: var(--star); border-left-color: var(--brass); background: var(--hull); }
.me { margin-top: auto; display: flex; align-items: center; gap: .55rem; font-size: .9rem; flex-wrap: wrap; }
.me img { border-radius: 50%; }
.me span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 2.25rem clamp(1rem, 4vw, 3rem) 4rem; max-width: 980px; width: 100%; }

/* ── Kepala halaman + suar status (elemen khas) ── */
.page-head { display: flex; align-items: center; gap: 1.4rem; margin-bottom: 1.75rem; }
.page-head.plain { display: block; }
.lead { color: var(--mist); font-size: 1.05rem; }
.crumb { margin: 0 0 .25rem; font-size: .9rem; }
.beacon { flex: none; width: 76px; height: 76px; border-radius: 50%; border: 2px solid var(--brass); display: grid; place-items: center; position: relative; }
.beacon::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1px dashed var(--brass-dim); }
.beacon span { width: 22px; height: 22px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 18px var(--signal); }
.beacon.is-on span { background: var(--sea); box-shadow: 0 0 18px var(--sea); }
@media (prefers-reduced-motion: no-preference) {
  .beacon.is-on::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--sea); animation: ping 1.8s ease-out 2; opacity: 0; }
  @keyframes ping { from { transform: scale(1); opacity: .7; } to { transform: scale(1.45); opacity: 0; } }
}

/* ── Statistik: satu baris instrumen, bukan kartu-kartu ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 0 0 .5rem; border-block: 1px solid var(--rope); }
.stats > div { padding: .9rem 1rem; border-left: 1px solid var(--rope); }
.stats > div:first-child { border-left: 0; }
.stats dt { color: var(--mist); font-size: .85rem; }
.stats dd { margin: .15rem 0 0; font-family: var(--serif); font-size: 1.45rem; }

/* ── Bagian ── */
.panel { padding-top: 1.5rem; margin-top: 2rem; border-top: 1px solid var(--rope); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.panel-danger h2 { color: #F2A3A4; }
.jump { display: flex; gap: .4rem; flex-wrap: wrap; margin: -.5rem 0 0; }
.jump a { padding: .3rem .75rem; border: 1px solid var(--rope); border-radius: 999px; text-decoration: none; font-size: .9rem; }

/* ── Form ── */
.form { display: grid; gap: 1rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.field { display: grid; gap: .35rem; margin: 0; min-width: 0; }
.field > label, legend { font-weight: 600; font-size: .95rem; }
fieldset.field { border: 0; padding: 0; }
input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--star); background: var(--hull);
  border: 1px solid var(--rope); border-radius: var(--radius); padding: .55rem .7rem;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brass); outline: none; box-shadow: 0 0 0 3px #D9B45A33; }
select option:disabled { color: #66708f; }
.num { display: flex; align-items: center; gap: .5rem; }
.num input { max-width: 9rem; }
.num span { color: var(--mist); font-size: .9rem; }

.field-toggle { display: flex; align-items: flex-start; gap: .75rem; }
.field-toggle label { display: grid; gap: .1rem; font-weight: 500; cursor: pointer; }
.switch { appearance: none; flex: none; width: 2.6rem; height: 1.5rem; margin: 0; border-radius: 999px; background: var(--rope); position: relative; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: var(--star); transition: transform .15s; }
.switch:checked { background: var(--sea); }
.switch:checked::after { transform: translateX(1.1rem); }

.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .3rem .9rem; max-height: 240px; overflow: auto; padding: .6rem .75rem; background: var(--hull); border: 1px solid var(--rope); border-radius: var(--radius); }
.checklist label { display: flex; gap: .45rem; align-items: center; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input[type=checkbox] { accent-color: var(--brass); width: 1rem; height: 1rem; }

.actions, .maint { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.maint { flex-direction: column; align-items: stretch; gap: 1.1rem; }
.maint form { display: grid; gap: .3rem; justify-items: start; }

/* ── Tombol ── */
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; justify-self: start;
  padding: .6rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--brass);
  background: var(--brass); color: #1A1406;
}
.btn:hover { background: #E6C46E; color: #1A1406; }
.btn-quiet { background: transparent; color: var(--brass); }
.btn-quiet:hover { background: #D9B45A1A; color: #F0CF7A; }
.btn-danger { background: transparent; color: #F2A3A4; border-color: var(--signal); }
.btn-danger:hover { background: #E2585B22; color: #F7C1C2; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-discord { background: #5865F2; border-color: #5865F2; color: #fff; padding: .8rem 1.4rem; }
.btn-discord:hover { background: #4752C4; color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--mist); font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer; }
button.link:hover { color: var(--star); }

/* ── Pesan ── */
.notice { padding: .7rem 1rem; border-radius: var(--radius); border-left: 3px solid; background: var(--hull); max-width: none; }
.notice-ok { border-color: var(--sea); }
.notice-error { border-color: var(--signal); }
.empty { color: var(--mist); padding: 2rem 0; }

/* ── Tabel model ── */
.table-wrap { overflow-x: auto; }
.models { width: 100%; border-collapse: collapse; font-size: .95rem; }
.models th { text-align: left; color: var(--mist); font-weight: 500; padding: .5rem .6rem; border-bottom: 1px solid var(--rope); }
.models td { padding: .55rem .6rem; border-bottom: 1px solid #2B3A6688; vertical-align: middle; }
.models tr.is-off td { color: #6F7AA0; }
.models tr.is-current td:first-child { box-shadow: inset 2px 0 0 var(--brass); }
.tag { font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; border: 1px solid var(--brass-dim); color: var(--brass); margin-left: .3rem; }
.tag-off { border-color: var(--rope); color: var(--mist); }
progress { width: 110px; height: .5rem; vertical-align: middle; margin-right: .5rem; appearance: none; border: 0; border-radius: 999px; background: var(--rope); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--rope); }
progress::-webkit-progress-value { background: var(--brass); }
progress::-moz-progress-bar { background: var(--brass); }

/* ── Jawaban uji AI ── */
.answer { margin-top: 1.25rem; padding: 1rem 1.15rem; border-left: 2px solid var(--brass); background: var(--hull); border-radius: 0 var(--radius) var(--radius) 0; }
.answer-text { white-space: normal; overflow-wrap: anywhere; max-width: 72ch; }

/* ── Daftar server ── */
.guilds { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.guilds a { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: .9rem; align-items: center; padding: .75rem; border-radius: var(--radius); text-decoration: none; color: var(--star); border: 1px solid transparent; }
.guilds a:hover { background: var(--hull); border-color: var(--rope); }
.guilds img, .guild-initial { grid-row: span 2; width: 48px; height: 48px; border-radius: 14px; }
.guild-initial { display: grid; place-items: center; background: var(--hull-2); color: var(--brass); font-family: var(--serif); font-size: 1.3rem; }
.guild-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-meta { color: var(--mist); font-size: .85rem; }

.reward-list { list-style: none; padding: 0; margin: 0 0 1.25rem; border-top: 1px solid #2B3A6688; }
.reward-list li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid #2B3A6688; }
.reward-role { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reward-add { padding: 1rem; background: var(--hull); border-radius: var(--radius); margin-bottom: 1rem; }
.lvl { display: inline-block; min-width: 5.5rem; color: var(--brass); font-variant-numeric: tabular-nums; }

.checks { display: grid; gap: 0; margin: 0; }
.checks > div { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid #2B3A6688; }
.checks dt { color: var(--mist); }
.checks dd { margin: 0; }
.checks .ok dd::before { content: "● "; color: var(--sea); }
.checks .bad dd::before { content: "● "; color: var(--signal); }
.steps { padding-left: 1.2rem; display: grid; gap: .5rem; max-width: 72ch; }

/* ── Halaman masuk ── */
body.is-login { display: grid; place-items: center; }
body.is-login .main { max-width: 440px; }
.login { text-align: center; display: grid; justify-items: center; gap: .25rem; }
.login-mark { margin-bottom: .5rem; }
.login h1 { font-size: 2.2rem; }
.login .btn { margin: 1rem 0 1.25rem; justify-self: center; }

/* ── Layar kecil ── */
@media (max-width: 760px) {
  body.has-nav { display: block; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .8rem 1rem; border-right: 0; border-bottom: 1px solid var(--rope); }
  .nav nav { flex-direction: row; flex-wrap: wrap; order: 3; width: 100%; }
  .nav nav a { border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: .4rem .6rem; }
  .nav nav a.is-active { border-bottom-color: var(--brass); background: none; }
  .me { margin: 0 0 0 auto; }
  .me span { display: none; }
  .page-head { align-items: flex-start; }
  .beacon { width: 56px; height: 56px; }
  .checks > div { grid-template-columns: 1fr; gap: .2rem; }
}
