/* =========================================================================
   INK STRIKE — 漫画风街机射击 / Stylesheet
   All styling is static (no inline style attributes in HTML).
   Comic palette: newsprint cream, ink black, process cyan/magenta, warm yellow.
   ========================================================================= */

:root {
  --ink: #14110f;
  --ink-soft: #2a2520;
  --paper: #f4ead7;
  --paper-shade: #e6d9bd;
  --paper-deep: #d8c9a4;
  --cyan: #2bb7d6;
  --magenta: #e63a8f;
  --yellow: #ffd23f;
  --red: #e23b2e;
  --green: #5fb04a;
  --orange: #f08a24;
  --purple: #7b4cdb;
  --night: #1a1530;
  --shadow: rgba(20, 17, 15, 0.18);

  --font-display: "Arial Black", "Impact", "Helvetica Neue", sans-serif;
  --font-body: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;

  --hd-h: 58px;

  /* Safe area insets for notch / home indicator */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--night);
}

/* Halftone newsprint texture over the canvas only (below UI). */
.game-root::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.22;
  background-image: radial-gradient(rgba(20, 17, 15, 0.22) 0.6px, transparent 0.7px);
  background-size: 4px 4px;
  mix-blend-mode: multiply;
}
/* Vignette over the canvas only. */
.game-root::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  box-shadow: inset 0 0 220px rgba(20, 17, 15, 0.45);
}

.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  image-rendering: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.hidden { display: none !important; }

/* ===================== App header ===================== */
.app-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--hd-h);
  margin-top: var(--safe-top);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--paper);
  border-bottom: 4px solid var(--ink);
  box-shadow: 0 4px 0 rgba(20, 17, 15, 0.25);
}
.hd-back {
  flex: 0 0 auto;
  padding: 7px 12px;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-shade);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.hd-back:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.hd-back:focus-visible { outline: 3px dashed var(--cyan); outline-offset: 2px; }
.hd-title {
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: clamp(16px, 4.4vw, 24px);
  letter-spacing: 0.06em;
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--yellow);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-money {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 20px;
  color: var(--paper);
}
.chip__icon { font-size: 13px; line-height: 1; }
.chip--gold .chip__icon { color: var(--yellow); }
.chip--diamond .chip__icon { color: var(--cyan); }
.chip__val { font-family: var(--font-display); font-size: 13px; }

/* ===================== Screen container ===================== */
.screen-container {
  position: absolute;
  top: calc(var(--hd-h) + var(--safe-top));
  left: var(--safe-left); right: var(--safe-right);
  bottom: var(--safe-bottom);
  z-index: 10;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 40px;
}
.screen-container::-webkit-scrollbar { width: 10px; }
.screen-container::-webkit-scrollbar-thumb { background: var(--ink); border-radius: 6px; }
.screen-container::-webkit-scrollbar-track { background: rgba(244,234,215,0.2); }

.screen {
  max-width: 720px;
  margin: 0 auto;
}
.screen__inner { display: flex; flex-direction: column; gap: 14px; }
.screen-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 7vw, 38px);
  letter-spacing: 0.04em;
  color: var(--paper);
  text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--magenta);
  margin: 4px 0 14px;
  text-align: center;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(17px, 4.4vw, 22px);
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--ink);
  margin: 18px 0 10px;
  letter-spacing: 0.04em;
}

/* ===================== Home ===================== */
.home-player {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 7px 7px 0 var(--ink);
}
.home-player__avatar {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  background: var(--paper-shade);
  border: 3px solid var(--ink);
  border-radius: 12px;
  display: grid; place-items: center;
}
.home-player__info { flex: 1 1 auto; min-width: 0; }
.home-player__name {
  font-family: var(--font-display);
  font-size: clamp(18px, 5vw, 24px);
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.home-player__loadout { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: bold;
  color: var(--paper);
  background: var(--red);
  border: 2px solid var(--ink);
  border-radius: 20px;
}
.tag--alt { background: var(--cyan); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.nav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 8px 14px;
  min-height: 108px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--ink);
  cursor: pointer;
  text-align: center;
  transition: transform 0.07s ease, box-shadow 0.07s ease;
  font-family: var(--font-body);
  color: var(--ink);
}
.nav-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); filter: brightness(1.06); }
.nav-card:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--ink); }
.nav-card:focus-visible { outline: 3px dashed var(--cyan); outline-offset: 2px; }
.nav-card--big { grid-column: 1 / -1; min-height: 124px; }
.nav-card__glyph {
  font-size: 30px;
  line-height: 1;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid var(--ink);
  margin-bottom: 4px;
}
.nav-card__title { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.04em; }
.nav-card__sub { font-size: 12px; color: var(--ink-soft); }
.nav-card--red .nav-card__glyph { background: var(--red); color: var(--paper); }
.nav-card--cyan .nav-card__glyph { background: var(--cyan); color: var(--paper); }
.nav-card--magenta .nav-card__glyph { background: var(--magenta); color: var(--paper); }
.nav-card--yellow .nav-card__glyph { background: var(--yellow); color: var(--ink); }
.nav-card--green .nav-card__glyph { background: var(--green); color: var(--paper); }
.nav-card--purple .nav-card__glyph { background: var(--purple); color: var(--paper); }
.nav-card--red { background: linear-gradient(180deg, var(--paper) 60%, #ffd9d3 100%); }

.home-hint {
  margin-top: 6px;
  text-align: center;
  font-size: 13px;
  color: var(--paper);
  background: rgba(20,17,15,0.6);
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 9px 12px;
  line-height: 1.6;
}

/* ===================== Buttons (shared) ===================== */
.btn {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 12px 18px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 10px;
  border: 3px solid var(--ink);
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.1s ease;
  text-align: center;
}
.btn--primary { color: var(--paper); background: var(--red); box-shadow: 5px 5px 0 var(--ink); }
.btn--primary:hover { background: #c92f24; }
.btn--primary:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn--ghost { color: var(--ink); background: var(--paper-shade); box-shadow: 5px 5px 0 var(--ink); }
.btn--ghost:hover { background: var(--paper-deep); }
.btn--ghost:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn--small { width: auto; margin: 0; padding: 8px 12px; font-size: 14px; box-shadow: 4px 4px 0 var(--ink); }
.btn--small:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn--xsmall { width: auto; margin: 0; padding: 5px 8px; font-size: 12px; box-shadow: 3px 3px 0 var(--ink); }
.btn--xsmall:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn--big { font-size: 20px; padding: 15px 22px; }
.btn--disabled { opacity: 0.55; cursor: not-allowed; box-shadow: 4px 4px 0 var(--ink-soft); }
.btn--disabled:active { transform: none; }
.btn:focus-visible { outline: 3px dashed var(--cyan); outline-offset: 3px; }
.btn-pause {
  width: 40px; height: 40px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--paper);
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--magenta);
  cursor: pointer;
  pointer-events: auto;
}
.btn-pause:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--magenta); }

