:root {
  --bg-deep: #1e2235;
  --ink: #1d1b26;
  --paper: #fffdf5;
  --yellow: #ffd43b;
  --orange: #ff7b29;
  --red: #ff4757;
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --green: #22c55e;
  --purple: #9333ea;
  --border: 3px solid #1d1b26;
  --shadow: 4px 4px 0px #1d1b26;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: radial-gradient(circle at top, #2e3659 0%, #171a2b 100%);
  color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
}

#app {
  width: 100%;
  height: 100%;
  max-width: 1180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

#app:fullscreen,
#app:-webkit-full-screen,
#app.is-fullscreen {
  position: fixed;
  inset: 0;
  max-width: none;
  width: 100vw;
  height: 100dvh;
  padding: 8px 14px;
  background: radial-gradient(circle at top, #2e3659 0%, #171a2b 100%);
  z-index: 9999;
}

/* HUD Bar */
.hud-bar {
  flex-shrink: 0;
  background: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 6px 12px;
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 1.05fr;
  align-items: center;
  gap: 10px;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-icon {
  font-size: 15px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-shrink: 0;
}

/* Custom Comic Sticker UI Icons */
.ui-ico {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  object-fit: contain;
  vertical-align: -0.22em;
  pointer-events: none;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 0 rgba(29, 27, 38, 0.2));
}

.hud-stat-ico {
  width: 21px;
  height: 21px;
  vertical-align: middle;
}

.hud-btn-ico {
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

.prog-ico {
  width: 22px;
  height: 22px;
  vertical-align: middle;
}

.btn-ico {
  width: 1.35em;
  height: 1.35em;
  margin-right: 3px;
  vertical-align: -0.26em;
}

.skin-ico-img {
  width: 44px;
  height: 44px;
  vertical-align: middle;
}

.partner-ico-img {
  width: 38px;
  height: 38px;
  vertical-align: middle;
}

.rblx-ico-img {
  width: 26px;
  height: 26px;
  vertical-align: middle;
}

.rotate-ico-img {
  width: 56px;
  height: 56px;
  vertical-align: middle;
}

.bar-track {
  flex: 1;
  height: 14px;
  background: #e5e7eb;
  border: 2px solid var(--ink);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  transition: width 0.14s ease-out;
  border-radius: 99px;
}

.hp-fill {
  background: linear-gradient(90deg, #ff5e6c, #ff2e43);
}

.mood-fill {
  background: linear-gradient(90deg, #38bdf8, #2563eb);
}

.rage-fill {
  background: linear-gradient(90deg, #facc15, #f97316, #ef4444);
}

.rage-pill.ready .bar-track {
  animation: pulse-glow 0.6s infinite alternate;
}

.rage-pill.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

@keyframes pulse-glow {
  from { box-shadow: 0 0 0 0 rgba(255, 123, 41, 0.8); }
  to { box-shadow: 0 0 12px 3px rgba(255, 71, 87, 0.95); }
}

.stat-val {
  font-size: 12px;
  font-weight: 900;
  min-width: 34px;
  text-align: right;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stage-badge {
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 2px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.progress-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
}

.progress-track {
  flex: 1;
  height: 12px;
  background: #f1f5f9;
  border: 2px solid var(--ink);
  border-radius: 99px;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #16a34a);
  border-radius: 99px;
  transition: width 0.12s linear;
}

.progress-runner {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -55%) scaleX(-1);
  font-size: 15px;
  pointer-events: none;
  transition: left 0.12s linear;
}

.progress-label {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
}

.hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.counter-box {
  background: #fff1f2;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 54px;
}

.score-box {
  background: #fefce8;
}

.counter-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
}

.counter-num {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #f8fafc;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s;
}

.icon-btn:hover {
  background: var(--yellow);
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* Main Game Stage Area — guarantees exact 16:9 fit with ZERO cropping or scrollbars */
.stage-area {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}

/* Main Game Canvas Wrapper */
.stage-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
  background: #87ceeb;
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Ultimate Ready Toast */
.ult-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ff4757, #ff7b29);
  color: #fff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 99px;
  padding: 6px 18px;
  font-size: 14px;
  font-weight: 900;
  z-index: 5;
  animation: bounce-toast 0.75s infinite alternate;
  pointer-events: none;
  white-space: nowrap;
}

.ult-toast kbd {
  background: #fff;
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 5px;
  border: 2px solid var(--ink);
  font-family: inherit;
}

@keyframes bounce-toast {
  from { transform: translateX(-50%) translateY(0px) scale(1); }
  to { transform: translateX(-50%) translateY(-4px) scale(1.04); }
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 38, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.comic-card {
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  border-radius: 18px;
  padding: 20px 26px;
  max-width: 700px;
  width: 100%;
  text-align: center;
  position: relative;
  max-height: 96%;
  overflow-y: auto;
}

.title-stamp {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 2px 12px;
  font-size: 12px;
  font-weight: 900;
  transform: rotate(-2deg);
  margin-bottom: 6px;
}

.game-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

.title-top {
  font-size: clamp(26px, 4.2vw, 40px);
  font-weight: 900;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--yellow);
  line-height: 1.15;
}

.title-sub {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--orange);
  margin-top: 2px;
}

.title-tagline {
  font-size: 12.5px;
  line-height: 1.5;
  color: #334155;
  margin-bottom: 10px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 8px 10px;
}

.ctrl-item {
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #1e293b;
  font-weight: 700;
}

.ctrl-item kbd {
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 900;
  margin: 0 1px;
  box-shadow: 1px 1px 0 var(--ink);
}

/* Organized Title Toolbar (Account + Device + Difficulty neatly boxed!) */
.title-toolbar {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 7px 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title-tool-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-sep {
  color: #94a3b8;
  font-weight: 900;
}

.difficulty-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 0;
  font-size: 12.5px;
  font-weight: 800;
}

.diff-label {
  color: #475569;
  white-space: nowrap;
}

.diff-group {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px;
}

.diff-btn {
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 99px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.1s;
}

.diff-btn.active {
  background: var(--ink);
  color: var(--yellow);
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* Crisp Symmetrical Main Title Button Grid (1 Full Hero CTA + 2 Equal Split Columns!) */
.title-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-bottom: 10px;
}

.title-main-grid .btn-hero-full {
  grid-column: 1 / -1;
  width: 100%;
}

.title-main-grid button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

/* Clean 3x2 Equal-Width Quick-Preview Stage Grid! */
.quick-stage-box {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 7px 9px 9px;
}

.quick-label {
  font-size: 11.5px;
  font-weight: 900;
  color: #475569;
  margin-bottom: 6px;
  text-align: center;
}

.quick-stage-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.quick-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.quick-stage-grid .btn-mini {
  width: 100%;
  border-radius: 10px;
  padding: 5px 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-mini {
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  background: #e0f2fe;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 4px 11px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.08s, background 0.1s;
}

.btn-mini:hover {
  background: #fef08a;
}

.btn-mini:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* ==================== LEFT-DOCKED UNIFIED BUTTON MENU BOX ON TITLE SCREEN ==================== */
.overlay-title-split {
  justify-content: flex-start;
  align-items: stretch;
  gap: 14px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.45) 55%, rgba(15, 23, 42, 0.35) 100%);
}

.title-left-panel {
  width: 300px;
  max-width: 320px;
  flex-shrink: 0;
  max-height: 100%;
  padding: 11px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 253, 245, 0.97);
}

