/* ============================================================
   OVERTALE — game screen styles (play.html)
   ============================================================ */

body.game-body { overflow: hidden; }

.game-wrapper {
  display: flex;
  height: calc(100vh - 62px);
  background: var(--void);
}

.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 2px solid var(--line);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.4rem;
  background: var(--panel);
  border-bottom: 2px solid var(--line);
}

.game-location {
  font-family: var(--font-px);
  font-size: 0.7rem;
  color: var(--cyan);
  letter-spacing: 0.1em;
}

.game-clock {
  font-size: 1.2rem;
  color: var(--gold);
}

.game-screen {
  flex: 1;
  overflow-y: auto;
  padding: 1.6rem;
}

.game-footer {
  padding: 0.55rem 1.4rem;
  background: var(--void);
  border-top: 2px solid var(--line);
  font-size: 1.05rem;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-btn {
  background: none;
  border: none;
  color: var(--cyan);
  font-family: var(--font-vt);
  font-size: 1.05rem;
  cursor: pointer;
}
.footer-btn:hover { color: var(--magenta); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 290px;
  background: var(--void);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-section {
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.1rem;
}

.sidebar-title {
  font-family: var(--font-px);
  font-size: 0.6rem;
  color: var(--cyan);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}
.stat-row .lbl { color: var(--gold); }
.stat-row .val { color: var(--magenta); }

.bar {
  width: 100%;
  height: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin: 0.2rem 0 0.6rem;
  overflow: hidden;
}
.bar-fill { height: 100%; transition: width 0.3s; }
.bar-hp .bar-fill { background: linear-gradient(90deg, var(--red), var(--gold)); }
.bar-kind .bar-fill { background: linear-gradient(90deg, var(--cyan), var(--green)); }

.inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}
.inv-item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s;
}
.inv-item:hover { border-color: var(--magenta); }
.inv-empty { opacity: 0.25; cursor: default; }

.quest-item {
  border-left: 3px solid var(--cyan);
  background: var(--panel);
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}
.quest-item.done { border-left-color: var(--green); opacity: 0.55; }
.quest-item .q-title { color: var(--magenta); }
.quest-item .q-prog { color: var(--cyan); font-size: 0.95rem; }

.bond-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}
.bond-stars { color: var(--gold); letter-spacing: 0.1em; }
.bond-name { color: var(--dim); font-size: 0.95rem; }

/* ---------- Exploration ---------- */
.loc-view { text-align: center; }
.loc-sprite { font-size: 4rem; margin-bottom: 0.4rem; }
.loc-name {
  font-family: var(--font-px);
  font-size: 1rem;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(61, 232, 255, 0.5);
  margin-bottom: 0.8rem;
}
.loc-desc {
  color: var(--dim);
  max-width: 58ch;
  margin: 0 auto 1.6rem;
  font-size: 1.3rem;
}

.npc-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  max-width: 720px;
  margin: 0 auto 1.6rem;
}

.npc-card {
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.npc-card:hover {
  border-color: var(--magenta);
  transform: translateY(-3px);
  box-shadow: 0 0 14px rgba(255, 61, 220, 0.25);
}
.npc-sprite { font-size: 2.2rem; }
.npc-name {
  font-family: var(--font-px);
  font-size: 0.6rem;
  color: var(--magenta);
  margin: 0.5rem 0 0.3rem;
}
.npc-status { font-size: 1rem; color: var(--cyan); }
.npc-status.friend { color: var(--green); }

.action-row { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }

.action-btn {
  font-family: var(--font-px);
  font-size: 0.6rem;
  padding: 0.8rem 1.2rem;
  background: var(--panel);
  border: 2px solid var(--cyan);
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}
.action-btn:hover {
  border-color: var(--magenta);
  color: var(--magenta);
  box-shadow: 0 0 10px rgba(255, 61, 220, 0.35);
}
.action-btn:active { transform: scale(0.96); }
.action-btn.gold { border-color: var(--gold); color: var(--gold); }
.action-btn.danger { border-color: var(--red); color: var(--red); }
.action-btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

/* ---------- Map ---------- */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  max-width: 760px;
  margin: 0 auto;
}
.map-tile {
  aspect-ratio: 1.1;
  background: var(--panel);
  border: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.map-tile:hover { border-color: var(--cyan); transform: translateY(-3px); }
.map-tile.current { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 210, 61, 0.4); }
.map-tile.locked { opacity: 0.4; cursor: not-allowed; }
.map-tile.locked:hover { transform: none; border-color: var(--line); }
.map-tile .m-emoji { font-size: 2.2rem; }
.map-tile .m-name { font-size: 1rem; color: var(--cyan); text-align: center; padding: 0 0.4rem; }
.map-tile .m-new { position: absolute; top: 6px; right: 8px; color: var(--gold); font-size: 0.95rem; }