/* price tag */
.price {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-display);
}
.price--gold span:first-child { color: var(--yellow); }
.price--diamond span:first-child { color: var(--cyan); }

/* badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid var(--ink);
  border-radius: 20px;
  letter-spacing: 0.04em;
}
.badge--on { background: var(--green); color: var(--paper); }
.badge--done { background: var(--paper-shade); color: var(--ink-soft); }
.badge--lock { background: var(--ink); color: var(--paper); }

/* ===================== Game HUD ===================== */
.hud {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(12px + var(--safe-top)) calc(14px + var(--safe-right)) 12px calc(14px + var(--safe-left));
  gap: 8px;
}
.hud__left, .hud__right { display: flex; flex-direction: column; gap: 8px; }
.hud__right { align-items: flex-end; }
.hud__center {
  position: absolute;
  top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.hud-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 4px 10px;
  box-shadow: 3px 3px 0 var(--ink);
}
.hud-item--health { padding: 5px 10px; }
.hud-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hud-value {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  min-width: 24px;
  text-align: right;
}
.health-bar {
  width: 110px; height: 12px;
  background: var(--paper-shade);
  border: 2px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
}
.health-bar__fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 55%, var(--green) 100%);
  transition: width 0.18s ease;
}
.skill-box {
  width: 120px; height: 28px;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: 2px 2px 0 var(--magenta);
}
.skill-name {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 12px;
  padding-top: 2px;
  position: relative;
  z-index: 2;
}
.skill-bar__fill {
  position: absolute;
  bottom: 0; left: 0;
  height: 14px; width: 0%;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  transition: width 0.1s linear;
  z-index: 1;
}
.skill-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 14px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--paper);
  letter-spacing: 0.06em;
  z-index: 3;
}
.skill-ready {
  color: var(--yellow) !important;
  animation: pulse 0.7s ease-in-out infinite;
  text-shadow: 0 0 6px var(--yellow);
}
.item-bar {
  position: absolute;
  left: 14px; right: 14px; bottom: 12px;
  display: flex; gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}
.item-slot {
  display: flex; align-items: center; gap: 6px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 5px 9px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 12px;
}
.item-slot__key {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 4px;
}
.item-slot__glyph { font-size: 16px; }
.item-slot__name { color: var(--ink); }
.item-slot__count { font-family: var(--font-display); color: var(--red); }
.item-slot--empty { color: var(--ink-soft); font-style: italic; }

/* ===================== Overlays (pause / game over) ===================== */
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}
.game-overlay .overlay {
  pointer-events: auto;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 17, 15, 0.6);
  backdrop-filter: blur(2px);
}
.panel {
  position: relative;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 9px 9px 0 var(--ink);
}
.panel-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 8vw, 46px);
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--yellow);
  margin-bottom: 16px;
}
.final-score, .final-best { font-size: 16px; margin: 5px 0; color: var(--ink-soft); }
.final-score strong, .final-best strong { color: var(--ink); font-family: var(--font-display); }
.new-record {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--red);
  margin: 8px 0;
  letter-spacing: 0.06em;
  animation: pulse 0.9s ease-in-out infinite;
}

/* ===================== Shop ===================== */
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--paper-shade);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.06s ease, background 0.1s ease;
}
.tab-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.tab-btn.active { background: var(--yellow); color: var(--ink); }
.tab-btn:focus-visible { outline: 3px dashed var(--cyan); outline-offset: 2px; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.shop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--ink);
  text-align: center;
}
.shop-card--equipped { background: linear-gradient(180deg, var(--paper) 55%, #c9f0d4 100%); }
.shop-card__name { font-family: var(--font-display); font-size: 15px; }
.shop-card__desc { font-size: 12px; color: var(--ink-soft); min-height: 30px; }
.shop-card__owned { font-size: 12px; color: var(--purple); font-weight: bold; }
.shop-card__lock {
  font-size: 12px;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 4px 10px;
}
.shop-card__glyph { font-size: 34px; color: var(--magenta); }
.skin-swatch, .ship-preview { border-radius: 10px; border: 3px solid var(--ink); background: var(--paper-shade); }

/* ===================== Handbook ===================== */
.hb-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 7px 7px 0 var(--ink);
}
.hb-tier-badge {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center;
  width: 64px; height: 64px;
  justify-content: center;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-family: var(--font-display);
}
.hb-tier-badge span { font-size: 11px; color: var(--ink-soft); }
.hb-tier-badge strong { font-size: 26px; color: var(--ink); }
.hb-progress { flex: 1 1 auto; }
.hb-progress__bar {
  height: 16px;
  background: var(--paper-shade);
  border: 3px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}
.hb-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  transition: width 0.3s ease;
}
.hb-progress__text { margin-top: 5px; font-size: 12px; color: var(--ink-soft); font-family: var(--font-display); }

