:root {
  --bg: #050b14;
  --bg2: #0a1626;
  --panel: rgba(10, 26, 43, 0.82);
  --line: #12e0c8;
  --accent: #35f5c0;
  --accent2: #4bb8ff;
  --text: #e6f6ff;
  --muted: #8fb3c9;
  --danger: #ff5470;
  --ok: #37e08a;
  --warn: #ffc24b;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: radial-gradient(1200px 800px at 20% -10%, #0d2236 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  min-height: 100%;
}

.app { max-width: 720px; margin: 0 auto; padding: 16px; }

.screen { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--panel);
  border: 1px solid rgba(53, 245, 192, .25);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 0 24px rgba(18, 224, 200, .08), inset 0 0 40px rgba(11, 40, 60, .4);
  backdrop-filter: blur(4px);
}

h1 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 0 0 8px; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }

.hero {
  border-radius: var(--radius);
  padding: 26px 18px;
  background:
    linear-gradient(180deg, rgba(5,11,20,.35), rgba(5,11,20,.85)),
    url('/assets/sample_bg_level.jpg') center/cover no-repeat;
  border: 1px solid rgba(53,245,192,.25);
  margin-bottom: 16px;
}

/* image banner with caption */
.banner {
  position: relative;
  height: 190px;
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  border: 1px solid rgba(53,245,192,.25);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(18,224,200,.1);
  animation: fade .3s ease;
}
.banner::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5,11,20,.05) 30%, rgba(5,11,20,.85));
}
.banner-cap {
  position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 2;
  font-size: 19px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}

.theory {
  background: rgba(75,184,255,.08);
  border: 1px solid rgba(75,184,255,.5);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}
.theory p { margin: 6px 0 0; }
.steps { margin: 6px 0 0; padding-left: 22px; }
.steps li { margin: 5px 0; }

.reward-emoji { font-size: 56px; line-height: 1; margin-bottom: 6px; }
.reward-armor { margin: 14px 0; }
.anim-pop { animation: popin .45s cubic-bezier(.2,1.4,.4,1) both; }
.anim-bounce { animation: bounce .7s ease infinite alternate; }
@keyframes bounce { from { transform: translateY(0) scale(1); } to { transform: translateY(-10px) scale(1.06); } }
@keyframes popin { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }

.logo-shield { font-size: 46px; filter: drop-shadow(0 0 14px var(--accent)); }