.menu-box-header {
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  background: var(--ink);
  border-radius: 9px;
  padding: 4px 10px;
  text-align: center;
  letter-spacing: 1px;
}

.menu-section-label {
  font-size: 11px;
  font-weight: 900;
  color: #64748b;
  margin-top: 2px;
  padding-left: 2px;
}

.menu-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-btn-full {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  text-align: center;
  box-shadow: 3px 3px 0 var(--ink);
}

.menu-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.menu-grid-2 .btn-mini {
  width: 100%;
  border-radius: 9px;
  padding: 5px 5px;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.menu-diff-grid .diff-btn {
  width: 100%;
  padding: 4px 4px;
  font-size: 11px;
  border-radius: 8px;
  text-align: center;
}

.menu-span-2 {
  grid-column: 1 / -1;
}

.menu-status-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
  padding-top: 5px;
  border-top: 2px dashed #cbd5e1;
}

.menu-status-footer .account-pill,
.menu-status-footer .device-pill {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-right-showcase {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.title-hero-card {
  background: rgba(255, 253, 245, 0.92);
  border: 4px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  border-radius: 18px;
  padding: 18px 20px;
  max-width: 560px;
  width: 100%;
  text-align: center;
}

/* Mobile Left-Side Unified Menu Box (Thumb-Friendly Larger Buttons!) */
#app.mobile-mode .overlay-title-split {
  gap: 10px;
  padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
}

#app.mobile-mode .title-left-panel {
  width: 288px;
  max-width: 64vw;
  padding: 9px 10px;
  gap: 6px;
}

#app.mobile-mode .menu-box-header {
  font-size: 13px;
  padding: 4px 8px;
}

#app.mobile-mode .menu-section-label {
  font-size: 11px;
  margin-top: 2px;
}

#app.mobile-mode .menu-stack {
  gap: 6px;
}

#app.mobile-mode .menu-btn-full {
  padding: 9px 10px;
  font-size: 13.5px;
}

#app.mobile-mode .menu-grid-2,
#app.mobile-mode .menu-diff-grid {
  gap: 6px;
}

#app.mobile-mode .menu-grid-2 .btn-mini,
#app.mobile-mode .menu-diff-grid .diff-btn {
  font-size: 12px;
  padding: 7px 6px;
  border-radius: 9px;
}

#app.mobile-mode .menu-status-footer .account-pill,
#app.mobile-mode .menu-status-footer .device-pill {
  font-size: 10px;
  padding: 3px 6px;
}

#app.mobile-mode .title-hero-card {
  padding: 10px 12px;
  border-width: 2.5px;
  box-shadow: 4px 4px 0 var(--ink);
}

@media (max-width: 560px) {
  .overlay-title-split {
    flex-direction: column;
    align-items: flex-start;
  }
  .title-left-panel {
    width: 100%;
    max-width: 100%;
    max-height: 70dvh;
  }
  .title-right-showcase {
    display: none;
  }
}

/* Interactive Quiz Dock Overlay (keeps top First-Person & Living Room Canvas bright & interactive!) */
.overlay-quiz {
  background: linear-gradient(
    to bottom,
    rgba(20, 22, 38, 0) 0%,
    rgba(20, 22, 38, 0) 54%,
    rgba(20, 22, 38, 0.45) 70%
  );
  backdrop-filter: none;
  align-items: flex-end;
  padding: 10px 14px;
  pointer-events: none;
}

.quiz-dock {
  background: rgba(255, 253, 245, 0.95);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  border-radius: 16px;
  padding: 10px 16px;
  width: 100%;
  max-width: 900px;
  text-align: left;
  max-height: 46%;
  overflow-y: auto;
  pointer-events: auto;
}

.quiz-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.quiz-header-row .event-tag {
  margin-bottom: 0;
}

.quiz-subbadge {
  background: #fee2e2;
  color: #991b1b;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 900;
}

.quiz-title {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 4px;
  color: var(--ink);
}

.quiz-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: #334155;
  margin-bottom: 8px;
  font-weight: 600;
}

.quiz-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quiz-choices .choice-btn {
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
}

.quiz-result {
  background: #fef9c3;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-result p {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--ink);
}

/* Skin Shop Modal */
.shop-card {
  max-width: 820px;
  padding: 16px 22px;
  text-align: left;
}

.shop-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.shop-title {
  font-size: 20px;
  font-weight: 900;
  margin-top: 2px;
}

.wallet-pill {
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 900;
}