.hb-tasks { display: flex; flex-direction: column; gap: 8px; }
.hb-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
}
.hb-task--done { opacity: 0.65; background: var(--paper-shade); }
.hb-task__info { flex: 1 1 auto; min-width: 0; }
.hb-task__name { font-family: var(--font-display); font-size: 14px; }
.hb-task__bar {
  height: 8px; margin: 5px 0 3px;
  background: var(--paper-shade);
  border: 2px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
}
.hb-task__fill { height: 100%; background: var(--green); transition: width 0.3s ease; }
.hb-task--done .hb-task__fill { background: var(--paper-deep); }
.hb-task__count { font-size: 11px; color: var(--ink-soft); }

.hb-track-wrap { overflow-x: auto; padding-bottom: 8px; }
.hb-track {
  display: flex;
  gap: 8px;
  min-width: min-content;
}
.hb-tier {
  flex: 0 0 auto;
  width: 70px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  text-align: center;
}
.hb-tier__lv { font-family: var(--font-display); font-size: 14px; color: var(--cyan); }
.hb-tier__reward { font-family: var(--font-display); font-size: 13px; color: var(--ink); }
.hb-tier--locked { opacity: 0.5; }
.hb-tier--claimed { background: var(--green); }
.hb-tier--claimed .hb-tier__reward { color: var(--paper); }

/* ===================== Characters ===================== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.char-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--ink);
  text-align: center;
}
.char-card--equipped { background: linear-gradient(180deg, var(--paper) 55%, #c9f0d4 100%); border-color: var(--green); }
.char-card__name { font-family: var(--font-display); font-size: 20px; }
.char-card__role { font-size: 12px; color: var(--paper); background: var(--magenta); border: 2px solid var(--ink); border-radius: 20px; padding: 2px 10px; }
.char-card__desc { font-size: 12px; color: var(--ink-soft); min-height: 32px; }
.char-card__skill { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.char-card__skill-label { color: var(--ink-soft); }
.char-card__skill-name { font-family: var(--font-display); color: var(--red); }
.char-card__stats { width: 100%; display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.stat-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.stat-bar__label { flex: 0 0 auto; width: 32px; color: var(--ink-soft); }
.stat-bar__track { flex: 1 1 auto; height: 8px; background: var(--paper-shade); border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.stat-bar__fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--yellow)); }

/* ===================== Check-in ===================== */
.ci-streak { text-align: center; color: var(--paper); font-family: var(--font-display); font-size: 16px; margin-bottom: 14px; }
.ci-days {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.ci-day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  text-align: center;
  position: relative;
}
.ci-day__num { font-family: var(--font-display); font-size: 11px; color: var(--ink-soft); }
.ci-day__reward { font-family: var(--font-display); font-size: 14px; color: var(--ink); }
.ci-day--today { background: var(--yellow); box-shadow: 3px 3px 0 var(--magenta), 3px 3px 0 3px var(--ink); }
.ci-day--past { opacity: 0.6; }
.ci-day__mark { position: absolute; top: 2px; right: 4px; color: var(--green); font-weight: bold; }

/* ===================== Profile ===================== */
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 7px 7px 0 var(--ink);
}
.profile-head__info { flex: 1 1 auto; min-width: 0; }
.profile-head__name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--font-display); font-size: 16px; color: var(--paper); }
.profile-head__loadout { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.profile-head__money { display: flex; gap: 6px; margin-top: 6px; }
.name-input {
  width: 130px;
  padding: 5px 8px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-shade);
  border: 2px solid var(--ink);
  border-radius: 6px;
}
.name-input:focus { outline: 3px dashed var(--cyan); outline-offset: 1px; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.profile-stat {
  padding: 10px 6px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  text-align: center;
}
.profile-stat__label { font-size: 11px; color: var(--ink-soft); }
.profile-stat__value { font-family: var(--font-display); font-size: 20px; color: var(--ink); margin-top: 2px; }
.profile-collection {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
}
.profile-col-item { display: flex; justify-content: space-between; font-size: 14px; }
.profile-col-item strong { font-family: var(--font-display); color: var(--red); }

/* ===================== Animations ===================== */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

/* ===================== Responsive ===================== */
@media (max-width: 480px) {
  :root { --hd-h: 52px; }
  .panel { padding: 22px 18px; }
  .hud { padding: 10px 12px; }
  .health-bar, .skill-box { width: 90px; }
  .skill-box { height: 24px; }
  .skill-name { font-size: 9px; }
  .card-grid { gap: 10px; }
  .nav-card { min-height: 96px; }
  .nav-card__glyph { width: 42px; height: 42px; font-size: 26px; }
  .ci-days { grid-template-columns: repeat(3, 1fr); }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ===================== Visual Polish ===================== */
/* 主页大卡片脉动 */
.nav-card--big {
  animation: cardPulse 2.5s ease-in-out infinite;
}
@keyframes cardPulse {
  0%, 100% { box-shadow: 6px 6px 0 var(--ink); }
  50% { box-shadow: 6px 6px 0 var(--ink), 0 0 20px rgba(226, 59, 46, 0.4); }
}

/* 角色卡颜色边框 */
.char-card { transition: transform 0.08s ease, box-shadow 0.08s ease; }
.char-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }

/* 商城卡悬停 */
.shop-card { transition: transform 0.08s ease, box-shadow 0.08s ease; }
.shop-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }

/* 主页玩家卡片渐变 */
.home-player {
  background: linear-gradient(135deg, var(--paper) 0%, var(--paper-shade) 100%);
}