label.field { display: block; margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
input, select {
  width: 100%; padding: 13px 14px; font-size: 16px;
  background: #071626; color: var(--text);
  border: 1px solid #1c4058; border-radius: 12px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(53,245,192,.15); }
input[readonly] { opacity: .8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 16px; padding: 15px 18px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  color: #04121a; background: linear-gradient(180deg, #63ffd6, #23d3a6);
  border: none; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(35, 211, 166, .3);
  transition: transform .08s ease;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); box-shadow: none; }
.btn.ghost { background: #0d2436; color: var(--text); border: 1px solid #1c4058; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; }

/* HUD */
.hud { margin-bottom: 12px; }
.hud-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); gap: 10px; }
.hud-title { color: var(--accent); font-weight: 700; }
.progress { height: 8px; background: #0c2135; border-radius: 6px; margin-top: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .3s ease; }
.armor-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.armor-chip { font-size: 18px; padding: 4px 8px; border-radius: 10px; background: #0b1e2f; border: 1px solid #1c4058; opacity: .35; }
.armor-chip.on { opacity: 1; border-color: var(--accent); box-shadow: 0 0 12px rgba(53,245,192,.35); }

.combo { color: var(--warn); font-weight: 700; }

/* boss */
.boss { margin-top: 10px; }
.boss-name { font-size: 13px; color: var(--danger); }
.boss-hp { height: 12px; background: #2a0a12; border: 1px solid var(--danger); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.boss-hp > i { display: block; height: 100%; background: linear-gradient(90deg, #ff5470, #ff8aa0); transition: width .4s ease; }

/* questions */
.prompt { font-size: 18px; font-weight: 600; margin: 6px 0 14px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left; padding: 14px; border-radius: 12px; cursor: pointer;
  background: #0a1d2e; border: 1px solid #1c4058; color: var(--text); font-size: 16px;
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--accent2); }
.opt.sel { border-color: var(--accent); background: #0d2a33; box-shadow: 0 0 0 2px rgba(53,245,192,.2) inset; }
.opt.correct { border-color: var(--ok); background: rgba(55,224,138,.14); }
.opt.wrong { border-color: var(--danger); background: rgba(255,84,112,.14); }
.opt .tag { font-weight: 700; margin-right: 8px; color: var(--accent); }

.chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 14px; font-size: 15px; }
.bubble.them { align-self: flex-start; background: #12283c; border: 1px solid #21465f; border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: #0e3a33; border: 1px solid #1d6b58; border-bottom-right-radius: 4px; }

.sort-grid { display: flex; flex-direction: column; gap: 10px; }
.sort-card { padding: 12px; border-radius: 12px; background: #0a1d2e; border: 1px solid #1c4058; }
.sort-card .txt { margin-bottom: 8px; }
.sort-actions { display: flex; gap: 8px; }
.sort-actions button { flex: 1; padding: 10px; border-radius: 10px; background: #0d2436; border: 1px solid #1c4058; color: var(--text); cursor: pointer; }
.sort-actions button.sel.danger { border-color: var(--danger); background: rgba(255,84,112,.16); }
.sort-actions button.sel.safe { border-color: var(--ok); background: rgba(55,224,138,.16); }

.pw-checks { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.pw-checks li { color: var(--muted); }
.pw-checks li.ok { color: var(--ok); }

/* feedback */
.feedback { margin-top: 4px; }
.feedback .banner { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.banner.ok { color: var(--ok); }
.banner.no { color: var(--danger); }
.rule { background: rgba(55,224,138,.1); border: 1px solid var(--ok); border-radius: 12px; padding: 12px; margin-top: 12px; font-weight: 600; }

/* finish */
.rank-badge { font-size: 54px; text-align: center; }
.big { font-size: 30px; font-weight: 800; text-align: center; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #1c4058; font-size: 15px; }
.inv { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.inv-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: #0a1d2e; border: 1px solid #1c4058; }
.inv-item .ic { font-size: 22px; }
.mistake { padding: 10px; border-radius: 10px; background: rgba(255,84,112,.08); border: 1px solid rgba(255,84,112,.4); margin-bottom: 8px; font-size: 14px; }
.mistake b { color: #ffd0d8; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: linear-gradient(180deg, #63ffd6, #23d3a6); color: #04121a;
  padding: 12px 18px; border-radius: 14px; font-weight: 800;
  box-shadow: 0 10px 30px rgba(35,211,166,.4); z-index: 50; animation: pop .3s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.footer { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 6px; line-height: 1.6; }
.footer a { color: var(--accent2); }
.helpline { text-align: center; font-size: 20px; font-weight: 800; color: var(--accent); margin: 12px 0; }

/* --- feedback images --- */
.fb-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.fb-img {
  width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex: none;
  border: 1px solid rgba(53,245,192,.35); box-shadow: 0 0 18px rgba(18,224,200,.2);
}
.banner-txt { font-size: 22px; font-weight: 800; }
.banner-txt.ok { color: var(--ok); }
.banner-txt.no { color: var(--danger); }

/* --- boss / goal cards --- */
.boss-card { background: rgba(255,84,112,.08); border: 1px solid rgba(255,84,112,.5); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.boss-card p { margin: 6px 0 0; }
.boss-head { color: #ff96a8; font-weight: 800; margin-bottom: 4px; }
.goal-card { background: rgba(75,184,255,.08); border: 1px solid rgba(75,184,255,.5); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }

/* --- armor chips as buttons --- */
.armor-chip { cursor: pointer; font: inherit; line-height: 1; }

/* --- inventory items: robust layout --- */
.inv-item { width: 100%; text-align: left; align-items: flex-start; }
.inv-item > div { min-width: 0; }
.inv-item b, .inv-item span { overflow-wrap: anywhere; }
.inv-item.locked { opacity: .55; }
.card.center .inv-item { margin: 12px 0; text-align: left; }
.consolation { border-color: rgba(255,194,75,.5); background: rgba(255,194,75,.08); }

/* --- modal --- */
.modal {
  position: fixed; inset: 0; z-index: 100; padding: 18px;
  background: rgba(3,8,14,.75);
  display: flex; align-items: center; justify-content: center;
  animation: fade .18s ease;
}
.modal-card {
  background: var(--panel); border: 1px solid rgba(53,245,192,.35);
  border-radius: 18px; padding: 22px; max-width: 360px; width: 100%; text-align: center;
  box-shadow: 0 0 40px rgba(18,224,200,.18);
}
.modal-ic { font-size: 46px; margin-bottom: 6px; }
.modal-card .ok { color: var(--ok); }
.hud-top > span:last-child { white-space: nowrap; }
.hud-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
/* --- glossary button + training state --- */
.hud-btn { cursor: pointer; font: inherit; line-height: 1; padding: 4px 10px; border-radius: 10px; background: #0b1e2f; border: 1px solid #1c4058; color: var(--accent2); }
.armor-chip.training { opacity: 1; border-color: var(--warn); box-shadow: 0 0 12px rgba(255,194,75,.35); }
.tag-train { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 8px; background: rgba(255,194,75,.16); border: 1px solid var(--warn); color: var(--warn); margin-left: 6px; }
.warn { color: var(--warn); }

/* --- modal content --- */
.modal-card .glossary, .modal-card .theory-more { text-align: left; margin-top: 10px; }
.glossary-item { padding: 8px 0; border-bottom: 1px dashed #1c4058; }
.glossary-item b { display: block; color: var(--accent); }
.glossary-item span { color: var(--text); font-size: 14px; }
.modal-card .btn { margin-top: 16px; }
.modal-card .btn.ghost, .modal-card .btn.secondary { margin-top: 8px; }
