/* =========================================================================
   EBC — 현대적 네온 / 다크 SF UI
   ========================================================================= */
:root {
  --neon:   #38f6ff;
  --neon2:  #ff3bd6;
  --gold:   #ffd24d;
  --green:  #7bff9e;
  --red:    #ff6b6b;
  --bg0:    #04060f;
  --bg1:    #0a0f24;
  --panel:  rgba(14, 22, 48, 0.72);
  --panel2: rgba(20, 30, 64, 0.55);
  --line:   rgba(120, 180, 255, 0.16);
  --text:   #d6e8ff;
  --muted:  #8aa6cf;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Orbitron", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg0);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
#bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(110% 70% at 50% -10%, #14245a 0%, var(--bg1) 45%, var(--bg0) 100%);
}
#bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 60%, #cfe6ff, transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, #9fc4ff, transparent),
    radial-gradient(1px 1px at 85% 20%, #fff, transparent),
    radial-gradient(1px 1px at 55% 45%, #bcd, transparent);
  background-size: 320px 320px, 260px 260px, 400px 400px, 300px 300px, 220px 220px;
  opacity: .5;
  animation: drift 120s linear infinite;
}
@keyframes drift { to { background-position: 320px 320px, -260px 260px, 400px -400px, -300px 300px, 220px -220px; } }

.view { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ----- 버튼 ----- */
.btn {
  font-family: inherit; cursor: pointer; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 14px; letter-spacing: .04em;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--neon); box-shadow: 0 0 16px rgba(56,246,255,.25); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(120deg, rgba(56,246,255,.18), rgba(255,59,214,.14));
  border-color: rgba(56,246,255,.5);
  color: #eaffff; font-weight: 700;
  box-shadow: 0 0 22px rgba(56,246,255,.18);
}
.btn.primary:hover { box-shadow: 0 0 30px rgba(56,246,255,.4); border-color: var(--neon); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

input {
  font-family: inherit; width: 100%;
  background: rgba(4,8,20,.7); border: 1px solid var(--line);
  color: var(--text); padding: 11px 13px; border-radius: 9px; font-size: 14px;
  transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 14px rgba(56,246,255,.2); }
.err { color: var(--red); font-size: 12.5px; min-height: 16px; margin: 2px 0; }

/* =========================================================================
   인증 화면
   ========================================================================= */
#view-auth { align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: min(420px, 100%);
  background: var(--panel); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 34px 30px;
  box-shadow: 0 0 60px rgba(56,246,255,.1), inset 0 0 40px rgba(20,40,90,.3);
}
.logo { text-align: center; margin-bottom: 24px; }
.logo h1 {
  font-size: 58px; letter-spacing: .18em; font-weight: 900;
  background: linear-gradient(120deg, var(--neon), var(--neon2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(56,246,255,.4);
}
.tagline { color: var(--neon2); font-size: 12px; letter-spacing: .28em; margin-top: 2px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 10px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1; padding: 10px; background: transparent; border: 1px solid var(--line);
  color: var(--muted); border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 14px;
  transition: all .15s;
}
.tab.active { color: var(--neon); border-color: var(--neon); background: rgba(56,246,255,.08); }
form { display: flex; flex-direction: column; gap: 14px; }
form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); letter-spacing: .05em; }

/* =========================================================================
   캐릭터 생성
   ========================================================================= */
.create-wrap { max-width: 1040px; margin: 0 auto; padding: 30px 22px 60px; width: 100%; }
.screen-title { font-size: 26px; letter-spacing: .06em; }
.screen-desc { color: var(--muted); font-size: 13.5px; margin: 8px 0 24px; }
.create-grid { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
@media (max-width: 820px) { .create-grid { grid-template-columns: 1fr; } }

.preview-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; position: sticky; top: 20px;
}
#create-preview { width: 100%; aspect-ratio: 1 / 1; display: block; }
.preview-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 12px; }
.preview-stats .ps { display: flex; justify-content: space-between; font-size: 13px; }
.preview-stats .ps b { color: var(--neon); }