.shop-sub {
  font-size: 12.5px;
  color: #475569;
  font-weight: 700;
  margin-bottom: 10px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.skin-card {
  background: #ffffff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: transform 0.08s;
}

.skin-card.equipped {
  background: #fef9c3;
  border-color: #ca8a04;
}

.skin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.skin-icon {
  font-size: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.skin-price {
  background: #f1f5f9;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 900;
}

.skin-price.owned {
  background: #bbf7d0;
  color: #14532d;
}

.skin-name {
  font-size: 14.5px;
  font-weight: 900;
  color: var(--ink);
}

.skin-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: #475569;
  font-weight: 600;
  flex: 1;
}

.skin-btn {
  width: 100%;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 900;
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  padding: 6px 8px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  background: var(--yellow);
  color: var(--ink);
}

.skin-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.skin-btn.equip {
  background: #bae6fd;
}

.skin-btn.equipped {
  background: #4ade80;
  cursor: default;
}

.skin-btn.locked {
  background: #e2e8f0;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.shop-msg {
  min-height: 20px;
  font-size: 13px;
  font-weight: 900;
  color: #dc2626;
  text-align: center;
  margin-bottom: 6px;
}

.shop-msg.ok {
  color: #15803d;
}

/* Secret Code Modal & Girlfriend Route Styling */
.gf-banner {
  background: linear-gradient(90deg, #fce7f3, #ffe4e6, #fce7f3);
  color: #be123c;
  border: 2.5px solid #e11d48;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 10px;
  box-shadow: 2px 2px 0 #be123c;
}

.secret-card {
  max-width: 460px;
}

.secret-tag {
  background: #ec4899;
}

.secret-input-row {
  margin: 10px 0 6px;
}

.secret-input {
  width: 100%;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.secret-input:focus {
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.25);
}

.secret-feedback {
  min-height: 22px;
  font-size: 13px;
  font-weight: 900;
  color: #dc2626;
  margin-bottom: 10px;
}

.secret-feedback.ok {
  color: #db2777;
}

.ending-badge.gf-win {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
}

.notebook-card.gf-notebook {
  background: repeating-linear-gradient(
    to bottom,
    #fff5f8 0px,
    #fff5f8 27px,
    #fbcfe8 28px
  );
  border-color: #be123c;
}

/* Account Bar, Auth Modal & Shop Tabs */
.title-account-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.account-pill {
  background: #f1f5f9;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #1e293b;
}

.account-pill.logged-in {
  background: #dcfce7;
  color: #14532d;
}

.btn-auth-mini {
  background: #fef08a;
}

.btn-raid-mini {
  background: #fecaca;
}

.btn-weekend-mini {
  background: #bbf7d0;
}

.ending-badge.weekend-win {
  background: linear-gradient(135deg, #0ea5e9, #10b981);
}

.notebook-card.weekend-notebook {
  background: repeating-linear-gradient(
    to bottom,
    #f0fdf4 0px,
    #f0fdf4 27px,
    #bae6fd 28px
  );
  border-color: #0284c7;
}

.shop-tabs,
.auth-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 8px;
}

.shop-tab {
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  background: #f1f5f9;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  padding: 5px 14px;
  cursor: pointer;
}

.shop-tab.active {
  background: var(--ink);
  color: var(--yellow);
}

.auth-card {
  max-width: 480px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 6px;
}

.auth-input {
  font-size: 15px;
  padding: 8px 12px;
}

/* ==================== CO-OP MATCHMAKING & RIGHT-SIDE LIVE CHAT ==================== */
.btn-coop {
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  color: #ffffff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-coop:hover {
  filter: brightness(1.08);
}

.btn-coop:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.coop-card {
  max-width: 520px;
  margin-right: 170px;
  padding: 14px 18px;
}

.coop-card .event-title {
  font-size: 18px;
  margin-bottom: 4px;
}

.coop-card .event-desc {
  font-size: 12px;
  margin-bottom: 6px;
}

.coop-launch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.coop-launch-btn {
  width: 100%;
  font-size: 14.5px !important;
  padding: 10px 14px !important;
  text-align: center;
}

.coop-tag {
  background: linear-gradient(135deg, #0284c7, #4f46e5);
}

.coop-loadout-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 8px;
}

.coop-loadout-pill {
  background: #f1f5f9;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 800;
  color: #0f172a;
}

.coop-loadout-pill.active {
  background: #dcfce7;
  color: #14532d;
}

.coop-loadout-pill.gf {
  background: #fce7f3;
  color: #be123c;
  border-color: #e11d48;
}

.coop-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #eff6ff;
  border: 2.5px dashed #2563eb;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.coop-radar-icon {
  font-size: 24px;
}

.coop-status-text {
  font-size: 13px;
  font-weight: 800;
  color: #1e3a8a;
  text-align: left;
}

.coop-partner-card {
  background: #fefce8;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  text-align: left;
  box-shadow: 3px 3px 0 var(--ink);
}

.coop-partner-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.coop-partner-avatar {
  font-size: 30px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.coop-partner-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

.coop-partner-meta {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.coop-online-dot {
  margin-left: auto;
  font-size: 11px;
  font-weight: 900;
  background: #bbf7d0;
  color: #14532d;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  padding: 2px 8px;
}

.coop-partner-quote {
  font-size: 12.5px;
  font-weight: 800;
  color: #1e293b;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 5px 9px;
}

.coop-chat-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 240px;
  max-height: calc(100% - 20px);
  z-index: 35;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.9);
  border: 3px solid #38bdf8;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  color: #f8fafc;
  overflow: hidden;
  pointer-events: auto;
}

.coop-chat-panel.collapsed .coop-chat-messages,
.coop-chat-panel.collapsed .coop-chat-quick,
.coop-chat-panel.collapsed .coop-chat-input-row {
  display: none;
}

/* Live Mutual-Aid Action Bar inside Co-op Right Panel (Stays visible even when chat collapses!) */
.coop-help-bar {
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.92), rgba(15, 23, 42, 0.96));
  border-bottom: 2px solid #38bdf8;
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.coop-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  color: #fef08a;
}

.coop-ally-hp-pill {
  background: rgba(15, 23, 42, 0.72);
  border: 1.5px solid #4ade80;
  color: #bbf7d0;
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 900;
}

.coop-help-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coop-help-btn {
  width: 100%;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 900;
  background: linear-gradient(135deg, #22c55e, #10b981);
  color: #052e16;
  border: 2px solid #ffffff;
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, filter 0.1s ease;
}

.coop-help-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.coop-help-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.coop-help-btn:disabled,
.coop-help-btn.cooling {
  background: #334155;
  color: #94a3b8;
  border-color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.coop-help-btn.alt {
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #1d1b26;
}

.coop-help-btn.pink {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #0f172a;
}

.choice-btn.coop-recommended {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0) !important;
  border-color: #16a34a !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35), 3px 3px 0 var(--ink) !important;
}

.coop-msg.help {
  border-left-color: #22c55e;
  background: rgba(20, 83, 45, 0.72);
  color: #dcfce7;
  font-weight: 800;
}

/* 2-Player Top-Down Exam & Sibling Look Floating Bar */
.exam-peek-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(254, 249, 195, 0.96);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
}

.exam-desk-bar {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 26;
  max-width: calc(100% - 24px);
  pointer-events: auto;
}

.exam-desk-bar.top-position {
  top: 42px;
  bottom: auto;
}

#app.mobile-mode .exam-desk-bar {
  bottom: 6px;
  max-width: calc(100% - 14px);
}

.exam-look-btn.active {
  background: var(--ink);
  color: var(--yellow);
}

.exam-lean-btn {
  background: #bbf7d0;
}

.exam-lean-btn.active {
  background: #16a34a;
  color: #ffffff;
}

.exam-sync-pill {
  background: #0f172a;
  color: #fef08a;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 900;
}

#app.mobile-mode .exam-peek-bar {
  gap: 5px;
  padding: 4px 6px;
}

#app.mobile-mode .exam-look-btn,
#app.mobile-mode .exam-lean-btn {
  font-size: 11.5px;
  padding: 5px 8px;
}

.coop-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(90deg, #0284c7, #4f46e5);
  font-size: 12px;
  font-weight: 900;
  color: #fef08a;
}

.coop-chat-min {
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  border: 1.5px solid #fff;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.coop-chat-messages {
  flex: 1;
  min-height: 110px;
  max-height: 225px;
  overflow-y: auto;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  line-height: 1.38;
}

.coop-msg {
  background: rgba(30, 41, 59, 0.95);
  border-left: 3px solid #38bdf8;
  border-radius: 6px;
  padding: 4px 7px;
  word-break: break-word;
}

.coop-msg.sys {
  border-left-color: #facc15;
  color: #fef08a;
  font-weight: 800;
}

.coop-msg.me {
  border-left-color: #4ade80;
  background: rgba(20, 83, 45, 0.55);
}

