/* ═══════════════════════════════════════
   Astra Wars — Portal  (mobile-first)
═══════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:       #0b0c10;
  --bg2:      #13141c;
  --bg3:      #1a1b26;
  --input-bg: #1e1f2a;
  --input-bd: rgba(255,255,255,.18);
  --border:   rgba(255,255,255,.08);
  --accent:   #e47833;
  --accent-d: #c86820;
  --text1:    #e4e4ef;
  --text2:    #7c7c9a;
  --green:    #3db865;
  --red:      #e04040;
  --r:        10px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text1);
  font-family: 'Malgun Gothic','맑은 고딕',-apple-system,sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; }
input { outline: none; font-family: inherit; }
em { font-style: normal; color: var(--accent); }
img { max-width: 100%; }

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
.ph {
  position: sticky;
  top: 0;
  z-index: 300;
  height: 52px;
  background: rgba(11,12,16,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.ph-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ph-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: 1.5px;
}
.ph-logo svg { flex-shrink: 0; }
.ph-logo-name {
  font-size: 17px;
  letter-spacing: 2px;
  font-family: 'Rajdhani','Impact',sans-serif;
}
.ph-logo-sub {
  font-size: 11px;
  color: var(--text2);
  border-left: 1px solid var(--border);
  padding-left: 9px;
  display: none; /* mobile: hidden */
}
.ph-nav {
  display: none;
  gap: 2px;
  margin-left: auto;
}
.ph-nav a {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text2);
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.ph-nav a:hover { color: var(--text1); background: rgba(255,255,255,.05); }
.ph-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.ph-nav ~ .ph-right { margin-left: 0; }
.ph-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: blink 2s ease infinite;
  flex-shrink: 0;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }
.ph-online { font-size: 12px; color: var(--text2); white-space: nowrap; }

/* ══════════════════════════════════════
   HERO  (mobile-first: stacked)
══════════════════════════════════════ */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 50% 120%,
      rgba(228,120,51,.1) 0%, transparent 60%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
#starCanvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .6;
  display: block;
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Left: title */
.hero-left { text-align: center; }
.hero-tag {
  display: inline-block;
  padding: 3px 12px;
  border: 1px solid rgba(228,120,51,.4);
  border-radius: 20px;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.hero-title {
  font-family: 'Rajdhani','Impact',sans-serif;
  font-size: clamp(44px,10vw,80px);
  font-weight: 700;
  line-height: .95;
  letter-spacing: 3px;
  margin-bottom: 16px;
}
.hero-title span {
  display: block;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(228,120,51,.3);
}
.hero-desc {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.8;
  margin-bottom: 28px;
}
.hero-counters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.hc { text-align: center; min-width: 56px; }
.hc b { display: block; font-size: 20px; font-weight: 700; }
.hc span { display: block; font-size: 11px; color: var(--text2); margin-top: 1px; }
.hc-div { width: 1px; height: 28px; background: var(--border); flex-shrink: 0; }

/* Right: auth card */
.hero-right {}
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 14px 0;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  transition: color .15s, background .15s;
  position: relative;
}
.auth-tab::after {
  content: '';
  position: absolute;
  bottom: 0; left: 15%; right: 15%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform .2s;
}
.auth-tab.on {
  color: var(--accent);
  background: rgba(228,120,51,.05);
}
.auth-tab.on::after { transform: scaleX(1); }
.auth-tab:hover:not(.on) {
  color: var(--text1);
  background: rgba(255,255,255,.03);
}

/* Tab panes — JS가 style.display를 직접 제어 */
.auth-pane { padding: 22px 20px 24px; }

.af-field { margin-bottom: 14px; }
.af-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #7c7c9a;
  margin-bottom: 6px;
  letter-spacing: .3px;
}
.af-field label small { font-weight: 400; opacity: .7; margin-left: 4px; }
.af-field input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  background: #1e1f2a;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  color: #e4e4ef;
  font-size: 14px;
  transition: border-color .15s;
}
.af-field input:focus {
  border-color: #e47833;
  outline: none;
}
.af-field input::placeholder { color: rgba(180,180,200,.4); }
/* Chrome autofill */
.af-field input:-webkit-autofill,
.af-field input:-webkit-autofill:hover,
.af-field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px #1e1f2a inset;
  -webkit-text-fill-color: #e4e4ef;
}
.af-err {
  margin: 10px 0;
  padding: 9px 12px;
  background: rgba(224,64,64,.12);
  border: 1px solid rgba(224,64,64,.35);
  border-radius: 7px;
  font-size: 12px;
  color: #f08080;
}
.af-btn {
  display: block;
  width: 100%;
  padding: 13px;
  background: #e47833;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background .15s, transform .1s;
}
.af-btn:hover  { background: #c86820; transform: translateY(-1px); }
.af-btn:active { transform: none; }

/* ══════════════════════════════════════
   LIVE FEED TICKER
══════════════════════════════════════ */
.feed-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  height: 36px;
  overflow: hidden;
}
.feed-label {
  flex-shrink: 0;
  padding: 0 14px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(228,120,51,.08);
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  letter-spacing: 1px;
}
.feed-track { flex: 1; overflow: hidden; }
.feed-scroll {
  display: flex;
  animation: ticker 28s linear infinite;
  will-change: transform;
}
/* Duplicate items in JS for seamless loop */
@keyframes ticker { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }
.feed-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 20px;
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  border-right: 1px solid var(--border);
}
.feed-item b   { color: var(--text1); }
.feed-item .fw { color: var(--green); font-weight: 700; }
.feed-item .fl { color: var(--red);   font-weight: 700; }