.config-panel { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.icon-chip {
  width: 60px; height: 60px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(4,8,20,.5); cursor: pointer; padding: 0; transition: all .15s;
}
.icon-chip canvas { width: 100%; height: 100%; display: block; }
.icon-chip.sel { border-color: var(--neon); box-shadow: 0 0 16px rgba(56,246,255,.35); }
.color-chip {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all .15s;
}
.color-chip.sel { border-color: #fff; transform: scale(1.12); }

.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.opt-card {
  text-align: left; cursor: pointer; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(8,14,32,.5);
  transition: all .15s; font-family: inherit; color: var(--text);
}
.opt-card:hover { border-color: rgba(56,246,255,.5); }
.opt-card.sel { border-color: var(--neon); background: rgba(56,246,255,.1); box-shadow: 0 0 16px rgba(56,246,255,.2); }
.opt-card .oc-name { font-weight: 700; font-size: 14px; }
.opt-card .oc-desc { color: var(--muted); font-size: 11.5px; margin-top: 4px; line-height: 1.4; }

/* =========================================================================
   격납고
   ========================================================================= */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(6,10,24,.6); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 900; letter-spacing: .12em; font-size: 18px; color: var(--neon); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { color: var(--muted); font-size: 13px; }

.hangar-grid { max-width: 1040px; margin: 0 auto; padding: 26px 22px 60px; width: 100%;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 820px) { .hangar-grid { grid-template-columns: 1fr; } }

.mech-stage {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; position: relative; overflow: hidden;
}
.mech-stage::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 50% 30%, rgba(56,246,255,.08), transparent 70%);
  pointer-events: none;
}
#hangar-mech { width: 100%; aspect-ratio: 1 / 1; display: block; }
.nameplate { text-align: center; position: relative; z-index: 1; }
.nameplate .pilot { font-size: 22px; font-weight: 800; letter-spacing: .04em; }
.nameplate .mech { color: var(--muted); font-size: 14px; margin-top: 2px; }
.badges { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px; padding: 4px 10px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--neon); background: rgba(56,246,255,.07);
}

.status-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; display: flex; flex-direction: column; gap: 18px;
}
.level-block { display: flex; align-items: center; gap: 16px; }
.lv-num { font-size: 30px; font-weight: 900; color: var(--gold); text-shadow: 0 0 16px rgba(255,210,77,.4); white-space: nowrap; }
.lv-num span { font-size: 34px; }
.xp-bar {
  flex: 1; height: 22px; background: rgba(4,8,20,.7); border: 1px solid var(--line);
  border-radius: 12px; position: relative; overflow: hidden;
}
.xp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--neon), var(--neon2));
  box-shadow: 0 0 14px rgba(56,246,255,.5); transition: width .5s ease;
}
.xp-bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px; color: #fff; text-shadow: 0 0 4px #000; }