.coop-msg.gf {
  border-left-color: #ec4899;
  background: rgba(131, 24, 67, 0.65);
  color: #fbcfe8;
}

.coop-msg.boss {
  border-left-color: #ef4444;
  background: rgba(127, 29, 29, 0.72);
  color: #fecaca;
}

.coop-msg strong {
  color: #7dd3fc;
}

.coop-msg.me strong {
  color: #86efac;
}

.coop-msg.gf strong {
  color: #f9a8d4;
}

.coop-msg.boss strong {
  color: #fca5a5;
}

.coop-chat-quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 5px 7px;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.coop-qbtn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  background: #1e293b;
  color: #e2e8f0;
  border: 1.5px solid #475569;
  border-radius: 7px;
  padding: 3px 5px;
  cursor: pointer;
}

.coop-qbtn:hover {
  background: #0284c7;
  color: #fff;
}

.coop-chat-input-row {
  display: flex;
  gap: 4px;
  padding: 5px 7px 7px;
}

.coop-chat-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  background: #0f172a;
  color: #fff;
  border: 1.5px solid #475569;
  border-radius: 7px;
  padding: 4px 7px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.coop-chat-input:focus {
  border-color: #38bdf8;
}

.coop-chat-send {
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  background: #facc15;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  padding: 4px 8px;
  cursor: pointer;
}

.ending-badge.coop-win {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
}

/* Real Online Multiplayer Lobby Controls & Player List */
.coop-room-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.coop-mini-input {
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 118px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.coop-code-input {
  width: 88px;
  text-align: center;
  text-transform: uppercase;
}

.btn-coop-mini {
  background: #bae6fd;
}

.coop-room-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  background: #dcfce7;
  border: 2px solid #16a34a;
  border-radius: 10px;
  padding: 5px 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 900;
  color: #14532d;
}

.coop-invite-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fef08a;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 900;
}

.coop-online-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 112px;
  overflow-y: auto;
  margin-bottom: 8px;
  text-align: left;
}

.coop-online-empty {
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  text-align: center;
  line-height: 1.45;
}

.coop-peer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.coop-peer-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.coop-peer-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  background: #fde047;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
}

#app.mobile-mode .coop-mini-input {
  font-size: 10px;
  padding: 2px 5px;
  width: 82px;
}

#app.mobile-mode .coop-code-input {
  width: 66px;
}

#app.mobile-mode .coop-online-list {
  max-height: 76px;
}

#app.mobile-mode .coop-peer-row,
#app.mobile-mode .coop-room-banner,
#app.mobile-mode .coop-invite-banner,
#app.mobile-mode .coop-online-empty {
  font-size: 10px;
  padding: 3px 6px;
}

.bg-locked-box {
  grid-column: 1 / -1;
  background: #f8fafc;
  border: 3px dashed #94a3b8;
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #475569;
  line-height: 1.7;
}

@media (max-width: 760px) {
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .quiz-choices {
    grid-template-columns: 1fr;
  }
  .quiz-result {
    flex-direction: column;
    align-items: stretch;
  }
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  font-family: inherit;
  font-size: 15px;
  font-weight: 900;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn-primary {
  background: var(--yellow);
  color: var(--ink);
}

.btn-primary:hover {
  background: #ffe066;
}

.btn-secondary {
  background: #dbeafe;
  color: var(--ink);
}

.btn-secondary:hover {
  background: #bfdbfe;
}

.btn-ghost {
  background: #f1f5f9;
  color: var(--ink);
}

.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

/* Event Choice Card */
.event-card {
  max-width: 560px;
}

.event-tag {
  display: inline-block;
  background: var(--purple);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 3px 14px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
}

.event-emoji {
  font-size: 50px;
  margin: 4px 0;
  animation: wobble 1.4s infinite ease-in-out;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg) scale(1.06); }
}

.event-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
}

.event-desc {
  font-size: 14.5px;
  line-height: 1.65;
  color: #334155;
  margin-bottom: 14px;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  text-align: left;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.1s, transform 0.08s;
}

.choice-btn:hover {
  background: #fef08a;
  transform: translateX(3px);
}

.choice-hint {
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}

.event-result {
  background: #fef9c3;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
}

.event-result p {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
  margin-bottom: 10px;
}

/* Transition Card */
.transition-card {
  max-width: 580px;
}

.transition-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 10px;
}