/* ══════════════════════════════════════
   MAIN WRAP
══════════════════════════════════════ */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* ── Section header ── */
.sec-head { margin-bottom: 20px; }
.sec-head h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 3px;
}
.sec-head p { font-size: 12px; color: var(--text2); }

/* ── Card ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.card-head {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  letter-spacing: .5px;
}
.card-body { padding: 14px 16px; }
.empty { color: var(--text2); font-size: 13px; }

/* ══════════════════════════════════════
   FEATURES GRID
══════════════════════════════════════ */
.feat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.feat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 14px;
  transition: border-color .2s, transform .2s;
}
.feat-card:hover {
  border-color: rgba(228,120,51,.35);
  transform: translateY(-2px);
}
.fc-icon { font-size: 22px; margin-bottom: 8px; }
.feat-card h3 { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.feat-card p  { font-size: 12px; color: var(--text2); line-height: 1.65; }

/* ══════════════════════════════════════
   STORY
══════════════════════════════════════ */
.story-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.story-text p {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.85;
  margin-bottom: 12px;
}
.story-text p:last-child { margin-bottom: 0; }
.story-cta { color: var(--accent) !important; font-weight: 600; }
.ele-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.ele-chip {
  background: var(--bg2);
  border: 1px solid var(--ec, #555);
  border-radius: 7px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ec-name { font-size: 12px; font-weight: 700; color: var(--ec, #aaa); }
.ec-desc { font-size: 10px; color: var(--text2); }

/* ══════════════════════════════════════
   2-COL SECTIONS
══════════════════════════════════════ */
.two-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Ranking */
.rank-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.rank-row:last-child { border-bottom: none; }
.rr-no   { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }
.rr-info { flex: 1; min-width: 0; }
.rr-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rr-meta { font-size: 11px; color: var(--text2); margin-top: 1px; }
.rr-ctry { font-size: 11px; font-weight: 600; flex-shrink: 0; }

/* Country */
.country-row {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.country-row:last-child { border-bottom: none; }
.cr-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.cr-dot    { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cr-name   { font-size: 13px; font-weight: 600; }
.cr-mbr    { font-size: 11px; color: var(--text2); margin-left: auto; }
.cr-bar-wrap { display: flex; align-items: center; gap: 7px; }
.cr-bar {
  flex: 1; height: 5px;
  background: rgba(255,255,255,.07);
  border-radius: 3px; overflow: hidden;
}
.cr-fill { height: 100%; border-radius: 3px; transition: width .5s; }
.cr-pct  { font-size: 11px; font-weight: 600; flex-shrink: 0; }

/* Notices */
.notice-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.notice-row:last-child { border-bottom: none; }
.nr-title { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-date  { font-size: 11px; color: var(--text2); flex-shrink: 0; }

/* Battles */
.battle-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 12px;
}
.battle-row:last-child { border-bottom: none; }
.br-a   { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-vs  { font-size: 10px; color: var(--text2); flex-shrink: 0; }
.br-b   { flex: 1; color: var(--text2); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-badge { flex-shrink: 0; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.bw { color: var(--green); background: rgba(61,184,101,.12); }
.bl { color: var(--red);   background: rgba(224,64,64,.12); }

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 24px 16px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Rajdhani',sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
.footer-links a { font-size: 12px; color: var(--text2); transition: color .15s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 11px; color: var(--text2); }

/* ══════════════════════════════════════
   RESPONSIVE — Tablet 640px+
══════════════════════════════════════ */
@media (min-width: 640px) {
  .ph-logo-sub { display: block; }
  .ph-nav { display: flex; margin-left: auto; }
  .ph-nav ~ .ph-right { margin-left: 0; }

  .hero-inner { padding: 48px 24px 40px; }
  .hero-left  { text-align: left; }
  .hero-counters { justify-content: flex-start; }

  .feat-grid { grid-template-columns: repeat(3, 1fr); }

  .ele-grid { grid-template-columns: repeat(4, 1fr); }

  .two-col { flex-direction: row; align-items: start; }
  .two-col > * { flex: 1; min-width: 0; }

  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }

  .wrap { padding: 48px 24px 72px; }
}

/* ══════════════════════════════════════
   RESPONSIVE — Desktop 1024px+
══════════════════════════════════════ */
@media (min-width: 1024px) {
  .ph-inner { padding: 0 24px; }

  .hero-inner {
    flex-direction: row;
    align-items: center;
    gap: 56px;
    padding: 64px 24px 56px;
  }
  .hero-left { flex: 1; text-align: left; }
  .hero-right { width: 380px; flex-shrink: 0; }
  .hero-counters { justify-content: flex-start; }

  .story-grid {
    flex-direction: row;
    align-items: start;
    gap: 36px;
  }
  .story-grid .story-text { flex: 1; }
  .story-grid .ele-grid {
    width: 280px;
    flex-shrink: 0;
    grid-template-columns: repeat(2, 1fr);
  }
}