.vitals { display: flex; flex-direction: column; gap: 10px; }
.vital-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.vital-bar { height: 16px; background: rgba(4,8,20,.7); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.vital-bar i { display: block; height: 100%; border-radius: 9px; transition: width .4s ease; }
.vf-hp { background: linear-gradient(90deg, #ff6b6b, #ffd24d); box-shadow: 0 0 12px rgba(255,107,107,.5); }
.vf-en { background: linear-gradient(90deg, #5b9dff, #38f6ff); box-shadow: 0 0 12px rgba(56,246,255,.5); }
.destroyed-note { color: var(--red); font-size: 12.5px; text-align: center; padding: 6px; border: 1px solid rgba(255,107,107,.4); border-radius: 8px; background: rgba(255,107,107,.08); }

.stats-list { display: flex; flex-direction: column; gap: 11px; }
.stat-row { display: grid; grid-template-columns: 56px 1fr 48px; align-items: center; gap: 10px; }
.stat-row .sl { font-size: 12.5px; color: var(--muted); }
.stat-bar { height: 12px; background: rgba(4,8,20,.7); border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.stat-bar i { display: block; height: 100%; border-radius: 7px; transition: width .5s ease; }
.stat-row .sv { text-align: right; font-weight: 700; font-size: 14px; }
.stat-row .sv .up { color: var(--green); font-size: 11px; margin-left: 3px; }

.resource-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.res { background: rgba(8,14,32,.5); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.res-label { display: block; font-size: 11px; color: var(--muted); }
.res-val { display: block; font-size: 16px; font-weight: 800; margin-top: 3px; color: var(--neon); }

.action-row { display: flex; gap: 10px; }
.hint-text { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }

.log-panel {
  background: rgba(4,8,20,.5); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 12.5px; color: var(--muted); max-height: 150px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; min-height: 44px;
}
.log-panel .le { line-height: 1.4; }
.log-panel .le b { color: var(--gold); }
.log-panel .le .g { color: var(--green); }

/* =========================================================================
   오버레이 / 모달 / 토스트
   ========================================================================= */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(2,4,12,.78); backdrop-filter: blur(4px); padding: 20px;
}
.levelup-card {
  text-align: center; padding: 36px 40px; border-radius: 18px;
  background: var(--panel); border: 1px solid rgba(255,210,77,.4);
  box-shadow: 0 0 60px rgba(255,210,77,.25);
  animation: pop .4s cubic-bezier(.2,1.4,.5,1);
}
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lu-title { font-size: 16px; letter-spacing: .4em; color: var(--gold); text-shadow: 0 0 20px rgba(255,210,77,.6); }
.lu-level { font-size: 52px; font-weight: 900; margin: 8px 0 16px; color: #fff; }
.lu-gains { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; font-size: 15px; }
.lu-gains .lg { color: var(--green); }

.modal {
  width: min(520px, 100%); max-height: 80vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; letter-spacing: .06em; }
.x { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.ranking-list { overflow-y: auto; padding: 8px; }
.rank-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid rgba(120,180,255,.07); }
.rank-row .rk { font-weight: 900; font-size: 16px; color: var(--muted); text-align: center; }
.rank-row.top1 .rk { color: var(--gold); }
.rank-row.top2 .rk { color: #cfd8ff; }
.rank-row.top3 .rk { color: #ff9e3b; }
.rank-row .ri-name { font-weight: 700; }
.rank-row .ri-sub { font-size: 11.5px; color: var(--muted); }
.rank-row .ri-lv { font-size: 13px; color: var(--neon); text-align: right; }
.rank-row .ri-rec { font-size: 11px; color: var(--muted); text-align: right; }

/* ----- 형식번호 / 소속 ----- */
.code-line { font-family: monospace; font-size: 12px; color: var(--muted); letter-spacing: .08em; margin-top: 6px; }

/* ----- 세력도(국가) ----- */
.nation-mine { margin-left: auto; margin-right: 14px; font-size: 12.5px; color: var(--muted); }
.nation-mine b { color: var(--neon); }
.nation-list { overflow-y: auto; padding: 12px; max-height: 64vh; display: flex; flex-direction: column; gap: 10px; }
.nation-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: rgba(8,14,32,.4); border-left-width: 4px; }
.nation-card.mine { box-shadow: inset 0 0 0 1px rgba(56,246,255,.3); }
.nation-card.destroyed { opacity: .6; }
.nation-top { display: flex; align-items: baseline; gap: 8px; }
.nation-top .n-name { font-weight: 800; font-size: 15px; }
.nation-top .n-label { font-size: 12px; color: var(--muted); }
.nation-top .n-tag { font-size: 10.5px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); margin-left: 6px; }
.nation-top .n-tag.mine { color: var(--neon); border-color: var(--neon); }
.nation-top .n-tag.dead { color: var(--red); border-color: rgba(255,107,107,.4); }
.nation-top .n-tag.siege { color: var(--gold); border-color: rgba(255,210,77,.5); }
.nation-desc { font-size: 11.5px; color: var(--muted); margin: 4px 0 8px; }
.nation-stats { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; margin-bottom: 8px; }
.nation-stats .ns b { color: var(--text); }
.fort-bar { height: 9px; background: rgba(4,8,20,.7); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.fort-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--neon2), var(--gold)); }
.nation-actions { display: flex; gap: 8px; }
.foe-faction { font-size: 11px; opacity: .85; }

/* ----- 정비창(상점/인벤토리) ----- */
.modal-wide { width: min(620px, 100%); }
.modal-head .shop-money { margin-left: auto; margin-right: 14px; font-size: 13px; color: var(--muted); }
.modal-head .shop-money b { color: var(--gold); font-size: 15px; }
.shop-tabs { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.shop-tab { flex: 1; padding: 8px; background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; transition: all .15s; }
.shop-tab.active { color: var(--neon); border-color: var(--neon); background: rgba(56,246,255,.08); }
.shop-body { overflow-y: auto; padding: 10px; max-height: 60vh; }
.shop-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid rgba(120,180,255,.08); }
.shop-item .si-name { font-weight: 700; font-size: 14px; }
.shop-item .si-name .tag { font-size: 10.5px; padding: 2px 7px; border-radius: 10px; margin-left: 6px; border: 1px solid var(--line); color: var(--neon); vertical-align: middle; }
.shop-item .si-name .tag.eq { color: var(--green); border-color: rgba(123,255,158,.4); }
.shop-item .si-desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.shop-item .si-bonus { font-size: 11.5px; margin-top: 4px; }
.shop-item .si-bonus .b { color: var(--neon); margin-right: 8px; }
.shop-item .si-bonus .b.neg { color: var(--red); }
.shop-item .si-right { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.shop-item .price { color: var(--gold); font-size: 13px; font-weight: 700; }
.dura-bar { width: 90px; height: 6px; background: rgba(4,8,20,.7); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.dura-bar i { display: block; height: 100%; background: linear-gradient(90deg,#7bff9e,#38f6ff); }
.shop-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.shop-section-label { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; padding: 12px 14px 6px; }

/* 격납고 장착 무기/장비 표시 */
.gear-line { font-size: 12px; color: var(--muted); margin-top: 8px; }
.gear-line .gw { color: var(--neon); }
.stat-row .sv .gear { color: var(--neon); font-size: 11px; margin-left: 3px; }
.stat-row .sv .gear.neg { color: var(--red); }

/* ----- 전투 로스터 ----- */
.roster-mystatus {
  padding: 10px 16px; font-size: 12.5px; color: var(--muted);
  border-bottom: 1px solid var(--line); display: flex; gap: 16px; flex-wrap: wrap;
}
.roster-mystatus b { color: var(--neon); }
.roster-list .rank-row { grid-template-columns: minmax(0, 1fr) auto; }
.roster-list .btn.attack { white-space: nowrap; }
.foe-bars { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.foe-hp { width: 80px; height: 7px; background: rgba(4,8,20,.7); border-radius: 5px; overflow: hidden; }
.foe-hp i { display: block; height: 100%; background: linear-gradient(90deg,#ff6b6b,#ffd24d); }
.foe-meta { font-size: 11px; color: var(--muted); }
.btn.attack { padding: 8px 16px; font-size: 13px; }
.foe-destroyed { color: var(--red); font-size: 11.5px; }

/* ----- 전투 결과 ----- */
.battle-card {
  text-align: center; padding: 30px 34px; border-radius: 18px; width: min(460px, 100%);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 0 60px rgba(56,246,255,.18); animation: pop .35s cubic-bezier(.2,1.4,.5,1);
}
.bc-arena { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 18px; }
.bc-side { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.bc-side canvas { width: 120px; height: 120px; }
.bc-name { font-size: 13px; font-weight: 700; }
.bc-hp { width: 110px; height: 8px; background: rgba(4,8,20,.8); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bc-hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg,#ff6b6b,#ffd24d); transition: width .18s linear; }
.bc-float { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); font-size: 16px; font-weight: 800; pointer-events: none; opacity: 0; }
.bc-float.show { animation: floatup .5s ease; }
.bc-float.dmg { color: #ff8a8a; }
.bc-float.miss { color: var(--neon); }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, 4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -18px); } }
.bc-foe { opacity: .95; }
.bc-vs { font-size: 26px; font-weight: 900; letter-spacing: .1em; color: var(--muted); }
.bc-vs.win  { color: var(--green); text-shadow: 0 0 20px rgba(123,255,158,.6); }
.bc-vs.lose { color: var(--red);   text-shadow: 0 0 20px rgba(255,107,107,.6); }
.bc-clash { animation: clash .5s ease; }
@keyframes clash { 0%,100% { transform: translateX(0); } 25% { transform: translateX(10px); } 60% { transform: translateX(-6px); } }
.bc-rounds { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.bc-reward { font-size: 15px; margin-bottom: 22px; }
.bc-reward .rw { color: var(--gold); font-weight: 700; }
.bc-reward .none { color: var(--muted); }

/* ----- 인트로 내러티브 ----- */
.intro-card {
  max-width: 560px; width: 100%; padding: 38px 36px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(10,16,40,.96), rgba(4,6,16,.98));
  border: 1px solid var(--line); box-shadow: 0 0 80px rgba(56,246,255,.12);
  text-align: center; animation: pop .5s ease;
}
.intro-body {
  color: #cfe0ff; font-size: 14.5px; line-height: 1.85; letter-spacing: .01em;
  margin: 0 0 20px; text-shadow: 0 0 18px rgba(56,246,255,.12);
}
.intro-body b { color: var(--neon); }
.intro-card .btn { margin-top: 8px; letter-spacing: .1em; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: rgba(8,14,32,.95); border: 1px solid var(--neon); color: var(--text);
  padding: 12px 22px; border-radius: 12px; font-size: 14px; z-index: 200;
  box-shadow: 0 0 30px rgba(56,246,255,.3); animation: toastin .3s ease;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* =========================================================================
   언어 선택기 (전역 고정)
   ========================================================================= */
#lang-switch {
  position: fixed; top: 14px; right: 16px; z-index: 150;
}
#lang-select {
  background: rgba(8,14,32,.85); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 10px; font-family: inherit; font-size: 12.5px;
  letter-spacing: .03em; cursor: pointer; outline: none;
  box-shadow: 0 0 16px rgba(56,246,255,.12);
}
#lang-select:hover { border-color: var(--neon); }
#lang-select option { background: #0a0f24; color: var(--text); }
/* 격납고 상단바와 겹치지 않도록 우측 여백 확보 */
.topbar .topbar-right { padding-right: 92px; }

/* =========================================================================
   소셜 로그인
   ========================================================================= */
.social-auth { margin-top: 18px; }
.social-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; margin: 4px 0 14px;
}
.social-divider::before, .social-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.btn.google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; text-decoration: none;
  background: #fff; color: #1f1f1f; border: none; font-weight: 600;
  letter-spacing: .01em; padding: 11px 14px; border-radius: 11px;
}
.btn.google:hover { background: #f1f3f6; box-shadow: 0 0 22px rgba(255,255,255,.25); }
.btn.google .g-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px;
  background: conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0 100%);
  color: #fff; font-weight: 800; font-size: 13px; line-height: 1;
}

/* =========================================================================
   모바일 (≤640px) — 폰트/여백 축소, 1열, 상단바·기체크기 보정
   ========================================================================= */
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 15px; }
  .topbar-right { gap: 6px; flex-wrap: wrap; justify-content: flex-end; padding-right: 64px; }
  .topbar .btn.sm { padding: 6px 9px; font-size: 11.5px; }
  .user-chip { display: none; }            /* 좁은 폭에서 사용자명 숨겨 버튼 공간 확보 */
  #lang-switch { top: 8px; right: 10px; }
  #lang-select { padding: 4px 7px; font-size: 11.5px; }

  .logo h1 { font-size: 44px; }
  .auth-card { padding: 26px 20px; }

  .hangar-grid, .create-wrap { padding: 16px 12px 48px; }
  .hangar-grid { gap: 16px; }
  .mech-stage { padding: 12px; }
  /* 정사각 기체 캔버스가 화면을 다 먹지 않게 높이 상한 */
  #hangar-mech, #create-preview { max-width: min(100%, 50vh); margin: 0 auto; }
  .nameplate .pilot { font-size: 19px; }

  .resource-row { grid-template-columns: repeat(2, 1fr); }
  .card-row { grid-template-columns: 1fr 1fr; }

  .modal, .modal-wide { width: 94vw; max-height: 88vh; }
  .modal-head { padding: 12px 14px; }
  .modal-head h3 { font-size: 16px; }
  .shop-body, .nation-list, .ranking-list, .roster-list { max-height: 70vh; }

  .battle-card { padding: 22px 16px; }
  .bc-arena { gap: 4px; }
  .screen-title { font-size: 21px; }
  .action-row { flex-wrap: wrap; }
}

@media (max-width: 380px) {
  .card-row { grid-template-columns: 1fr; }
  .topbar-right { padding-right: 56px; }
}