.transition-desc {
  font-size: 14px;
  line-height: 1.7;
  color: #334155;
  margin-bottom: 14px;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.mini-pill {
  background: #f1f5f9;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

/* Notebook Ending Card */
.notebook-card {
  background: repeating-linear-gradient(
    to bottom,
    #fffef7 0px,
    #fffef7 27px,
    #dbeafe 28px
  );
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  border-radius: 14px;
  padding: 20px 26px 20px 44px;
  max-width: 680px;
  width: 100%;
  max-height: 95%;
  overflow-y: auto;
  position: relative;
  text-align: left;
}

.notebook-card::before {
  content: "";
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #fca5a5;
}

.notebook-holes {
  position: absolute;
  left: 8px;
  top: 24px;
  bottom: 24px;
  width: 14px;
  background-image: radial-gradient(circle, #334155 4px, transparent 5px);
  background-size: 14px 44px;
}

.notebook-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.ending-badge {
  background: var(--green);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 900;
}

.ending-badge.lose {
  background: var(--red);
}

.ending-rank {
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 900;
}

.ending-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
}

.diary-body {
  font-size: 14px;
  line-height: 28px;
  color: #1e293b;
  font-weight: 600;
  margin-bottom: 12px;
}

.ending-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.metric-box {
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 6px 8px;
  text-align: center;
}

.metric-box .m-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 800;
}

.metric-box .m-val {
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
}

/* Bottom Ticker & Touch Controls */
.bottom-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ticker-box {
  background: var(--ink);
  color: #fff;
  border: 3px solid #000;
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  min-height: 34px;
}

.ticker-label {
  background: var(--yellow);
  color: var(--ink);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.ticker-text {
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.touch-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.touch-group {
  display: flex;
  gap: 6px;
}

.touch-btn {
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  border-radius: 10px;
  padding: 6px 11px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.touch-btn:active,
.touch-btn.pressed {
  transform: translate(2px, 2px);
  box-shadow: none;
  background: var(--yellow);
}

.touch-btn.btn-jump { background: #bbf7d0; }
.touch-btn.btn-block { background: #bfdbfe; }
.touch-btn.btn-ult { background: #fecaca; }

@media (max-width: 760px) {
  .hud-bar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 5px 8px;
  }
  .controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ending-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .coop-card {
    margin-right: 0;
  }
  .coop-chat-panel {
    width: 190px;
    top: 6px;
    right: 6px;
  }
}

/* ==================== DEVICE DETECTION & ROBLOX-STYLE MOBILE CONTROLS ==================== */
.title-device-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.device-pill {
  background: #e0f2fe;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #0c4a6e;
}

.device-pill.is-mobile {
  background: #dcfce7;
  color: #14532d;
  border-color: #16a34a;
}

.btn-mobile-mini {
  background: #bae6fd;
}

#btn-mobile-mode.active-mobile {
  background: #4ade80;
  color: #052e16;
}

/* Hide legacy bottom touch bar when sleek Roblox overlay is active */
#app.mobile-mode .touch-controls {
  display: none;
}

/* Top-left Mobile Assist Pills */
.mobile-assist-bar {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 26;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 62%;
  pointer-events: auto;
}

.assist-chip {
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  border: 2px solid rgba(148, 163, 184, 0.65);
  border-radius: 99px;
  padding: 3px 9px;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(4px);
}

.assist-chip.active {
  background: rgba(16, 185, 129, 0.88);
  color: #ffffff;
  border-color: #fef08a;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Mobile Full-Viewport Translucent Touch Controls */
.roblox-controls {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.roblox-joy-zone {
  position: absolute;
  left: 18px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  touch-action: none;
}

.roblox-joy-base {
  position: relative;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.25) 0%, rgba(15, 23, 42, 0.54) 100%);
  border: 3px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.roblox-joy-base.active {
  border-color: #fde047;
  box-shadow: inset 0 0 22px rgba(250, 204, 21, 0.28), 0 0 16px rgba(250, 204, 21, 0.35);
}

.joy-dir {
  position: absolute;
  font-size: 11px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.joy-left { left: 9px; top: 50%; transform: translateY(-50%); }
.joy-right { right: 9px; top: 50%; transform: translateY(-50%); }
.joy-down { bottom: 7px; left: 50%; transform: translateX(-50%); }

.roblox-joy-knob {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, rgba(255, 255, 255, 0.96), rgba(203, 213, 225, 0.8));
  border: 3px solid rgba(15, 23, 42, 0.72);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  transition: transform 0.04s linear;
}

.roblox-joy-base.active .roblox-joy-knob {
  background: radial-gradient(circle at 35% 32%, #ffffff, #fef08a);
  transition: none;
}

.roblox-joy-hint {
  font-size: 10.5px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(15, 23, 42, 0.58);
  border-radius: 99px;
  padding: 1px 8px;
  pointer-events: none;
}

/* Right-Side Roblox Circular Action Cluster */
.roblox-action-pad {
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: 174px;
  height: 152px;
  pointer-events: none;
}

.rblx-btn {
  position: absolute;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.78);
  background: rgba(15, 23, 42, 0.48);
  color: #ffffff;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(4px);
  transition: transform 0.06s ease, background 0.08s ease;
}

.rblx-btn:active,
.rblx-btn.pressed {
  transform: scale(0.92);
  border-color: #fde047;
}

.rblx-ico {
  font-size: 20px;
  line-height: 1;
}

.rblx-lbl {
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Iconic Big Roblox Bottom-Right Jump Button */
.rblx-jump {
  right: 0;
  bottom: 0;
  width: 82px;
  height: 82px;
  background: rgba(34, 197, 94, 0.56);
}

.rblx-jump .rblx-ico {
  font-size: 26px;
}

.rblx-jump.pressed {
  background: rgba(74, 222, 128, 0.88);
}

/* Book Shield Button right beside Jump */
.rblx-block {
  right: 92px;
  bottom: 8px;
  width: 66px;
  height: 66px;
  background: rgba(14, 165, 233, 0.58);
}

.rblx-block.pressed {
  background: rgba(56, 189, 248, 0.9);
}

/* Crouch Quick Button */
.rblx-duck {
  right: 96px;
  bottom: 84px;
  width: 54px;
  height: 54px;
  background: rgba(100, 116, 139, 0.56);
}

.rblx-duck .rblx-ico {
  font-size: 17px;
}

.rblx-duck.pressed {
  background: rgba(148, 163, 184, 0.88);
}

/* School Ultimate Button (Pulses Golden when Ready!) */
.rblx-ult {
  right: 8px;
  bottom: 92px;
  width: 62px;
  height: 62px;
  background: rgba(239, 68, 68, 0.58);
  opacity: 0.65;
}

.rblx-ult.ready {
  opacity: 1;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.95), rgba(239, 68, 68, 0.92));
  border-color: #ffffff;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.85);
  animation: rblxPulse 0.9s infinite alternate ease-in-out;
}

@keyframes rblxPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* Extra Mobile Viewport Ergonomics — Ultra-Compact Landscape & Portrait Sizing! */
.btn-landscape-mini {
  background: #fde68a;
}

.desktop-locked,
button.desktop-locked {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  background: #e2e8f0 !important;
  color: #64748b !important;
  box-shadow: none !important;
}

/* Rotate Phone to Landscape Prompt Overlay */
.rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rotate-card {
  max-width: 340px;
  padding: 18px 16px;
}

.rotate-phone-anim {
  font-size: 46px;
  margin-bottom: 6px;
  display: inline-block;
  animation: tiltLandscape 1.6s infinite ease-in-out;
}

@keyframes tiltLandscape {
  0%, 20% { transform: rotate(0deg); }
  55%, 80% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

.rotate-title {
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 6px;
}

.rotate-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: #334155;
  font-weight: 700;
  margin-bottom: 12px;
}

/* ==================== ULTRA-COMPACT MOBILE MODE (CLEAR OF BOTTOM BANNER & ZERO BUTTON OVERLAP!) ==================== */
body.mobile-body {
  padding: 3px max(4px, env(safe-area-inset-right)) max(58px, calc(env(safe-area-inset-bottom) + 52px)) max(4px, env(safe-area-inset-left));
}

#app.mobile-mode {
  gap: 3px;
  max-width: none;
}

#app.mobile-mode .hud-bar {
  position: relative;
  z-index: 50;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 7px;
  border-width: 2px;
  border-radius: 9px;
  box-shadow: 2px 2px 0 var(--ink);
}

#app.mobile-mode .hud-left {
  flex-direction: row;
  align-items: center;
  gap: 5px;
  flex: 1.15;
  min-width: 0;
}

#app.mobile-mode .stat-pill {
  flex: 1;
  gap: 3px;
  min-width: 0;
}

#app.mobile-mode .stat-icon {
  font-size: 11px;
  width: 13px;
}

#app.mobile-mode .bar-track {
  height: 8px;
  border-width: 1.5px;
  min-width: 24px;
}

#app.mobile-mode .stat-val {
  font-size: 9.5px;
  min-width: 20px;
}

#app.mobile-mode .hud-center {
  flex: 1;
  gap: 2px;
  min-width: 0;
}

#app.mobile-mode .stage-badge {
  font-size: 9.5px;
  padding: 1px 7px;
  border-width: 1.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app.mobile-mode .progress-wrap {
  font-size: 11px;
  gap: 3px;
}

#app.mobile-mode .progress-track {
  height: 7px;
  border-width: 1.5px;
}