/* ---------- Dialogue ---------- */
.dlg-box {
  background: var(--void);
  border: 3px solid var(--ink);
  padding: 1.4rem 1.6rem;
  max-width: 680px;
  margin: 0 auto 1.2rem;
  min-height: 130px;
  text-align: left;
}
.dlg-speaker {
  font-family: var(--font-px);
  font-size: 0.65rem;
  color: var(--cyan);
  margin-bottom: 0.8rem;
  letter-spacing: 0.12em;
}
.dlg-text { font-size: 1.4rem; color: var(--ink); line-height: 1.6; min-height: 2.2em; }
.dlg-text .caret { color: var(--magenta); animation: caretBlink 0.8s step-end infinite; }
@keyframes caretBlink { 50% { opacity: 0; } }

.dlg-choices {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.dlg-choice {
  text-align: left;
  font-family: var(--font-vt);
  font-size: 1.3rem;
  padding: 0.7rem 1rem;
  background: var(--panel);
  border: 2px solid var(--line);
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.15s;
}
.dlg-choice:hover {
  border-color: var(--magenta);
  color: var(--ink);
  background: var(--panel-2);
}
.dlg-choice::before { content: '♥ '; color: var(--magenta); opacity: 0; transition: opacity 0.15s; }
.dlg-choice:hover::before { opacity: 1; }

/* ---------- Battle ---------- */
.battle-view { max-width: 720px; margin: 0 auto; text-align: center; }

.battle-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}
.fighter {
  background: var(--void);
  border: 2px solid var(--line);
  padding: 1.1rem;
}
.fighter .f-name {
  font-family: var(--font-px);
  font-size: 0.65rem;
  margin-bottom: 0.7rem;
}
.fighter.you .f-name { color: var(--cyan); }
.fighter.foe .f-name { color: var(--red); }
.fighter .f-sprite { font-size: 2.8rem; margin-bottom: 0.6rem; }
.fighter.foe .f-sprite.hurt { animation: shake 0.3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.f-hp-num { font-size: 1.1rem; color: var(--red); margin-bottom: 0.25rem; }
.hp-bar {
  height: 14px;
  background: var(--panel);
  border: 1px solid var(--red);
  overflow: hidden;
}
.hp-bar .hp-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width 0.3s; }

.mercy-meter { margin-top: 0.7rem; }
.mercy-meter .mm-label { font-size: 0.95rem; color: var(--green); }
.mercy-bar {
  height: 8px;
  background: var(--panel);
  border: 1px solid var(--green);
  overflow: hidden;
}
.mercy-bar .mm-fill { height: 100%; background: var(--green); transition: width 0.3s; }

.battle-log {
  background: var(--void);
  border: 3px solid var(--ink);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.1rem;
  min-height: 88px;
  font-size: 1.3rem;
  text-align: left;
  color: var(--ink);
}

.battle-menu {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
}
.b-btn {
  font-family: var(--font-px);
  font-size: 0.7rem;
  padding: 0.95rem 0.4rem;
  background: var(--void);
  border: 2px solid;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}
.b-btn:active { transform: scale(0.96); }
.b-fight { border-color: var(--red); color: var(--red); }
.b-fight:hover { background: var(--red); color: var(--void); }
.b-act { border-color: var(--gold); color: var(--gold); }
.b-act:hover { background: var(--gold); color: var(--void); }
.b-item { border-color: var(--cyan); color: var(--cyan); }
.b-item:hover { background: var(--cyan); color: var(--void); }
.b-mercy { border-color: var(--green); color: var(--green); }
.b-mercy:hover { background: var(--green); color: var(--void); }

.sub-menu {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.8rem;
}
.sub-btn {
  font-family: var(--font-vt);
  font-size: 1.25rem;
  text-align: left;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border: 2px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}
.sub-btn:hover { border-color: var(--gold); }
.sub-btn small { color: var(--dim); }

/* ---------- Dodge (bullet box) ---------- */
.dodge-wrap { max-width: 560px; margin: 0 auto; text-align: center; }
.dodge-warning {
  font-family: var(--font-px);
  font-size: 0.75rem;
  color: var(--red);
  margin-bottom: 0.8rem;
  animation: warnFlash 0.5s step-end infinite;
}
@keyframes warnFlash { 50% { opacity: 0.3; } }