/* 签到今日卡片增强 */
.ci-day--today {
  animation: cardPulse 1.5s ease-in-out infinite;
}

/* 手册奖励轨道连接线 */
.hb-tier { position: relative; }
.hb-tier:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%; right: -8px;
  width: 8px; height: 3px;
  background: var(--ink-soft);
  z-index: -1;
}

/* 面板入场动画 */
.panel {
  animation: panelIn 0.3s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes panelIn {
  from { transform: scale(0.85) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* 道具槽悬停高亮 */
.item-slot { transition: filter 0.1s ease; }
.item-slot:hover { filter: brightness(1.1); }

/* 标签栏激活态发光 */
.tab-btn.active {
  box-shadow: 4px 4px 0 var(--ink), 0 0 12px rgba(255, 210, 63, 0.4);
}

/* ===================== 登录/注册 ===================== */
.login-box {
  max-width: 380px;
  margin: 0 auto;
  padding: 20px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 7px 7px 0 var(--ink);
}
.form-row {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-label {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper-shade);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  outline: none;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}
.form-input:focus {
  border-color: var(--cyan);
  box-shadow: 3px 3px 0 var(--ink), 0 0 8px rgba(43, 183, 214, 0.3);
}
.form-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  font-weight: bold;
}
.login-info {
  text-align: center;
  margin-bottom: 16px;
}
.login-user {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--green);
  margin-bottom: 6px;
}
.login-id {
  font-size: 13px;
  color: var(--ink-soft);
}
.tag--online {
  background: var(--green);
  color: var(--paper);
}
.tag--offline {
  background: var(--ink-soft);
  color: var(--paper);
}
.profile-account {
  margin-bottom: 14px;
}
.profile-account-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===================== 排行榜 ===================== */
.lb-loading {
  text-align: center;
  padding: 30px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--paper);
  animation: pulse 1s ease-in-out infinite;
}
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lb-empty {
  text-align: center;
  padding: 30px 20px;
}
.lb-empty p { color: var(--paper); font-size: 16px; margin-bottom: 8px; }
.lb-hint { font-size: 13px !important; opacity: 0.7; }
.lb-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.lb-entry:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.lb-entry--top {
  border-width: 4px;
}
.lb-entry--gold {
  background: linear-gradient(135deg, var(--paper) 0%, #ffe87a 100%);
  border-color: var(--yellow);
}
.lb-entry--silver {
  background: linear-gradient(135deg, var(--paper) 0%, #d0d0d8 100%);
}
.lb-entry--bronze {
  background: linear-gradient(135deg, var(--paper) 0%, #e8b070 100%);
}
.lb-rank {
  flex: 0 0 auto;
  width: 50px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  text-align: center;
}
.lb-entry--gold .lb-rank { color: #b8860b; }
.lb-entry--silver .lb-rank { color: #707080; }
.lb-entry--bronze .lb-rank { color: #b8651a; }
.lb-info {
  flex: 1 1 auto;
  min-width: 0;
}
.lb-name {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-meta {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.lb-score {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--red);
  text-shadow: 1px 1px 0 var(--yellow);
}
.lb-my-rank {
  margin: 14px 0;
  padding: 12px 16px;
  background: var(--ink);
  border: 3px solid var(--cyan);
  border-radius: 10px;
  color: var(--paper);
  font-size: 14px;
  text-align: center;
}
.lb-my-rank strong { color: var(--yellow); font-family: var(--font-display); font-size: 18px; }

/* ===================== 好友系统 ===================== */
.friends-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.friend-search {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 14px;
}
.friend-search-results {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friend-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--paper-shade);
  border: 2px solid var(--ink);
  border-radius: 8px;
}
.friend-search-name {
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
}
.friend-search-score { font-size: 12px; color: var(--ink-soft); }
.friend-search-empty { color: var(--ink-soft); text-align: center; padding: 8px; font-size: 13px; }
.friend-requests {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friend-request-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
}
.friend-request-name {
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
}
.friend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.06s ease;
}
.friend-item:hover { transform: translate(-1px, -1px); }
.friend-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.friend-info { flex: 1 1 auto; min-width: 0; }
.friend-name {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
}
.friend-score { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ===================== 多人游戏 ===================== */
.mp-section {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 7px 7px 0 var(--ink);
  padding: 18px 16px;
  margin-bottom: 16px;
}
.mp-hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  line-height: 1.5;
}
.mp-join-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.mp-join-row .form-input {
  flex: 1 1 auto;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
}
.mp-join-row .btn {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}
.mp-controls-hint {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.mp-control-card {
  background: var(--paper-shade);
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.mp-control-card__title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 4px;
}
.mp-control-card__keys {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* ===================== 房间大厅 ===================== */
.room-card {
  background: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 7px 7px 0 var(--magenta);
  padding: 20px 18px;
  margin-bottom: 16px;
}
.room-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.room-id-label {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--paper-shade);
  letter-spacing: 0.06em;
}
.room-id-value {
  font-family: var(--font-display);
  font-size: clamp(28px, 8vw, 42px);
  color: var(--yellow);
  letter-spacing: 0.15em;
  text-shadow: 2px 2px 0 var(--ink-soft);
}
.room-hint {
  text-align: center;
  font-size: 13px;
  color: var(--paper-shade);
  margin-top: 10px;
  opacity: 0.8;
}
.room-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.room-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
}
.room-player--self {
  border-color: var(--green);
  box-shadow: 3px 3px 0 var(--green);
}
.room-player--empty {
  opacity: 0.5;
  border-style: dashed;
}
.room-player__badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.room-player__icon {
  font-size: 22px;
  color: var(--yellow);
}
.room-player__name {
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
}

/* ===================== 双人模式 HUD ===================== */
.hud--coop .hud__left {
  flex-direction: column;
  gap: 6px;
}
.hud-p2 {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 2px solid var(--cyan);
  border-radius: 6px;
  padding: 3px 8px;
  box-shadow: 2px 2px 0 var(--ink);
}
.hud-p2__label {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--cyan);
}
.hud-p2__bar {
  width: 60px; height: 8px;
  background: var(--paper-shade);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
}
.hud-p2__fill {
  height: 100%; width: 100%;
  background: var(--green);
  transition: width 0.2s ease, background 0.3s ease;
}
.hud-p2__hp {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--ink);
  min-width: 36px;
  text-align: right;
}

/* ===================== 响应式 — 手机端 ===================== */
@media (max-width: 480px) {
  :root { --hd-h: 48px; }
  .panel { padding: 20px 16px; max-width: 340px; }
  .hud { padding: 8px 10px; }
  .health-bar { width: 80px; }
  .skill-box { width: 100px; height: 24px; }
  .skill-name { font-size: 9px; }
  .card-grid { gap: 8px; }
  .nav-card { min-height: 88px; padding: 14px 6px 10px; }
  .nav-card__glyph { width: 38px; height: 38px; font-size: 22px; }
  .nav-card__title { font-size: 15px; }
  .nav-card__sub { font-size: 11px; }
  .ci-days { grid-template-columns: repeat(3, 1fr); }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .screen-container { padding: 10px 10px 30px; }
  .screen-title { font-size: clamp(22px, 7vw, 32px); }
  .section-title { font-size: clamp(15px, 4vw, 20px); }
  .home-hint { font-size: 11px; padding: 7px 10px; }
  .btn { font-size: 16px; padding: 11px 14px; }
  .btn--big { font-size: 18px; padding: 13px 18px; }

  /* 多人游戏手机适配 */
  .mp-section { padding: 14px 12px; }
  .mp-controls-hint { grid-template-columns: 1fr; gap: 8px; }
  .mp-join-row .form-input { font-size: 16px; }
  .room-id-value { font-size: 28px; letter-spacing: 0.1em; }
  .room-player { padding: 10px 12px; }
  .room-player__name { font-size: 14px; }

  /* HUD 手机适配 */
  .hud-value { font-size: 15px; }
  .hud-label { font-size: 9px; }
  .hud-item { padding: 3px 7px; gap: 5px; }
  .item-bar { left: 8px; right: 8px; bottom: 8px; }
  .item-slot { padding: 4px 7px; font-size: 11px; }
  .item-slot__key { width: 16px; height: 16px; font-size: 10px; }
  .item-slot__glyph { font-size: 14px; }

  /* 登录手机适配 */
  .login-box { padding: 16px 14px; }
  .form-input { padding: 9px 12px; font-size: 15px; }

  /* 双人 HUD 手机适配 */
  .hud-p2__bar { width: 45px; }
}

/* ===================== 响应式 — 平板/小桌面 ===================== */
@media (max-width: 768px) and (min-width: 481px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .mp-controls-hint { grid-template-columns: 1fr 1fr; }
}

/* ===================== 桌面端宽屏布局 ===================== */
@media (min-width: 769px) {
  /* 大卡片占满一行，小卡片两列排列，视觉层次更清晰 */
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .nav-card--big { grid-column: 1 / -1; min-height: 100px; flex-direction: row; justify-content: flex-start; padding: 16px 24px; gap: 16px; }
  .nav-card--big .nav-card__glyph { margin-bottom: 0; width: 56px; height: 56px; font-size: 34px; }
  .nav-card--big .nav-card__title { font-size: 22px; }
  .screen { max-width: 720px; }
  .home-player { padding: 18px 22px; }
  .home-player__avatar { width: 72px; height: 72px; }
  .nav-card { min-height: 110px; }
  .nav-card__glyph { width: 50px; height: 50px; font-size: 30px; }
  .nav-card__title { font-size: 18px; }
  .nav-card__sub { font-size: 13px; }
  /* 房间大厅：玩家列表横排，卡片化展示 */
  .room-players { flex-direction: row; gap: 12px; }
  .room-player { flex: 1 1 0; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
  .room-player__badges { justify-content: center; }
  .room-player__icon { font-size: 28px; }
  .room-player__name { font-size: 17px; }
  .room-card { max-width: 480px; margin: 0 auto 16px; }
}

/* ===================== 触摸设备适配 ===================== */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备：移除悬停效果 */
  .nav-card:hover { transform: none; box-shadow: 6px 6px 0 var(--ink); filter: none; }
  .nav-card:active { transform: translate(2px, 2px); box-shadow: 4px 4px 0 var(--ink); }
  .btn:active { transform: translate(2px, 2px); }
  .shop-card:hover { transform: none; box-shadow: 5px 5px 0 var(--ink); }
  .char-card:hover { transform: none; box-shadow: 6px 6px 0 var(--ink); }
  .friend-item:hover { transform: none; }

  /* 触摸设备：增大按钮点击区域 */
  .btn { padding: 14px 18px; }
  .btn--small { padding: 10px 14px; }
  .hd-back { padding: 9px 14px; }
  .tab-btn { padding: 12px 10px; }
}

/* ===================== 横屏适配 ===================== */
@media (orientation: landscape) and (max-height: 480px) {
  :root { --hd-h: 40px; }
  .screen-container { padding: 8px 10px 20px; }
  .screen-title { font-size: 22px; margin: 2px 0 8px; }
  .section-title { margin: 10px 0 6px; }
  .panel { padding: 16px 20px; }
  .home-player { padding: 10px 12px; }
  .home-player__avatar { width: 48px; height: 48px; }
  .home-player__name { font-size: 18px; }
  .card-grid { gap: 8px; }
  .nav-card { min-height: 72px; padding: 10px 6px; }
  .nav-card__glyph { width: 36px; height: 36px; font-size: 20px; }
  .mp-section { padding: 12px 10px; margin-bottom: 10px; }
  .mp-controls-hint { grid-template-columns: 1fr 1fr; }
}

/* ===================== 动画增强 ===================== */
.mp-section {
  animation: panelIn 0.25s ease;
}
.room-card {
  animation: panelIn 0.3s ease;
}
.room-player--self {
  animation: cardPulse 2s ease-in-out infinite;
}

/* ===================== 手机竖屏旋转提示 ===================== */
.rotate-prompt {
  display: none !important;
}

/* 竖屏已支持，不再显示旋转提示 */
@media (orientation: portrait) and (max-width: 900px) and (hover: none) and (pointer: coarse) {
  .rotate-prompt {
    display: none !important;
  }
}

/* ===================== 横屏优化（手机/小平板） ===================== */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --hd-h: 36px; }
  .app-header { gap: 6px; padding: 0 8px; }
  .hd-back { padding: 5px 8px; font-size: 12px; }
  .hd-title { font-size: 14px; }
  .chip { padding: 3px 7px; }
  .chip__val { font-size: 11px; }

  .screen-container { padding: 6px 8px 16px; }
  .screen-title { font-size: 20px; margin: 2px 0 6px; }
  .section-title { font-size: 15px; margin: 8px 0 5px; }
  .panel { padding: 14px 18px; max-width: 360px; }
  .panel-title { font-size: 28px; margin-bottom: 10px; }

  .home-player { padding: 8px 10px; gap: 10px; }
  .home-player__avatar { width: 40px; height: 40px; }
  .home-player__name { font-size: 16px; }
  .card-grid { gap: 6px; }
  .nav-card { min-height: 60px; padding: 8px 4px; }
  .nav-card__glyph { width: 32px; height: 32px; font-size: 18px; }
  .nav-card__title { font-size: 13px; }
  .nav-card__sub { font-size: 10px; }
  .nav-card--big { min-height: 70px; }

  .mp-section { padding: 10px 8px; margin-bottom: 8px; }
  .mp-controls-hint { grid-template-columns: 1fr 1fr; gap: 6px; }
  .mp-control-card { padding: 6px 4px; }
  .mp-control-card__title { font-size: 12px; }
  .mp-control-card__keys { font-size: 10px; }

  .room-id-value { font-size: 24px; }
  .room-player { padding: 8px 10px; }

  .btn { font-size: 14px; padding: 8px 12px; margin: 5px 0; }
  .btn--big { font-size: 16px; padding: 10px 14px; }

  .hud { padding: 6px 8px; }
  .hud-value { font-size: 13px; }
  .hud-label { font-size: 8px; }
  .hud-item { padding: 2px 6px; gap: 4px; }
  .health-bar { width: 70px; height: 8px; }
  .skill-box { width: 90px; height: 20px; }
  .skill-name { font-size: 8px; }
  .skill-label { font-size: 8px; height: 10px; }
  .skill-bar__fill { height: 10px; }
  .item-bar { left: 6px; right: 6px; bottom: 6px; gap: 4px; }
  .item-slot { padding: 3px 5px; font-size: 10px; }
  .item-slot__key { width: 14px; height: 14px; font-size: 9px; }
  .item-slot__glyph { font-size: 12px; }

  .login-box { padding: 12px 10px; }
  .form-input { padding: 7px 10px; font-size: 14px; }
  .form-label { font-size: 12px; }

  .lb-entry { padding: 6px 8px; gap: 8px; }
  .lb-rank { width: 36px; font-size: 14px; }
  .lb-name { font-size: 14px; }
  .lb-score { font-size: 18px; }

  .char-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
  .char-card { padding: 10px 8px; gap: 4px; }
  .char-card__name { font-size: 16px; }
  .char-card__desc { font-size: 11px; min-height: 24px; }

  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .shop-card { padding: 10px 6px; }

  .ci-days { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .ci-day { padding: 6px 2px; }

  .profile-stats { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .profile-stat { padding: 6px 4px; }
  .profile-stat__value { font-size: 16px; }

  .hb-task { padding: 6px 8px; }
  .hb-tier { width: 56px; padding: 6px 2px; }

  .friend-search { padding: 10px; }
  .friend-item { padding: 6px 8px; }
}

/* ===================== 手机触屏横屏：隐藏道具栏，放大触控区 ===================== */
@media (orientation: landscape) and (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* 隐藏道具栏，避免遮挡触控按钮 */
  .item-bar { display: none; }
  /* HUD 更紧凑 */
  .hud { padding: 4px 6px; }
  .hud__left, .hud__right { gap: 4px; }
  .hud-item { padding: 2px 5px; }
  .health-bar { width: 60px; height: 6px; }
  .skill-box { width: 80px; height: 16px; }
  .skill-name { font-size: 7px; }
  .skill-label { font-size: 7px; height: 8px; }
  .skill-bar__fill { height: 8px; }
  .hud-value { font-size: 12px; }
  .hud-label { font-size: 7px; }
  /* 暂停按钮更小 */
  .btn-pause { width: 32px; height: 32px; font-size: 14px; }
  /* 主页卡片网格：手机横屏用3列 */
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .nav-card { min-height: 56px; padding: 6px 4px; }
  .nav-card--big { grid-column: span 3; min-height: 50px; }
  .nav-card__glyph { width: 28px; height: 28px; font-size: 16px; }
  .nav-card__title { font-size: 12px; }
  .nav-card__sub { display: none; }
  /* 屏幕容器减少底部留白 */
  .screen-container { padding: 4px 6px 8px; }
  .screen { max-width: 100%; }
  /* 房间大厅：横排玩家列表，更紧凑 */
  .room-players { flex-direction: row; gap: 6px; margin-bottom: 8px; }
  .room-player { flex: 1 1 0; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 6px 4px; }
  .room-player__icon { font-size: 18px; }
  .room-player__name { font-size: 12px; }
  .room-player__badges { gap: 3px; }
  .badge { padding: 2px 6px; font-size: 9px; }
  .room-card { padding: 10px 12px; margin-bottom: 8px; }
  .room-id-value { font-size: 22px; }
  .room-hint { font-size: 10px; margin-top: 4px; }
}

/* ===================== DOM 触控按钮层 ===================== */
.touch-controls {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
.touch-controls.hidden { display: none !important; }

/* 全屏点击射击层 — 透明，覆盖整个屏幕 */
.tc-tap-fire {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* 技能按钮组（右下角） */
.tc-action-group {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  right: calc(16px + var(--safe-right));
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

/* 陀螺仪按钮组（右上角） */
.tc-gyro-group {
  position: absolute;
  top: calc(42px + var(--safe-top));
  right: calc(16px + var(--safe-right));
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.tc-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 4px solid var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 0.05s ease, opacity 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
  font-family: var(--font-display);
  font-weight: 900;
  position: relative;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.tc-btn:active, .tc-btn.tc-active {
  transform: scale(0.82);
  opacity: 0.95;
}

/* 技能按钮 — 右下角 */
.tc-btn--skill {
  width: 80px; height: 80px;
  background: rgba(255, 210, 63, 0.5);
  color: var(--paper);
  font-size: 12px;
  box-shadow: 0 0 14px rgba(255, 210, 63, 0.4), 3px 3px 0 var(--ink);
}
.tc-btn--skill::after { content: "SP"; font-size: 18px; }
/* 必杀就绪：发光脉冲 */
.tc-btn--skill.tc-ready {
  background: rgba(255, 210, 63, 0.8);
  box-shadow: 0 0 28px rgba(255, 210, 63, 0.95), 3px 3px 0 var(--ink);
  animation: tc-pulse 0.8s ease-in-out infinite;
}
@keyframes tc-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 210, 63, 0.7), 3px 3px 0 var(--ink); }
  50% { box-shadow: 0 0 36px rgba(255, 210, 63, 1), 3px 3px 0 var(--ink); }
}
/* 必杀冷却：底部进度条 */
.tc-btn--skill.tc-cooling::before {
  content: "";
  position: absolute;
  bottom: 0; left: 0;
  width: var(--cd-pct, 0%);
  height: 6px;
  background: var(--cyan);
  border-radius: 0 0 0 2px;
}

/* 陀螺仪校准按钮 — 右上角 */
.tc-btn--gyro {
  width: 48px; height: 48px;
  background: rgba(43, 183, 214, 0.5);
  color: var(--paper);
  font-size: 20px;
  box-shadow: 0 0 10px rgba(43, 183, 214, 0.3), 2px 2px 0 var(--ink);
}
.tc-btn--gyro::after { content: "◎"; font-size: 22px; }
.tc-btn--gyro:active, .tc-btn--gyro.tc-active {
  background: rgba(43, 183, 214, 0.9);
}

/* 陀螺仪启用按钮（iOS 授权） */
.tc-btn--gyro-enable {
  width: auto;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(43, 183, 214, 0.8);
  color: var(--paper);
  font-size: 13px;
  box-shadow: 0 0 12px rgba(43, 183, 214, 0.5), 2px 2px 0 var(--ink);
  white-space: nowrap;
}
.tc-btn--gyro-enable.hidden { display: none !important; }
.tc-btn--gyro-enable:active { transform: scale(0.9); }

/* 陀螺仪灵敏度调节面板 */
.tc-gyro-panel {
  position: absolute;
  top: calc(90px + var(--safe-top));
  right: calc(16px + var(--safe-right));
  z-index: 4;
  pointer-events: auto;
  background: rgba(20, 17, 15, 0.92);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6), 3px 3px 0 var(--ink);
  min-width: 200px;
}
.tc-gyro-panel.hidden { display: none !important; }
.gyro-panel__title {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--cyan);
  letter-spacing: 0.06em;
  text-align: center;
  margin-bottom: 10px;
  text-shadow: 1px 1px 0 var(--ink);
}
.gyro-panel__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.gyro-panel__label {
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 12px;
  flex-shrink: 0;
  width: 48px;
}
.gyro-panel__slider {
  flex-grow: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--ink-soft);
  border: 2px solid var(--paper);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
.gyro-panel__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  border: 3px solid var(--ink);
  box-shadow: 0 0 8px rgba(43, 183, 214, 0.6);
}
.gyro-panel__slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  border: 3px solid var(--ink);
}
.gyro-panel__value {
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 13px;
  flex-shrink: 0;
  width: 38px;
  text-align: right;
}
.gyro-panel__presets {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.gyro-panel__preset-btn {
  flex: 1;
  padding: 5px 0;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--paper);
  background: var(--ink-soft);
  border: 2px solid var(--ink);
  border-radius: 6px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s ease, transform 0.06s ease;
}
.gyro-panel__preset-btn:active {
  transform: scale(0.92);
  background: var(--cyan);
}
.gyro-panel__calib-btn {
  display: block;
  width: 100%;
  padding: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--paper);
  background: rgba(43, 183, 214, 0.4);
  border: 2px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s ease, transform 0.06s ease;
}
.gyro-panel__calib-btn:active, .gyro-panel__calib-btn.tc-active {
  transform: scale(0.95);
  background: rgba(43, 183, 214, 0.9);
}