#app.mobile-mode .progress-runner {
  font-size: 11px;
}

#app.mobile-mode .progress-label {
  display: none;
}

#app.mobile-mode .hud-right {
  gap: 4px;
  flex-shrink: 0;
}

#app.mobile-mode .counter-box {
  padding: 1px 5px;
  min-width: 34px;
  border-width: 1.5px;
  border-radius: 7px;
}

#app.mobile-mode .counter-label {
  font-size: 8px;
}

#app.mobile-mode .counter-num {
  font-size: 11px;
}

#app.mobile-mode .icon-btn {
  width: 34px;
  height: 34px;
  font-size: 16px;
  border-width: 2px;
  border-radius: 9px;
  box-shadow: 2px 2px 0 var(--ink);
}

#app.mobile-mode .stage-shell {
  border-width: 2.5px;
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
}

#app.mobile-mode .bottom-bar {
  display: none;
}

#app.mobile-mode .ticker-box {
  padding: 2px 7px;
  min-height: 22px;
  font-size: 10px;
  border-width: 2px;
  border-radius: 7px;
  gap: 6px;
}

#app.mobile-mode .ticker-label {
  font-size: 9px;
  padding: 1px 5px;
}

/* Make full-screen overlays fit effortlessly ABOVE bottom hosting badges & mobile gesture bars! */
#app.mobile-mode .overlay:not(.overlay-quiz) {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 6px max(8px, env(safe-area-inset-right)) max(62px, calc(env(safe-area-inset-bottom) + 56px)) max(8px, env(safe-area-inset-left));
}

#app.mobile-mode .comic-card {
  padding: 10px 12px;
  border-width: 2.5px;
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  max-height: calc(100dvh - 72px);
  -webkit-overflow-scrolling: touch;
}

#app.mobile-mode .title-card {
  max-width: 660px;
  padding: 8px 12px;
}

#app.mobile-mode .title-stamp {
  font-size: 9.5px;
  padding: 1px 8px;
  margin-bottom: 2px;
}

#app.mobile-mode .game-title {
  margin-bottom: 4px;
}

#app.mobile-mode .title-top {
  font-size: 21px;
  line-height: 1.1;
}

#app.mobile-mode .title-sub {
  font-size: 10px;
}

#app.mobile-mode .title-tagline {
  font-size: 10.5px;
  line-height: 1.35;
  margin-bottom: 5px;
}

#app.mobile-mode .controls-grid {
  display: none;
}

#app.mobile-mode .title-toolbar {
  padding: 4px 7px;
  margin-bottom: 5px;
  gap: 4px;
}

#app.mobile-mode .title-tool-row {
  gap: 4px;
}

#app.mobile-mode .tool-sep {
  display: none;
}

#app.mobile-mode .title-main-grid {
  gap: 5px;
  margin-bottom: 5px;
}

#app.mobile-mode .quick-stage-box {
  padding: 4px 6px 6px;
}

#app.mobile-mode .quick-label {
  font-size: 9.5px;
  margin-bottom: 4px;
}

#app.mobile-mode .quick-stage-grid {
  gap: 4px;
}

#app.mobile-mode .quick-stage-grid .btn-mini {
  padding: 3px 4px;
  border-radius: 7px;
}

#app.mobile-mode .difficulty-row,
#app.mobile-mode .title-account-bar,
#app.mobile-mode .title-device-bar {
  gap: 4px;
  margin-bottom: 0;
  font-size: 10px;
}

#app.mobile-mode .diff-btn,
#app.mobile-mode .btn-mini {
  font-size: 12.5px;
  padding: 6px 11px;
  border-width: 2px;
}

#app.mobile-mode .account-pill,
#app.mobile-mode .device-pill {
  font-size: 10.5px;
  padding: 3px 8px;
  border-width: 1.5px;
}

#app.mobile-mode .title-actions {
  gap: 7px;
  margin-bottom: 6px;
}

#app.mobile-mode .btn-primary,
#app.mobile-mode .btn-secondary,
#app.mobile-mode .btn-ghost,
#app.mobile-mode .btn-coop {
  font-size: 14px;
  padding: 9px 14px;
  border-width: 2.5px;
  border-radius: 11px;
  box-shadow: 2.5px 2.5px 0 var(--ink);
}

#app.mobile-mode .event-tag {
  font-size: 10px;
  padding: 2px 9px;
  margin-bottom: 4px;
}

#app.mobile-mode .event-emoji {
  font-size: 30px;
  margin: 2px 0;
}

#app.mobile-mode .event-title,
#app.mobile-mode .transition-title,
#app.mobile-mode .shop-title,
#app.mobile-mode .ending-title {
  font-size: 15px;
  margin-bottom: 4px;
}

#app.mobile-mode .event-desc,
#app.mobile-mode .transition-desc,
#app.mobile-mode .shop-sub {
  font-size: 11px;
  line-height: 1.4;
  margin-bottom: 6px;
}

#app.mobile-mode .choice-btn {
  font-size: 13px;
  padding: 8px 11px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
  border-radius: 10px;
}

#app.mobile-mode .choice-hint {
  font-size: 10.5px;
}

#app.mobile-mode .secret-input,
#app.mobile-mode .auth-input {
  font-size: 16px;
  padding: 8px 11px;
  border-width: 2px;
}

#app.mobile-mode .overlay-auth-top {
  z-index: 95;
  overflow-y: auto;
  padding: 8px max(10px, env(safe-area-inset-right)) max(62px, calc(env(safe-area-inset-bottom) + 56px)) max(10px, env(safe-area-inset-left));
}

#app.mobile-mode .auth-card {
  max-height: none;
  overflow: visible;
}

#app.mobile-mode .shop-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

#app.mobile-mode .skin-card {
  padding: 7px;
  gap: 4px;
  border-width: 2px;
}

#app.mobile-mode .skin-icon { font-size: 20px; }
#app.mobile-mode .skin-name { font-size: 12px; }
#app.mobile-mode .skin-desc { font-size: 10px; line-height: 1.3; }
#app.mobile-mode .skin-btn { font-size: 12px; padding: 7px 8px; border-width: 2px; }
#app.mobile-mode .shop-tab { font-size: 13px; padding: 6px 12px; border-width: 2px; }

/* Compact First-Person Quiz Dock inside canvas on Mobile! */
#app.mobile-mode .overlay-quiz {
  padding: 4px 6px;
}

#app.mobile-mode .quiz-dock {
  padding: 6px 8px;
  border-width: 2px;
  border-radius: 10px;
  max-height: 78%;
  overflow-y: auto;
}

#app.mobile-mode .quiz-title {
  font-size: 12.5px;
  margin-bottom: 2px;
}

#app.mobile-mode .quiz-desc {
  font-size: 10px;
  line-height: 1.3;
  margin-bottom: 4px;
}

#app.mobile-mode .quiz-choices {
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

#app.mobile-mode .quiz-result {
  padding: 5px 8px;
  font-size: 10.5px;
}

