:root {
  color-scheme: dark;
  --bg: #0c1116;
  --panel: #131b22;
  --panel-2: #18242c;
  --line: #2a3942;
  --text: #f1f5f6;
  --muted: #91a2aa;
  --cyan: #42d7e8;
  --yellow: #f6c85f;
  --coral: #f06a5e;
  --green: #62d59a;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.site-header { position: sticky; top: 0; z-index: 20; height: 58px; border-bottom: 1px solid var(--line); background: rgba(10, 15, 19, .94); backdrop-filter: blur(14px); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: baseline; gap: 8px; letter-spacing: 0; }
.brand span { color: var(--cyan); font-weight: 900; }
.brand strong { font-size: 14px; letter-spacing: 0; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.server-pill { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.server-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.server-pill.is-online i { background: var(--green); box-shadow: 0 0 12px rgba(98, 213, 154, .7); }
.server-pill.is-offline i { background: var(--coral); }

.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; padding: 0 15px; color: var(--text); background: transparent; text-decoration: none; font-weight: 750; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { color: #071114; background: var(--cyan); }
.button-primary:hover { background: #76e6f1; }
.button-accent { color: #181205; background: var(--yellow); }
.button-accent:hover { background: #ffdc85; }
.button-quiet { border-color: var(--line); background: #10181e; }
.button-quiet:hover { border-color: #4b626d; background: #172229; }

.hero { min-height: 292px; position: relative; display: flex; align-items: end; background-image: linear-gradient(90deg, rgba(6, 12, 15, .9) 0%, rgba(6, 12, 15, .48) 52%, rgba(6, 12, 15, .34) 100%), linear-gradient(0deg, var(--bg) 0%, transparent 42%), url("/assets/palworld/hero.jpg"); background-size: cover; background-position: center 42%; }
.hero-content { padding: 54px 0 33px; }
.eyebrow { margin: 0 0 6px; color: var(--cyan); font-size: 11px; font-weight: 850; letter-spacing: 0; }
.hero h1 { max-width: 660px; margin: 0 0 24px; font-size: clamp(46px, 8vw, 88px); line-height: .9; letter-spacing: 0; text-shadow: 0 3px 22px rgba(0, 0, 0, .55); }
.server-line { max-width: 560px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.server-line div { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 5px 18px; }
.server-line span { color: var(--green); font-size: 13px; font-weight: 800; }
.server-line strong { font-size: 22px; }
.server-line small { grid-column: 1 / -1; color: var(--muted); }

.content-shell { padding: 20px 0 56px; }
.login-gate { min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.login-gate h2, .section-title h2 { margin: 0; font-size: 25px; letter-spacing: 0; }
.login-gate p:last-child, .section-title p:last-child { margin: 6px 0 0; color: var(--muted); }

.account-bar { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(290px, 1fr); align-items: center; gap: 20px; padding: 16px 18px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; }
.identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.identity img, .avatar-fallback { width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid var(--line); border-radius: 6px; object-fit: cover; background: #202d35; }
.avatar-fallback { display: grid; place-items: center; color: var(--cyan); font-weight: 900; }
.identity div { min-width: 0; }
.identity strong, .identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small { margin-top: 3px; color: var(--muted); font-family: Consolas, monospace; font-size: 11px; }
.balance { min-width: 128px; padding: 0 20px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; }
.balance span { display: block; color: var(--muted); font-size: 11px; }
.balance strong { display: block; margin-top: 2px; color: var(--yellow); font-size: 23px; }
.promo-form label, .admin-form label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.promo-form > div { display: grid; grid-template-columns: 1fr auto; }

input { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; outline: none; color: var(--text); background: #0e151a; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(66, 215, 232, .12); }
.promo-form input { border-radius: 6px 0 0 6px; }
.promo-form .button { border-radius: 0 6px 6px 0; }
.promo-form .promo-buy-link { width: 100%; min-height: 34px; margin-top: 7px; border-radius: 6px; }

.admin-section, .shop-section, .history-section { margin-top: 34px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.admin-layout { display: grid; grid-template-columns: 270px 1fr; gap: 14px; }
.admin-form { display: grid; align-content: start; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.promo-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.promo-row { min-height: 48px; display: grid; grid-template-columns: minmax(130px, 1fr) 90px minmax(130px, 1fr) auto; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.promo-row:last-child { border-bottom: 0; }
.promo-row code { color: var(--cyan); }
.promo-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.copy-button { width: 34px; height: 32px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: #10181e; cursor: pointer; }

.shop-heading { align-items: center; }
.shop-tools { display: flex; align-items: center; gap: 10px; }
.shop-tools input { width: 210px; }
.segments { height: 40px; display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segments button { border: 0; border-right: 1px solid var(--line); padding: 0 12px; color: var(--muted); background: #10181e; cursor: pointer; }
.segments button:last-child { border-right: 0; }
.segments button.is-active { color: #071114; background: var(--cyan); font-weight: 800; }
.catalog-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.shop-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.item-card { min-height: 198px; display: flex; flex-direction: column; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.item-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--cyan); }
.item-card.is-disposable::before { background: var(--coral); }
.item-main { display: grid; grid-template-columns: 58px 1fr; gap: 11px; padding: 16px 14px 10px; }
.item-main img { width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 6px; object-fit: cover; background: #0c1216; }
.item-type { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.item-card.is-disposable .item-type { color: #ff8e84; }
.item-card h3 { margin: 0; font-size: 15px; line-height: 1.25; letter-spacing: 0; overflow-wrap: anywhere; }
.item-id { margin: 0 14px 12px; color: #667881; font-family: Consolas, monospace; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-buy { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.item-buy strong { color: var(--yellow); font-size: 16px; }
.item-buy button { min-height: 34px; padding: 0 12px; }
.empty { padding: 30px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }

.history-list { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row span { color: var(--yellow); }
.history-row time { color: var(--muted); font-size: 12px; }

footer { border-top: 1px solid var(--line); }
footer .shell { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
footer span { color: var(--cyan); font-weight: 900; }
footer small { color: #617078; text-align: right; }
.toast { position: fixed; z-index: 50; right: 18px; bottom: 18px; max-width: min(390px, calc(100% - 36px)); padding: 12px 15px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 6px; background: #111a20; box-shadow: 0 15px 40px rgba(0, 0, 0, .38); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .18s ease; }
.toast.is-visible { opacity: 1; transform: none; }
.toast.is-error { border-left-color: var(--coral); }

@media (max-width: 900px) {
  .account-bar { grid-template-columns: 1fr auto; }
  .promo-form { grid-column: 1 / -1; }
  .shop-heading { align-items: start; flex-direction: column; }
  .shop-tools { width: 100%; }
  .shop-tools input { flex: 1; width: auto; }
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 22px, 1180px); }
  .site-header { height: auto; min-height: 58px; }
  .header-inner { padding: 9px 0; }
  .server-pill { display: none; }
  .header-actions .button { min-height: 36px; padding: 0 10px; font-size: 12px; }
  .hero { min-height: 270px; background-position: 58% center; }
  .hero-content { padding-bottom: 24px; }
  .hero h1 { font-size: 50px; }
  .server-line { align-items: end; }
  .login-gate, .account-bar { display: flex; align-items: stretch; flex-direction: column; }
  .balance { padding: 10px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; }
  .admin-layout { grid-template-columns: 1fr; }
  .promo-list { max-height: 320px; }
  .promo-row { grid-template-columns: 1fr auto; }
  .promo-row span { grid-column: 1 / -1; }
  .shop-tools { align-items: stretch; flex-direction: column; }
  .segments { width: 100%; }
  .segments button { flex: 1; padding: 0 7px; font-size: 12px; }
  .catalog-meta { align-items: start; flex-direction: column; gap: 4px; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-main { grid-template-columns: 46px 1fr; padding: 14px 10px 8px; }
  .item-main img { width: 46px; height: 46px; }
  .item-card h3 { font-size: 13px; }
  .item-id { margin: 0 10px 10px; }
  .item-buy { padding: 9px 10px; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row time { grid-column: 1 / -1; }
  footer .shell { align-items: start; flex-direction: column; justify-content: center; }
  footer small { text-align: left; }
}

@media (max-width: 520px) {
  .brand strong { display: none; }
  .hero { min-height: 330px; }
  .server-line { align-items: stretch; flex-direction: column; }
  .server-line div { width: 100%; }
  .server-line .button { width: 100%; }
  .account-bar, .promo-form { min-width: 0; width: 100%; }
  .promo-form > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .promo-form input, .promo-form .button { width: 100%; border-radius: 6px; }
  .shop-grid { grid-template-columns: 1fr; }
  .item-card { min-height: 170px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