/* 手机横屏适配 */
@media (orientation: landscape) and (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .tc-btn--skill { width: 64px; height: 64px; }
  .tc-btn--skill::after { font-size: 14px; }
  .tc-btn--gyro { width: 40px; height: 40px; }
  .tc-btn--gyro::after { font-size: 18px; }
  .tc-action-group { bottom: calc(14px + var(--safe-bottom)); right: calc(10px + var(--safe-right)); }
  .tc-gyro-group { top: calc(38px + var(--safe-top)); right: calc(10px + var(--safe-right)); }
  .tc-gyro-panel { top: calc(82px + var(--safe-top)); right: calc(10px + var(--safe-right)); min-width: 180px; padding: 10px; }
  .gyro-panel__title { font-size: 12px; margin-bottom: 8px; }
}

/* 手机竖屏适配 */
@media (orientation: portrait) and (max-width: 500px) and (hover: none) and (pointer: coarse) {
  .tc-btn--skill { width: 72px; height: 72px; }
  .tc-btn--skill::after { font-size: 16px; }
  .tc-btn--gyro { width: 44px; height: 44px; }
  .tc-btn--gyro::after { font-size: 20px; }
  .tc-action-group { bottom: calc(16px + var(--safe-bottom)); right: calc(12px + var(--safe-right)); }
  .tc-gyro-group { top: calc(40px + var(--safe-top)); right: calc(12px + var(--safe-right)); }
  .tc-gyro-panel { top: calc(88px + var(--safe-top)); right: calc(12px + var(--safe-right)); min-width: 200px; }
}