/* Compact Notebook Ending Card on Mobile */
#app.mobile-mode .notebook-card {
  padding: 10px 12px 10px 26px;
  max-height: calc(100dvh - 72px);
  border-width: 2.5px;
  box-shadow: 4px 4px 0 var(--ink);
}

#app.mobile-mode.is-fullscreen {
  padding: 4px max(6px, env(safe-area-inset-right)) max(58px, calc(env(safe-area-inset-bottom) + 52px)) max(6px, env(safe-area-inset-left));
}

#app.mobile-mode .diary-body {
  font-size: 11px;
  line-height: 1.55;
  margin-bottom: 6px;
}

#app.mobile-mode .ending-metrics {
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

#app.mobile-mode .metric-box { padding: 3px 4px; }
#app.mobile-mode .metric-box .m-label { font-size: 9px; }
#app.mobile-mode .metric-box .m-val { font-size: 12px; }

/* Compact Co-op Lobby & Right-Side Chat on Mobile */
#app.mobile-mode .coop-card {
  margin-right: 162px;
  max-width: 440px;
}

#app.mobile-mode .coop-chat-panel {
  position: fixed;
  z-index: 75;
  width: 156px;
  top: 6px;
  right: max(6px, env(safe-area-inset-right));
  max-height: 48dvh;
  border-width: 2px;
  border-radius: 10px;
}

#app.mobile-mode .coop-chat-head {
  padding: 3px 6px;
  font-size: 9.5px;
}

#app.mobile-mode .coop-chat-messages {
  min-height: 54px;
  max-height: 96px;
  padding: 4px 5px;
  font-size: 9.5px;
  gap: 3px;
}

#app.mobile-mode .coop-help-btn {
  font-size: 12px;
  padding: 7px 8px;
}

#app.mobile-mode .coop-qbtn,
#app.mobile-mode .coop-chat-input,
#app.mobile-mode .coop-chat-send {
  font-size: 11px;
  padding: 5px 6px;
}

/* Spacious, Zero-Overlap Full-Viewport Mobile Touch Controls (Lifted Cleanly Above Bottom Safe Zone!) */
#app.mobile-mode .mobile-assist-bar {
  top: 4px;
  left: 4px;
  flex-wrap: nowrap;
  gap: 4px;
  max-width: calc(100% - 8px);
  overflow-x: auto;
}

#app.mobile-mode .assist-chip {
  font-size: 10px;
  padding: 3px 7px;
  border-width: 1.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

#app.mobile-mode .roblox-joy-zone {
  left: max(18px, env(safe-area-inset-left));
  bottom: max(62px, calc(env(safe-area-inset-bottom) + 56px));
  gap: 4px;
}

#app.mobile-mode .roblox-joy-base {
  width: 108px;
  height: 108px;
  border-width: 3px;
}

#app.mobile-mode .roblox-joy-knob {
  width: 44px;
  height: 44px;
  border-width: 2.5px;
}

#app.mobile-mode .joy-dir {
  font-size: 12px;
}

#app.mobile-mode .roblox-joy-hint {
  font-size: 10px;
  padding: 2px 8px;
}

#app.mobile-mode .roblox-action-pad {
  right: max(18px, env(safe-area-inset-right));
  bottom: max(62px, calc(env(safe-area-inset-bottom) + 56px));
  width: 176px;
  height: 158px;
}

#app.mobile-mode .rblx-btn {
  border-width: 3px;
}

#app.mobile-mode .rblx-ico {
  font-size: 19px;
}

#app.mobile-mode .rblx-lbl {
  font-size: 10.5px;
}

#app.mobile-mode .rblx-jump {
  width: 76px;
  height: 76px;
  right: 0;
  bottom: 0;
}

#app.mobile-mode .rblx-jump .rblx-ico {
  font-size: 24px;
}

#app.mobile-mode .rblx-block {
  width: 68px;
  height: 68px;
  right: 92px;
  bottom: 6px;
}

#app.mobile-mode .rblx-duck {
  width: 58px;
  height: 58px;
  right: 96px;
  bottom: 90px;
}

#app.mobile-mode .rblx-duck .rblx-ico {
  font-size: 17px;
}

#app.mobile-mode .rblx-ult {
  width: 62px;
  height: 62px;
  right: 8px;
  bottom: 92px;
}

#app.mobile-mode .ult-toast {
  top: 4px;
  font-size: 11px;
  padding: 4px 10px;
  border-width: 2px;
}

/* Portrait Mobile: Canvas sits cleanly at top half; Thumbstick & Buttons sit spaciously below canvas! */
@media (orientation: portrait) {
  #app.mobile-mode .stage-area {
    align-items: flex-start;
    padding-top: 8px;
  }
}

/* Portrait / Narrow Phone Width (<= 520px): Guaranteed Wide Center Gap & >=14px Gap Between All Buttons! */
@media (max-width: 520px) {
  #app.mobile-mode .roblox-joy-zone {
    left: 14px;
    bottom: max(66px, calc(env(safe-area-inset-bottom) + 58px));
  }
  #app.mobile-mode .roblox-joy-base {
    width: 102px;
    height: 102px;
  }
  #app.mobile-mode .roblox-joy-knob {
    width: 42px;
    height: 42px;
  }
  #app.mobile-mode .roblox-action-pad {
    right: 14px;
    bottom: max(66px, calc(env(safe-area-inset-bottom) + 58px));
    width: 162px;
    height: 148px;
  }
  #app.mobile-mode .rblx-jump {
    width: 70px;
    height: 70px;
    right: 0;
    bottom: 0;
  }
  #app.mobile-mode .rblx-jump .rblx-ico {
    font-size: 22px;
  }
  #app.mobile-mode .rblx-block {
    width: 64px;
    height: 64px;
    right: 84px;
    bottom: 4px;
  }
  #app.mobile-mode .rblx-duck {
    width: 54px;
    height: 54px;
    right: 88px;
    bottom: 84px;
  }
  #app.mobile-mode .rblx-ult {
    width: 56px;
    height: 56px;
    right: 8px;
    bottom: 86px;
  }
  #app.mobile-mode .rblx-ico {
    font-size: 18px;
  }
  #app.mobile-mode .rblx-lbl {
    font-size: 10px;
  }
}

/* Ultra-Narrow Phones (<= 350px) */
@media (max-width: 350px) {
  #app.mobile-mode .roblox-joy-zone {
    left: 8px;
  }
  #app.mobile-mode .roblox-joy-base {
    width: 86px;
    height: 86px;
  }
  #app.mobile-mode .roblox-joy-knob {
    width: 36px;
    height: 36px;
  }
  #app.mobile-mode .roblox-action-pad {
    right: 8px;
    width: 142px;
    height: 130px;
  }
  #app.mobile-mode .rblx-jump {
    width: 60px;
    height: 60px;
  }
  #app.mobile-mode .rblx-block {
    width: 54px;
    height: 54px;
    right: 72px;
    bottom: 2px;
  }
  #app.mobile-mode .rblx-duck {
    width: 46px;
    height: 46px;
    right: 76px;
    bottom: 72px;
  }
  #app.mobile-mode .rblx-ult {
    width: 48px;
    height: 48px;
    right: 6px;
    bottom: 74px;
  }
}