.dodge-box {
  position: relative;
  width: 100%;
  height: 300px;
  background: #000;
  border: 3px solid var(--ink);
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}
.soul {
  position: absolute;
  width: 22px;
  height: 22px;
  font-size: 20px;
  line-height: 22px;
  color: var(--magenta);
  text-shadow: 0 0 8px var(--magenta);
  will-change: transform;
  z-index: 2;
  pointer-events: none;
}
.soul.iframes { animation: soulFlicker 0.15s step-end infinite; }
@keyframes soulFlicker { 50% { opacity: 0.25; } }

.bullet {
  position: absolute;
  will-change: transform;
  z-index: 1;
  pointer-events: none;
  font-size: 18px;
  line-height: 1;
}

.dodge-hint { margin-top: 0.7rem; font-size: 1.1rem; color: var(--dim); }
.dodge-timer { font-size: 1.15rem; color: var(--gold); margin-top: 0.3rem; }

/* ---------- Shop ---------- */
.shop-list { max-width: 640px; margin: 0 auto; }
.shop-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 0.8rem 1.1rem;
  margin-bottom: 0.7rem;
  text-align: left;
}
.shop-row .s-emoji { font-size: 1.8rem; }
.shop-row .s-info { flex: 1; }
.shop-row .s-name { color: var(--ink); font-size: 1.3rem; }
.shop-row .s-desc { color: var(--dim); font-size: 1.05rem; }
.shop-row .s-cost { color: var(--gold); font-size: 1.15rem; white-space: nowrap; }

/* ---------- Ending ---------- */
.ending-view { max-width: 640px; margin: 2rem auto; text-align: center; }
.ending-rank {
  font-family: var(--font-px);
  font-size: 1.4rem;
  margin-bottom: 1.4rem;
  text-shadow: 0 0 18px currentColor;
}
.ending-body {
  background: var(--void);
  border: 3px solid var(--ink);
  padding: 1.8rem;
  font-size: 1.4rem;
  line-height: 1.8;
  color: var(--ink);
  margin-bottom: 1.4rem;
  text-align: left;
}
.ending-stats { color: var(--dim); font-size: 1.15rem; margin-bottom: 1.4rem; }

/* ---------- Toasts ---------- */
#toastContainer { position: fixed; top: 76px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 0.6rem; }
.toast {
  background: var(--void);
  border: 2px solid var(--green);
  color: var(--green);
  padding: 0.7rem 1.1rem;
  font-size: 1.15rem;
  animation: toastIn 0.3s ease-out;
  box-shadow: 0 0 14px rgba(77, 255, 158, 0.3);
}
.toast.gold { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 14px rgba(255, 210, 61, 0.3); }
@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ---------- Title screen ---------- */
.title-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  gap: 1.4rem;
  text-align: center;
}
.title-logo {
  font-family: var(--font-px);
  font-size: clamp(1.6rem, 5vw, 3rem);
  text-shadow: 3px 3px 0 var(--magenta), -3px -3px 0 var(--cyan);
}
.title-heart { font-size: 3rem; animation: heartHue 8s linear infinite, heartBeat 1.6s ease-in-out infinite; }
.title-menu { display: flex; flex-direction: column; gap: 0.8rem; width: min(320px, 90%); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  body.game-body { overflow: auto; }
  .game-wrapper { flex-direction: column; height: auto; min-height: calc(100vh - 62px); }
  .game-main { border-right: none; }
  .game-screen { min-height: 62vh; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; border-top: 2px solid var(--line); }
  .sidebar-section { flex: 1 1 45%; border-right: 1px solid var(--line); }
  .battle-menu { grid-template-columns: repeat(2, 1fr); }
  .battle-stage { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .dodge-box { height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  .dodge-warning, .title-heart { animation: none !important; }
}

/* ---- The Architect (hidden meta boss) ---- */
.meta-warning {
  border: 2px solid var(--magenta);
  background: rgba(255, 0, 255, 0.07);
  box-shadow: 0 0 18px rgba(255, 0, 255, 0.35), inset 0 0 18px rgba(255, 0, 255, 0.08);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  text-align: center;
  animation: metaFlicker 2.4s steps(2) infinite;
}
.mw-head {
  font-family: var(--font-px);
  font-size: 0.7rem;
  color: #ff00ff;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.8);
}
.mw-body { font-size: 1.15rem; color: var(--ink); }
.meta-sprite {
  color: #ff00ff;
  text-shadow: 0 0 12px rgba(255, 0, 255, 0.9), 2px 0 0 rgba(62, 242, 255, 0.5), -2px 0 0 rgba(255, 62, 165, 0.5);
}
@keyframes metaFlicker { 0%, 92% { opacity: 1; } 96% { opacity: 0.55; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .meta-warning { animation: none !important; } }