/* ===================== 视觉增强：双端通用 ===================== */
/* 卡片入场动画 */
.nav-card {
  animation: cardSlideIn 0.3s ease backwards;
}
.nav-card:nth-child(1) { animation-delay: 0.02s; }
.nav-card:nth-child(2) { animation-delay: 0.06s; }
.nav-card:nth-child(3) { animation-delay: 0.10s; }
.nav-card:nth-child(4) { animation-delay: 0.14s; }
.nav-card:nth-child(5) { animation-delay: 0.18s; }
.nav-card:nth-child(6) { animation-delay: 0.22s; }
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 房间玩家卡片入场 */
.room-player {
  animation: playerCardIn 0.35s cubic-bezier(0.2, 1.2, 0.4, 1) backwards;
}
.room-player:nth-child(2) { animation-delay: 0.1s; }
@keyframes playerCardIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* 按钮按下波纹效果 */
.btn {
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.btn:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* 房间码高亮动画 */
.room-id-value {
  animation: codeGlow 3s ease-in-out infinite;
}
@keyframes codeGlow {
  0%, 100% { text-shadow: 2px 2px 0 var(--ink-soft); }
  50% { text-shadow: 2px 2px 0 var(--ink-soft), 0 0 12px rgba(255, 210, 63, 0.5); }
}

/* ===================== Mobile game optimizations ===================== */
@media (max-height: 500px) and (orientation: landscape) {
  /* Smaller header on mobile to maximize view area (header is hidden during gameplay via JS) */
  .app-header { height: 40px !important; }
  .screen-container { top: 40px !important; }
  .hd-title { font-size: 14px !important; }
  .hd-back { padding: 4px 8px !important; font-size: 12px !important; }
  .hud { padding: 4px 8px !important; font-size: 11px !important; }
  .hud-label { font-size: 9px !important; }
  .hud-value { font-size: 13px !important; }
  .skill-box { font-size: 10px !important; }
  .skill-name { font-size: 10px !important; }
  .skill-label { font-size: 9px !important; }
  .health-bar { height: 10px !important; }
  .btn-pause { width: 28px !important; height: 28px !important; font-size: 12px !important; }
  .item-bar { display: none !important; }

  /* Mobile touch buttons */
  .tc-btn--skill { width: 68px !important; height: 68px !important; }
  .tc-btn--skill::after { font-size: 15px !important; }
  .tc-btn--gyro { width: 42px !important; height: 42px !important; }
  .tc-btn--gyro::after { font-size: 19px !important; }
  .tc-action-group { bottom: calc(16px + var(--safe-bottom)) !important; right: calc(12px + var(--safe-right)) !important; }
  .tc-gyro-group { top: calc(40px + var(--safe-top)) !important; right: calc(12px + var(--safe-right)) !important; }
  .tc-gyro-panel { top: calc(86px + var(--safe-top)) !important; right: calc(12px + var(--safe-right)) !important; min-width: 190px !important; }
}

/* ===================== Desktop enhancement ===================== */
@media (min-width: 768px) and (min-height: 500px) {
  /* Larger touch buttons even on tablet for better usability */
  .tc-btn--skill { width: 76px; height: 76px; }
  .tc-btn--gyro { width: 48px; height: 48px; }
}

/* Boss warning animation */
@keyframes boss-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Power-up indicator pulse */
@keyframes powerup-indicator {
  0%, 100% { box-shadow: 0 0 8px currentColor; }
  50% { box-shadow: 0 0 20px currentColor; }
}

/* Remote player name tag styling enhancement */
.hud-p2 {
  transition: opacity 0.3s ease;
}

/* Improve room lobby on mobile */
@media (max-width: 480px) {
  .room-player {
    padding: 8px 10px !important;
    font-size: 13px !important;
  }
  .room-player__name {
    font-size: 14px !important;
  }
  .room-id-value {
    font-size: 18px !important;
    letter-spacing: 0.1em !important;
  }
  .screen--room-lobby .btn--big {
    padding: 10px 16px !important;
    font-size: 15px !important;
  }
}

/* Invite button special glow */
.screen--room-lobby .btn--big:first-of-type {
  animation: invite-pulse 2s ease-in-out infinite;
}
@keyframes invite-pulse {
  0%, 100% { box-shadow: 3px 3px 0 var(--ink), 0 0 0 rgba(43, 183, 214, 0); }
  50% { box-shadow: 3px 3px 0 var(--ink), 0 0 16px rgba(43, 183, 214, 0.5); }
}