/* Short Phone Landscape Screens (320-430px height): Clear Above Bottom Bar & Never Collides With Top HUD! */
@media (max-height: 430px) {
  #app.mobile-mode .roblox-joy-hint {
    display: none;
  }
  #app.mobile-mode .roblox-joy-zone {
    left: max(14px, env(safe-area-inset-left));
    bottom: max(56px, calc(env(safe-area-inset-bottom) + 50px));
  }
  #app.mobile-mode .roblox-joy-base {
    width: 96px;
    height: 96px;
  }
  #app.mobile-mode .roblox-joy-knob {
    width: 40px;
    height: 40px;
  }
  #app.mobile-mode .roblox-action-pad {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(56px, calc(env(safe-area-inset-bottom) + 50px));
    width: 158px;
    height: 142px;
  }
  #app.mobile-mode .rblx-ico {
    font-size: 17px;
  }
  #app.mobile-mode .rblx-lbl {
    font-size: 9.5px;
  }
  #app.mobile-mode .rblx-jump {
    width: 68px;
    height: 68px;
    right: 0;
    bottom: 0;
  }
  #app.mobile-mode .rblx-jump .rblx-ico {
    font-size: 22px;
  }
  #app.mobile-mode .rblx-block {
    width: 62px;
    height: 62px;
    right: 82px;
    bottom: 4px;
  }
  #app.mobile-mode .rblx-duck {
    width: 52px;
    height: 52px;
    right: 86px;
    bottom: 80px;
  }
  #app.mobile-mode .rblx-ult {
    width: 56px;
    height: 56px;
    right: 6px;
    bottom: 82px;
  }
  #app.mobile-mode .title-tagline {
    display: none;
  }
}

@media (max-width: 560px) {
  #app.mobile-mode .coop-card {
    margin-right: 0;
  }
  #app.mobile-mode .quiz-choices {
    grid-template-columns: 1fr;
  }
  #app.mobile-mode .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==================== 16-BIT RETRO PIXEL ART STYLE THEME ==================== */
body {
  font-family: "DotGothic16", "Press Start 2P", "PingFang TC", "Noto Sans TC", monospace;
  background-color: #191d32;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.025) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.025) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

#game-canvas,
.ui-ico,
.hud-stat-ico,
.hud-btn-ico,
.prog-ico,
.skin-ico-img,
.partner-ico-img,
.rblx-ico-img,
.rotate-ico-img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ui-ico {
  filter: none;
}

/* Blocky Pixel Borders & Crisp Retro 16-bit Drop Shadows */
.hud-bar,
.stage-shell,
.comic-card,
.title-hero-card,
.title-left-panel,
.notebook-card,
.quiz-dock,
.bottom-bar,
.ticker-box,
.coop-chat-panel,
.coop-partner-card,
.coop-status-box,
.coop-room-banner,
.coop-invite-banner,
.skin-card,
.counter-box,
.exam-peek-bar,
.ult-toast,
.gf-banner,
.controls-grid {
  border-radius: 3px !important;
  box-shadow: 4px 4px 0 #1d1b26 !important;
}

.stage-shell {
  border-width: 4px;
}

.title-top {
  letter-spacing: 2px;
  text-shadow: 4px 4px 0 #1d1b26;
}

.title-sub {
  font-family: "Press Start 2P", "DotGothic16", monospace;
  font-size: 12px;
  letter-spacing: 1.5px;
}

.stage-badge,
.event-tag,
.title-stamp,
.wallet-pill,
.account-pill,
.device-pill,
.exam-sync-pill,
.quiz-subbadge,
.ending-badge,
.ending-rank,
.skin-price,
.coop-loadout-pill,
.coop-online-dot,
.assist-chip {
  border-radius: 2px !important;
  box-shadow: 2px 2px 0 #1d1b26;
}

/* Retro Stepped Pixel Progress / HP / Mood / Rage Bars */
.bar-track,
.progress-track {
  border-radius: 2px !important;
  background: #cbd5e1;
  box-shadow: inset 2px 2px 0 rgba(15, 23, 42, 0.25);
}

.bar-fill,
.progress-fill {
  border-radius: 0 !important;
  position: relative;
}

.bar-fill::after,
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 6px,
      rgba(29, 27, 38, 0.2) 6px,
      rgba(29, 27, 38, 0.2) 8px
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.38) 32%, transparent 32%);
  pointer-events: none;
}

/* Chunky 16-bit Pixel Bevel Buttons */
.btn-primary,
.btn-secondary,
.btn-coop,
.btn-ghost,
.btn-mini,
.icon-btn,
.diff-btn,
.shop-tab,
.skin-btn,
.choice-btn,
.touch-btn,
.coop-qbtn,
.coop-chat-send,
.coop-peer-btn,
.coop-help-btn,
.exam-look-btn,
.exam-lean-btn {
  border-radius: 3px !important;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.45),
    inset -2px -2px 0 rgba(29, 27, 38, 0.18),
    3px 3px 0 #1d1b26 !important;
}

.btn-primary:active,
.btn-secondary:active,
.btn-coop:active,
.btn-ghost:active,
.btn-mini:active,
.icon-btn:active,
.skin-btn:active,
.choice-btn:active,
.touch-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #1d1b26 !important;
}

/* Yellow Pixel Keyboard Keycaps (matching classic 16-bit control guide!) */
kbd {
  font-family: "Press Start 2P", "DotGothic16", monospace;
  font-size: 10px;
  background: #ffd43b;
  color: #1d1b26;
  border: 2px solid #1d1b26;
  border-radius: 2px;
  padding: 2px 6px;
  box-shadow: 0 3px 0 #1d1b26, inset 1px 1px 0 rgba(255, 255, 255, 0.6);
}

.secret-input,
.auth-input,
.coop-mini-input,
.coop-chat-input {
  border-radius: 2px !important;
  box-shadow: inset 2px 2px 0 rgba(15, 23, 42, 0.14);
}

/* Retro Pixel-Styled Mobile Controls (keep tactile & crisp!) */
#app.mobile-mode .rblx-btn {
  border-radius: 6px !important;
  border-width: 3px;
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.45),
    inset -3px -3px 0 rgba(29, 27, 38, 0.25),
    4px 4px 0 #1d1b26 !important;
}

#app.mobile-mode .roblox-joy-base {
  border-radius: 10px !important;
  border-width: 3px;
  box-shadow: 4px 4px 0 rgba(29, 27, 38, 0.85);
}

#app.mobile-mode .roblox-joy-knob {
  border-radius: 6px !important;
  border-width: 3px;
}
