/* Runtime CSS source of truth.
 * Split files under public/styles/ are reference-only until a real assembly path exists.
 */
:root {
  --bg: #0a0a12;
  --bg-soft: #12121e;
  --panel: rgba(20, 20, 35, 0.92);
  --panel-border: rgba(120, 140, 255, 0.15);
  --text: #eef0ff;
  --muted: #8a8ea8;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --gold: #ffd447;
  --gold-dim: rgba(255, 212, 71, 0.15);
  --ur: #ff6b6b;
  --ssr: #ffd447;
  --sr: #a29bfe;
  --r: #74b9ff;
  --n: #b2bec3;
  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-portrait-width: 480px;
  --app-portrait-height: 853px;
  --app-landscape-width: 853px;
  --app-landscape-height: 480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: 100%;
  max-width: var(--app-portrait-width);
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  position: relative;
}

/* ===== Screen System ===== */
.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-portrait-width);
  z-index: 40;
  height: var(--nav-height);
  display: flex;
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--panel-border);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.7rem;
  cursor: pointer;
  transition: color 0.2s;
}
.bottom-nav-btn.active { color: var(--accent-light); }
.bottom-nav-icon { font-size: 1.4rem; }
.bottom-nav-label { font-size: 0.65rem; letter-spacing: 0.04em; }

/* ===== Screen Header ===== */
.screen-header {
  padding: 20px 16px 12px;
}
.screen-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
}

/* ===== Home Screen ===== */
#screen-home {
  position: relative;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}
body.home-edit-mode #screen-home {
  overflow: visible;
}

/* Background */
.home-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(108,92,231,0.25), transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(255,212,71,0.12), transparent 50%),
    radial-gradient(ellipse at 60% 90%, rgba(255,107,107,0.08), transparent 40%),
    linear-gradient(170deg, #1a1040 0%, #0d0d1a 40%, #0a0e1a 100%);
  z-index: 0;
}

.home-layout-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  pointer-events: none;
}
.home-layout-overlay.active {
  pointer-events: none;
}
.home-layout-overlay-stage {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.home-layout-overlay .layout-node-button {
  border: none;
  border-radius: 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(0,0,0,0.28);
  pointer-events: auto;
}
.home-layout-overlay .layout-button-home-side {
  background: rgba(15,18,32,0.78);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
}
.home-layout-overlay .layout-button-home-battle {
  background: linear-gradient(135deg, rgba(255,221,132,0.96), rgba(243,156,18,0.94));
  color: #2f2611;
  box-shadow: 0 16px 36px rgba(90,48,0,0.28);
}
.home-layout-overlay .layout-node-currency,
.home-layout-overlay .layout-node-list,
.home-layout-overlay .layout-node-text {
  color: var(--text);
}
.home-layout-overlay .layout-node-game.layout-node-currency {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(8,10,18,0.64);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}
.home-layout-overlay .layout-currency-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  flex: 0 0 auto;
}
.home-layout-overlay .layout-currency-stamina .layout-currency-dot {
  background: #74b9ff;
}
.home-layout-overlay .layout-currency-gems .layout-currency-dot {
  background: #a29bfe;
}
.home-layout-overlay .layout-currency-gold .layout-currency-dot {
  background: #ffd447;
}
.home-layout-overlay .layout-currency-value {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.home-layout-overlay .layout-variant-home-event-banner {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(10,12,22,0.72);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 30px rgba(0,0,0,0.24);
}
.home-layout-overlay .layout-home-event-tag {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,212,71,0.18);
  color: #ffe08a;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.home-layout-overlay .layout-home-event-body {
  min-width: 0;
}
.home-layout-overlay .layout-home-event-title {
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.home-layout-overlay .layout-home-event-subtitle {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.4;
}
.home-layout-overlay .layout-variant-speech-bubble {
  position: relative;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.94);
  color: #171a24;
  box-shadow: 0 16px 30px rgba(0,0,0,0.24);
}
.home-layout-overlay .layout-speech-name {
  font-size: 0.72rem;
  font-weight: 900;
  color: #4f46b6;
  margin-bottom: 4px;
}
.home-layout-overlay .layout-speech-text {
  font-size: 0.76rem;
  line-height: 1.45;
  color: #1e2330;
}
.home-layout-overlay .layout-speech-arrow {
  position: absolute;
  left: 22px;
  bottom: -12px;
  width: 24px;
  height: 24px;
  background: inherit;
  transform: rotate(45deg);
  border-radius: 4px;
}

/* Character */
.home-character {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-60%);
  z-index: 1;
  pointer-events: auto;
  transition: transform 0.3s, bottom 0.3s;
}
.home-character-2 {
  transform: translateX(10%);
  z-index: 2;
}
.home-character.is-front {
  z-index: 3;
}
.home-character.is-back {
  z-index: 1;
}
.home-character.is-front {
  z-index: 3;
}
.home-character.is-back {
  z-index: 1;
}
.home-character img {
  max-height: calc(100vh - 200px);
  max-width: 85vw;
  object-fit: contain;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.5));
}
.home-character img[src=""] { display: none; }

/* Top Status Bar */
.home-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
}
.home-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-lv {
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(108,92,231,0.5);
  border: 1px solid rgba(162,155,254,0.4);
}
.home-lv-label {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}
.home-lv-num {
  font-size: 0.85rem;
  font-weight: 900;
  color: #fff;
}
.home-player-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.project-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.project-controls select {
  max-width: 160px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  border-radius: 6px;
  padding: 3px 8px;
  font: inherit;
  font-size: 0.65rem;
}

.project-create-btn {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(108,92,231,0.45);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.home-topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.home-currency {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}
.home-currency-icon {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: inline-block;
}
.currency-stamina { background: linear-gradient(135deg, #2ecc71, #27ae60); box-shadow: 0 0 4px rgba(46,204,113,0.5); }
.currency-gem { background: linear-gradient(135deg, #74b9ff, #0984e3); box-shadow: 0 0 4px rgba(116,185,255,0.5); }
.currency-gold { background: linear-gradient(135deg, #ffd447, #e17055); box-shadow: 0 0 4px rgba(255,212,71,0.5); }

/* Left Side Buttons */
.home-side-left {
  position: absolute;
  top: 60px; left: 8px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.home-side-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px;
  border: none;
  border-radius: 12px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  font-size: 0.6rem;
  font-weight: 600;
  min-width: 48px;
  transition: transform 0.15s;
}
.home-side-btn:active { transform: scale(0.9); }
.home-side-icon { font-size: 1.1rem; }

/* Battle Button (bottom-right of home) */
.home-side-right {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 20;
}
.home-menu-btn {
  width: auto;
  min-width: 96px;
  height: 52px;
  padding: 0 20px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.home-menu-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  opacity: 0.85;
}
.home-menu-btn:active { transform: scale(0.95); }
.home-menu-text { position: relative; z-index: 1; text-align: center; line-height: 1.2; }

.home-menu-quest {
  background: linear-gradient(135deg, #e84393, #a029d0);
  border-color: rgba(232,67,147,0.5);
  box-shadow: 0 4px 20px rgba(168,41,208,0.5);
}
.home-menu-gacha {
  background: linear-gradient(135deg, #fdcb6e, #e17055);
  border-color: rgba(253,203,110,0.5);
  box-shadow: 0 4px 16px rgba(225,112,85,0.4);
}
.home-menu-collection {
  background: linear-gradient(135deg, #74b9ff, #0984e3);
  border-color: rgba(116,185,255,0.5);
  box-shadow: 0 4px 16px rgba(9,132,227,0.4);
}
.home-menu-edit {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  border-color: rgba(255,107,107,0.5);
  box-shadow: 0 4px 16px rgba(238,90,36,0.4);
}

/* Event Banner */
.home-event-banner {
  position: absolute;
  top: 56px; right: 88px;
  z-index: 10;
  width: min(220px, 40vw);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(30,20,60,0.92), rgba(60,30,80,0.92));
  border: 1px solid rgba(255,212,71,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.15s;
}
.home-event-banner:active { transform: scale(0.95); }
.home-event-tag {
  padding: 2px 8px;
  background: linear-gradient(90deg, #ff6b6b, #ee5a24);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: center;
}
.home-event-body { padding: 8px 10px; }
.home-event-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}
.home-event-sub {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.6);
}

.event-screen {
  padding: 16px;
}
.event-screen-hero {
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(255,212,71,0.18), transparent 35%),
    linear-gradient(135deg, rgba(34,26,68,0.96), rgba(82,34,52,0.92));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 30px rgba(8,10,18,0.28);
}
.event-screen-tag {
  margin: 0 0 8px;
  color: #ffd447;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.event-screen-title {
  margin: 0 0 6px;
  color: #fff;
  font-size: 1.3rem;
}
.event-screen-subtitle {
  margin: 0;
  color: rgba(255,255,255,0.78);
  line-height: 1.6;
}
.event-screen-grid {
  display: grid;
  gap: 12px;
}
.event-panel {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(28,33,55,0.08);
  box-shadow: 0 10px 24px rgba(16,23,41,0.08);
}
.event-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.event-panel-head h4 {
  margin: 0;
  font-size: 1rem;
  color: #1c2137;
}
.event-panel-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(82,34,52,0.08);
  color: #8c2f44;
  font-size: 0.72rem;
  font-weight: 700;
}
.event-panel-copy {
  margin: 0 0 14px;
  color: #47516d;
  line-height: 1.6;
}
.event-exchange-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.event-exchange-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(28,33,55,0.04);
}
.event-exchange-item-main {
  display: grid;
  gap: 4px;
}
.event-exchange-item-main strong {
  color: #1c2137;
  font-size: 0.88rem;
}
.event-exchange-item-main span {
  color: #47516d;
  font-size: 0.76rem;
  line-height: 1.5;
}
.event-exchange-empty {
  margin: 0 0 14px;
  color: #47516d;
  font-size: 0.82rem;
  line-height: 1.6;
}
.event-display-item-list,
.event-currency-list,
.event-limited-card-list {
  display: grid;
  gap: 8px;
}
.event-display-item,
.event-currency-item,
.event-limited-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(28,33,55,0.04);
}
.event-display-item strong,
.event-currency-item strong,
.event-limited-card strong {
  color: #1c2137;
  font-size: 0.88rem;
}
.event-display-item span,
.event-currency-item span,
.event-limited-card span {
  color: #47516d;
  font-size: 0.76rem;
  line-height: 1.5;
}
.event-display-item {
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 12px;
}
.event-display-item-visual {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(140,47,68,0.16), rgba(28,33,55,0.08));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(28,33,55,0.08);
}
.event-display-item-body {
  display: grid;
  gap: 4px;
}
.event-limited-card {
  border: 0;
  text-align: left;
  cursor: pointer;
}
.event-display-empty {
  margin: 0;
  color: #47516d;
  font-size: 0.82rem;
  line-height: 1.6;
}
.event-login-bonus-status {
  margin: 0 0 10px;
  color: #8c2f44;
  font-size: 0.88rem;
  font-weight: 700;
}
.event-login-bonus-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.event-login-bonus-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(28,33,55,0.04);
}
.event-login-bonus-item.is-current {
  background: linear-gradient(135deg, rgba(255,212,71,0.22), rgba(255,107,107,0.12));
  border: 1px solid rgba(255,212,71,0.35);
}
.event-login-bonus-day {
  font-size: 0.78rem;
  font-weight: 800;
  color: #8c2f44;
}
.event-login-bonus-reward {
  color: #1c2137;
  font-size: 0.86rem;
  text-align: right;
}
.event-panel .btn-primary,
.event-panel .btn-secondary {
  width: 100%;
}
.event-screen-empty {
  padding: 24px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  color: #47516d;
  text-align: center;
  line-height: 1.7;
}
.event-screen-empty p {
  margin: 0;
}
.event-screen-empty p + p {
  margin-top: 8px;
}

/* Speech Bubble */
.home-speech {
  position: absolute;
  bottom: 70px;
  right: 16px;
  z-index: 10;
  max-width: 200px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.95);
  color: #1a1040;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.home-speech-name {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 3px;
}
.home-speech-text {
  font-size: 0.75rem;
  line-height: 1.5;
  color: #2d2d2d;
}
.home-speech-arrow {
  position: absolute;
  bottom: -6px;
  left: 30px;
  width: 12px; height: 12px;
  background: rgba(255,255,255,0.95);
  transform: rotate(45deg);
}

/* Second Speech Bubble */
.home-speech-2 {
  left: 16px;
  right: auto;
  bottom: 130px;
}
.home-speech-2[hidden] { display: none; }
.home-speech-2 .home-speech-arrow {
  left: auto;
  right: 30px;
}

/* Home Config Panel */
.home-config-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  width: calc(100% - 32px);
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: 16px;
  background: rgba(10,10,18,0.96);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.home-config-panel[hidden] { display: none; }
.share-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 55;
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(10,10,18,0.96);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.share-panel[hidden] { display: none; }
.share-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.share-panel-head h4 {
  font-size: 1rem;
}
.share-panel-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.share-panel-copy {
  color: rgba(255,255,255,0.82);
  font-size: 0.82rem;
  line-height: 1.45;
  margin-bottom: 12px;
}
.share-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.share-panel-plan {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.share-panel-plan.is-paid {
  background: rgba(46, 204, 113, 0.14);
  color: #9fe7bc;
}
.share-panel-plan.is-free {
  background: rgba(255, 212, 71, 0.12);
  color: #ffe08a;
}
.share-panel-note {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
  margin-bottom: 8px;
}
.share-panel-status {
  min-height: 20px;
  margin-top: 12px;
  color: #9fe7bc;
  font-size: 0.78rem;
  font-weight: 700;
}
.share-panel-status.is-error {
  color: #ff9090;
}
.share-panel.is-busy {
  opacity: 0.86;
}
.home-config-panel h4 {
  font-size: 1rem;
  margin-bottom: 14px;
}
.home-config-panel label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.home-config-panel select,
.home-config-panel input[type="range"] {
  width: 100%;
}
.home-config-panel select {
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.home-config-panel select option {
  color: #fff;
  background: #0a0a12;
}
.home-config-editor {
  display: grid;
  gap: 14px;
  margin: 10px 0 16px;
}
.home-config-stage-wrap {
  display: grid;
  gap: 8px;
}
.home-config-stage {
  position: relative;
  height: 280px;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(162,155,254,0.18), transparent 42%),
    linear-gradient(180deg, rgba(26,16,64,0.95) 0%, rgba(10,10,18,0.98) 100%);
  border: 1px solid rgba(255,255,255,0.1);
}
.home-config-stage::before {
  content: "";
  position: absolute;
  inset: 18px 18px 42px;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 14px;
  pointer-events: none;
}
.home-config-stage-floor {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 14px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16), rgba(255,255,255,0.03) 70%, transparent 80%);
  pointer-events: none;
}
.home-config-stage-char {
  position: absolute;
  bottom: 32px;
  left: 50%;
  width: 42%;
  max-width: 160px;
  transform-origin: bottom center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.15s, filter 0.15s;
}
.home-config-stage-char.is-active {
  filter: drop-shadow(0 0 0.6rem rgba(255,255,255,0.25));
}
.home-config-stage-char.is-front {
  z-index: 3;
}
.home-config-stage-char.is-back {
  z-index: 1;
}
.home-config-stage-char.is-front {
  z-index: 3;
}
.home-config-stage-char.is-back {
  z-index: 1;
}
.home-config-stage-char.is-dragging {
  cursor: grabbing;
}
.home-config-stage-char.is-hidden {
  display: none;
}
.home-config-stage-char img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.45));
}
.home-config-stage-char::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  font-size: 0.7rem;
  white-space: nowrap;
}
.home-config-hint {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
}
.home-config-toolbar {
  display: grid;
  gap: 10px;
}
.home-config-targets {
  display: flex;
  gap: 8px;
}
.home-config-target {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.home-config-target.active {
  background: linear-gradient(135deg, rgba(162,155,254,0.28), rgba(108,92,231,0.28));
  border-color: rgba(162,155,254,0.4);
}
.home-config-target:disabled {
  opacity: 0.45;
  cursor: default;
}
.home-config-scale-label {
  display: grid;
  grid-template-columns: 60px 1fr 52px;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}
.home-config-scale-label input[type="range"] {
  width: 100%;
}
.home-config-scale-label span {
  text-align: right;
  color: var(--accent-light);
  font-size: 0.78rem;
}
.home-config-stage-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 160px;
  margin-top: 30px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.68);
  font-size: 0.78rem;
}

/* Ticker */
.home-ticker {
  position: absolute;
  bottom: 8px; left: 8px; right: 8px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
}
.home-ticker-badge {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.home-ticker-text {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-ticker-text strong { color: var(--gold); }

/* ===== Common Buttons ===== */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }

.btn-secondary {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

/* ===== Gacha Screen ===== */
.gacha-banner-list {
  padding: 0 16px;
  display: grid;
  gap: 12px;
}
.gacha-banner-card {
  position: relative;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(108,92,231,0.2), rgba(255,212,71,0.1));
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: transform 0.15s;
  overflow: hidden;
}
.gacha-banner-card:active { transform: scale(0.98); }
.gacha-banner-card h4 { font-size: 1.1rem; margin-bottom: 4px; }
.gacha-banner-card p { font-size: 0.8rem; color: var(--muted); }
.gacha-banner-card .gacha-banner-tag {
  position: absolute;
  top: 12px; right: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
}

.gacha-active-area {
  padding: 16px;
}
.gacha-subtools {
  margin-top: 12px;
}
.gacha-banner-display {
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1a1040, #2d1b69);
  border: 1px solid rgba(108,92,231,0.3);
  text-align: center;
  margin-bottom: 14px;
  overflow: hidden;
}
.gacha-hero-stage {
  position: relative;
  min-height: 360px;
  margin: -20px -20px 16px;
  border-radius: 16px 16px 28px 28px;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(255,255,255,0.18), transparent 52%), linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.22));
}
.gacha-hero-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,205,120,0.36), transparent 28%),
    radial-gradient(circle at 82% 24%, rgba(129,236,236,0.26), transparent 30%),
    radial-gradient(circle at 50% 75%, rgba(255,255,255,0.08), transparent 34%);
  filter: saturate(1.15);
}
.gacha-hero-images {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  height: 100%;
  padding: 36px 12px 0;
}
.gacha-hero-card {
  position: relative;
  flex: 0 1 33%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.gacha-hero-card img {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 16px 24px rgba(0,0,0,0.28));
}
.gacha-hero-card.is-primary {
  z-index: 2;
  flex-basis: 42%;
  transform: translateY(4px);
}
.gacha-hero-card.is-secondary-left {
  transform: translate(10px, 14px) scale(0.94);
}
.gacha-hero-card.is-secondary-right {
  transform: translate(-10px, 14px) scale(0.94);
}
.gacha-hero-empty {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 100%;
  padding: 40px 24px;
  color: rgba(255,255,255,0.7);
  font-size: 0.88rem;
}
.gacha-banner-display h3 { font-size: 1.2rem; margin-bottom: 6px; }
.gacha-banner-display p { font-size: 0.82rem; color: var(--muted); }

.gacha-rates {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.gacha-rates span {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  font-size: 0.75rem;
  color: var(--muted);
}

.gacha-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gacha-history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}
.gacha-history {
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.gacha-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.gacha-history-title {
  font-size: 0.92rem;
  font-weight: 700;
}
.gacha-history-meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.gacha-history-empty {
  color: var(--muted);
  font-size: 0.8rem;
}
.gacha-history-list {
  display: grid;
  gap: 8px;
}
.gacha-history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.05);
}
.gacha-history-time {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}
.gacha-history-main {
  min-width: 0;
}
.gacha-history-gacha {
  font-size: 0.68rem;
  color: var(--accent-light);
  margin-bottom: 2px;
}
.gacha-history-card {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gacha-history-rarity {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.gacha-banner-list {
  padding: 0 16px 16px;
  display: grid;
  gap: 12px;
}
.gacha-visual-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.gacha-btn {
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s;
}
.gacha-btn:active { transform: scale(0.95); }
.gacha-btn-single {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--panel-border);
}
.gacha-btn-ten {
  background: linear-gradient(135deg, var(--gold), #ff9f43);
  color: #1a1040;
}
.gacha-btn-ok {
  margin-top: 16px;
  background: var(--accent);
  color: #fff;
  width: 100%;
}

/* Gacha Overlay */
.gacha-overlay[hidden] { display: none; }
.gacha-overlay {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(0,0,0,0.95);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gacha-animation {
  text-align: center;
  position: relative;
}
.gacha-circle {
  width: 120px; height: 120px;
  border: 3px solid var(--accent-light);
  border-radius: 50%;
  margin: 0 auto;
  animation: gachaRotate 1s linear infinite;
}
.gacha-circle-2 {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 140px; height: 140px;
  border-color: var(--gold);
  animation-direction: reverse;
  animation-duration: 1.5s;
}
.gacha-circle-3 {
  position: absolute;
  top: -20px; left: 50%;
  transform: translateX(-50%);
  width: 160px; height: 160px;
  border-color: var(--ur);
  opacity: 0.5;
  animation-duration: 2s;
}
.gacha-loading-text {
  margin-top: 24px;
  font-size: 1.1rem;
  color: var(--accent-light);
  animation: gachaPulse 0.8s ease infinite alternate;
}

@keyframes gachaRotate {
  to { transform: rotate(360deg); }
}
.gacha-circle-2 { animation-name: gachaRotate; }
.gacha-circle-3 { animation-name: gachaRotate; }

@keyframes gachaPulse {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

/* Gacha Results */
.gacha-results {
  padding: 16px;
}
.gacha-results-title {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 14px;
  color: var(--gold);
}
.gacha-results-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.gacha-result-card {
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1);
  animation: cardReveal 0.4s ease backwards;
  cursor: pointer;
  transition: transform 0.15s;
}
.gacha-result-card:active { transform: scale(0.95); }
.gacha-result-card.rarity-tier-5 { border-color: var(--ur); box-shadow: 0 0 16px rgba(255,107,107,0.4); }
.gacha-result-card.rarity-tier-4 { border-color: var(--ssr); box-shadow: 0 0 12px rgba(255,212,71,0.3); }
.gacha-result-card.rarity-tier-3 { border-color: var(--sr); }
.gacha-result-card.rarity-tier-2 { border-color: var(--r); }
.gacha-result-card.rarity-tier-1 { border-color: var(--n); }
.gacha-result-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}
.gacha-result-card .gacha-result-info {
  padding: 4px 6px;
  background: rgba(0,0,0,0.6);
}
.gacha-result-card .gacha-result-rarity {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.gacha-result-card .gacha-result-name {
  font-size: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes cardReveal {
  from { opacity: 0; transform: scale(0.5) rotateY(90deg); }
  to { opacity: 1; transform: scale(1) rotateY(0); }
}

.gacha-no-banner {
  padding: 40px 16px;
  text-align: center;
}
.gacha-no-banner p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.gacha-no-banner .btn-primary {
  margin-top: 16px;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Story Screen ===== */
.story-tabs, .editor-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  margin-bottom: 12px;
}
.story-tab, .editor-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.story-tab:first-child, .editor-tab:first-child { border-radius: 10px 0 0 10px; }
.story-tab:last-child, .editor-tab:last-child { border-radius: 0 10px 10px 0; }
.story-tab.active, .editor-tab.active {
  background: var(--accent);
  color: #fff;
}

.story-list {
  padding: 0 16px;
  display: grid;
  gap: 10px;
}
.story-event-promo {
  margin: 0 16px 16px;
  padding: 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(255, 212, 120, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(140, 47, 68, 0.2), rgba(28, 33, 55, 0.96));
  border: 1px solid rgba(255, 212, 120, 0.18);
}
.story-event-promo[hidden] {
  display: none;
}
.story-event-promo-head {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.story-event-promo-tag {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #ffd57a;
}
.story-event-promo-title {
  margin: 0;
  font-size: 1.05rem;
  color: #fff7e1;
}
.story-event-promo-copy {
  margin: 0;
  color: rgba(255, 247, 225, 0.78);
  font-size: 0.82rem;
  line-height: 1.6;
}
.story-event-promo-list {
  display: grid;
  gap: 10px;
}
.story-event-promo-card {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  text-align: left;
  cursor: pointer;
}
.story-event-promo-card:active {
  transform: scale(0.98);
}
.story-event-promo-image {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
.story-event-promo-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story-event-promo-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.story-event-promo-body strong {
  color: #fff7e1;
  font-size: 0.92rem;
}
.story-event-promo-body span {
  color: rgba(255, 247, 225, 0.74);
  font-size: 0.76rem;
  line-height: 1.5;
}
.story-event-promo-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.12);
  color: #fff7e1;
}
.story-event-promo-status.is-owned {
  background: rgba(140,255,180,0.18);
  color: #b8ffd2;
}
.story-item {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: transform 0.15s;
}
.story-item.is-locked {
  opacity: 0.72;
  border-color: rgba(255,255,255,0.05);
}
.story-item.is-completed {
  border-color: rgba(255,211,122,0.32);
}
.story-item:active { transform: scale(0.98); }
.story-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.story-item-type {
  font-size: 0.7rem;
  color: var(--accent-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0;
}
.story-item-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.story-item-status.is-new {
  background: rgba(90,220,255,0.14);
  color: #8ee6ff;
}
.story-item-status.is-open {
  background: rgba(140,255,180,0.14);
  color: #9ff3b8;
}
.story-item-status.is-reading {
  background: rgba(255,212,120,0.14);
  color: #ffd57a;
}
.story-item-status.is-clear {
  background: rgba(255,198,96,0.16);
  color: #ffcf75;
}
.story-item-status.is-locked {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.62);
}
.story-item h4 { font-size: 1rem; margin-bottom: 4px; }
.story-item p {
  font-size: 0.78rem;
  color: var(--muted);
}

.story-empty {
  padding: 40px 16px;
  text-align: center;
}
.story-empty p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.story-empty .btn-primary {
  margin-top: 16px;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

/* Story Reader */
.story-reader[hidden] { display: none; }
.story-reader {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
}
.story-reader-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1a1040 0%, #0a0a12 100%);
}
.story-reader-character {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.story-reader-character img {
  max-height: 60vh;
  max-width: 80%;
  object-fit: contain;
}
.story-reader-textbox {
  position: relative;
  z-index: 2;
  padding: 20px;
  min-height: 160px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85) 20%);
  cursor: pointer;
}
.story-reader-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-light);
  margin-bottom: 8px;
}
.story-reader-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}
.story-reader-next {
  position: absolute;
  bottom: 12px;
  right: 20px;
  color: var(--muted);
  animation: gachaPulse 0.8s ease infinite alternate;
}
.story-reader-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 3;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.story-reader-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: var(--accent-light);
  transition: width 0.3s;
  z-index: 3;
}

.battle-screen {
  display: grid;
  gap: 14px;
  padding: 0 16px 20px;
}
.battle-arena {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.12), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 56%),
    linear-gradient(0deg, rgba(0,0,0,0.18), rgba(0,0,0,0)),
    linear-gradient(180deg, #141c2b, #0b1019);
}
.battle-enemy-avatar {
  width: min(58vw, 220px);
  aspect-ratio: 1 / 1;
  margin: 20px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd447 0%, #ff9f43 36%, #a54d1e 100%);
  box-shadow: 0 18px 40px rgba(0,0,0,0.32);
}
.battle-hit-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,107,107,0.4), transparent 35%);
  opacity: 0;
  pointer-events: none;
}
.battle-hit-flash.is-active {
  animation: battleHitFlash 0.22s ease;
}
@keyframes battleHitFlash {
  0% { opacity: 0; }
  40% { opacity: 1; }
  100% { opacity: 0; }
}
.battle-enemy-info {
  padding: 14px 16px 16px;
  display: grid;
  gap: 8px;
}
.battle-enemy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.battle-enemy-head h3 {
  font-size: 1rem;
}
.battle-mode-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(162,155,254,0.18);
  color: var(--accent-light);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.battle-enemy-hpbar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.battle-enemy-hpfill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #ffd447);
  transition: width 0.2s ease;
}
.battle-enemy-hptext {
  font-size: 0.78rem;
  color: var(--text);
}
.battle-battlelog {
  min-height: 2.8em;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.battle-party-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.battle-party-card {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  min-height: 126px;
  position: relative;
}
.battle-party-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.battle-party-card.is-sd img {
  object-fit: contain;
  padding: 8px;
}
.battle-party-role {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 52px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(8,10,18,0.72);
  font-size: 0.54rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.86);
}
.battle-party-role.is-leader {
  background: rgba(255,212,71,0.24);
  color: #ffe08a;
}
.battle-party-role.is-sub {
  background: rgba(90,220,255,0.2);
  color: #8ee6ff;
}
.battle-party-hpbar {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 28px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(8,10,18,0.62);
}
.battle-party-hpfill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #f1c40f);
}
.battle-party-meta {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 14px;
  font-size: 0.54rem;
  text-align: center;
  color: rgba(255,255,255,0.78);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.battle-party-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  gap: 6px;
}
.battle-party-action {
  min-width: 54px;
  padding: 4px 6px;
  border: none;
  border-radius: 999px;
  background: rgba(8,10,18,0.72);
  color: rgba(255,255,255,0.88);
  font-size: 0.56rem;
  font-weight: 800;
}
.battle-party-action:disabled {
  opacity: 0.48;
}
.battle-party-name {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 42px;
  font-size: 0.62rem;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.battle-party-card-empty {
  min-height: 126px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.battle-footer {
  display: grid;
  gap: 10px;
}
.battle-role-summary {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ===== Collection Screen ===== */
.collection-filters {
  display: flex;
  gap: 6px;
  padding: 0 16px;
  margin-bottom: 12px;
  overflow-x: auto;
}
.collection-filter {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.collection-filter.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px;
}
.collection-card {
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.08);
  background: var(--panel);
  cursor: pointer;
  transition: transform 0.15s;
}
.collection-card:active { transform: scale(0.95); }
.collection-card.rarity-tier-5 { border-color: var(--ur); }
.collection-card.rarity-tier-4 { border-color: var(--ssr); }
.collection-card.rarity-tier-3 { border-color: var(--sr); }
.collection-card.rarity-tier-2 { border-color: var(--r); }
.collection-card.rarity-tier-1 { border-color: var(--n); }
.collection-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}
.collection-card-info {
  padding: 8px;
}
.collection-card-rarity {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.collection-card-rarity.rarity-tier-5 { color: var(--ur); }
.collection-card-rarity.rarity-tier-4 { color: var(--ssr); }
.collection-card-rarity.rarity-tier-3 { color: var(--sr); }
.collection-card-rarity.rarity-tier-2 { color: var(--r); }
.collection-card-rarity.rarity-tier-1 { color: var(--n); }
.collection-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.collection-card-owned {
  margin-top: 4px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
}

.collection-empty {
  padding: 40px 16px;
  text-align: center;
}
.collection-empty p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.collection-empty .btn-primary {
  margin-top: 16px;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

.formation-panel {
  padding: 0 16px 20px;
  display: grid;
  gap: 18px;
}
.formation-battle-entry {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(52,152,219,0.18), rgba(28,33,55,0.96));
  border: 1px solid rgba(90,220,255,0.18);
}
.formation-battle-entry-head {
  display: grid;
  gap: 14px;
}
.formation-battle-entry-tag {
  margin: 0 0 6px;
  color: #8ee6ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.formation-battle-entry h3 {
  margin: 0 0 6px;
  color: #f4fbff;
}
.formation-battle-entry p {
  margin: 0;
  color: rgba(244,251,255,0.76);
  line-height: 1.6;
}
.formation-battle-entry-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.formation-convert-controls {
  position: fixed;
  right: max(16px, calc((100vw - min(100vw, var(--app-portrait-width))) / 2 + 16px));
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  z-index: 35;
  display: grid;
  justify-items: end;
  gap: 12px;
  pointer-events: none;
}
.formation-convert-controls > * {
  pointer-events: auto;
}
.formation-convert-window {
  width: min(340px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(9, 12, 24, 0.97);
  box-shadow: 0 24px 56px rgba(0,0,0,0.42);
  display: grid;
  gap: 12px;
}
.formation-convert-window[hidden] {
  display: none;
}
.formation-convert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.formation-convert-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.formation-convert-head strong {
  display: block;
  font-size: 0.92rem;
}
.formation-convert-head p,
.formation-convert-points,
.formation-convert-stamina p {
  margin-top: 4px;
  color: rgba(255,255,255,0.7);
  font-size: 0.74rem;
  line-height: 1.45;
}
.formation-convert-clear {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}
.formation-convert-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.formation-convert-stamina {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}
.formation-convert-stamina label {
  display: grid;
  gap: 6px;
  font-size: 0.76rem;
  color: rgba(255,255,255,0.82);
}
.formation-convert-stamina input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(0,0,0,0.22);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
.formation-convert-action {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffe08a, #f39c12);
  color: #2c2412;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}
.formation-convert-action.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.formation-convert-action:disabled {
  opacity: 0.45;
  cursor: default;
}
.formation-convert-fab {
  min-width: 92px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  background: linear-gradient(135deg, #ff8a65, #e53935);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 16px 32px rgba(229,57,53,0.28);
  cursor: pointer;
}
.formation-convert-fab.is-active {
  background: linear-gradient(135deg, #6c5ce7, #3498db);
  box-shadow: 0 16px 32px rgba(52,152,219,0.24);
}
.formation-party {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.formation-slot {
  position: relative;
  min-height: 112px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}
.formation-slot.active {
  border-color: rgba(255,212,71,0.7);
  box-shadow: 0 0 0 2px rgba(255,212,71,0.22);
}
.formation-slot img {
  width: 100%;
  max-height: 72px;
  object-fit: contain;
}
.formation-slot-name {
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}
.formation-slot-empty {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}
.formation-slot-order {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
}
.formation-slot-role {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 46px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(8,10,18,0.72);
  text-align: center;
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.86);
}
.formation-slot.active .formation-slot-role {
  background: rgba(255,212,71,0.22);
  color: #ffe08a;
}
.formation-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.formation-card {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  overflow: hidden;
  display: block;
  padding: 0;
  position: relative;
  cursor: pointer;
}
.formation-card.is-selected,
.formation-equipment-card.is-selected {
  border-color: rgba(255,212,71,0.72);
  box-shadow: 0 0 0 2px rgba(255,212,71,0.26);
}
.formation-card.is-assigned {
  border-color: rgba(162,155,254,0.45);
  box-shadow: 0 0 0 2px rgba(162,155,254,0.18);
}
.formation-card-preview {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
}
.formation-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.formation-card-badge {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(7, 10, 20, 0.74);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  font-size: 0.56rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.formation-card-rarity-badge {
  top: 5px;
  left: 5px;
}
.formation-card-attribute-badge {
  position: absolute;
  top: 28px;
  left: 5px;
  z-index: 2;
  pointer-events: none;
}
.formation-card-attribute-badge .attribute-chip-label {
  display: none;
}
.formation-card-rarity-badge.rarity-ur,
.formation-card-rarity-badge.rarity-ssr {
  color: #ffe08a;
}
.formation-card-rarity-badge.rarity-sr {
  color: #d7c4ff;
}
.formation-card-rarity-badge.rarity-r,
.formation-card-rarity-badge.rarity-n {
  color: #d8ecff;
}
.formation-card-evolve-badge {
  right: 5px;
  bottom: 26px;
}
.formation-card-limit-break-badge {
  left: 5px;
  bottom: 5px;
}
.formation-card-level-badge {
  right: 5px;
  bottom: 5px;
}
.formation-card-check {
  position: absolute;
  top: 26px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transform: scale(0.9);
}
.formation-card.is-selected .formation-card-check,
.formation-equipment-card.is-selected .formation-card-check {
  opacity: 1;
  transform: scale(1);
}
.formation-card.is-selected .formation-card-check::before,
.formation-equipment-card.is-selected .formation-card-check::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #ffd447;
}
.formation-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
}
.formation-subtitle {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.formation-subnote {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.58);
  margin-top: 2px;
  margin-bottom: 8px;
}
.formation-equipment-section {
  padding-top: 2px;
}
.formation-equipment-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}
.formation-equipment-card {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  overflow: hidden;
  display: block;
  padding: 0;
  cursor: pointer;
  position: relative;
}
.formation-equipment-card.is-owned {
  border-color: rgba(162,155,254,0.45);
  box-shadow: 0 0 0 2px rgba(162,155,254,0.16);
}
.formation-equipment-preview {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: rgba(0,0,0,0.18);
}
.formation-equipment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.editor-window-launcher-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.editor-window-launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.editor-dashboard-summary {
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}
.editor-dashboard-summary-head {
  margin-bottom: 10px;
}
.editor-dashboard-summary-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.58);
}
.editor-dashboard-summary-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}
.editor-dashboard-summary-id {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.58);
  word-break: break-all;
}
.editor-dashboard-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}
.editor-dashboard-stat {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(10,14,24,0.52);
  border: 1px solid rgba(255,255,255,0.06);
}
.editor-dashboard-stat-label {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.62);
}
.editor-dashboard-stat-value {
  display: block;
  margin-top: 4px;
  font-size: 1.1rem;
  font-weight: 800;
}
.editor-member-window {
  width: min(520px, calc(100vw - 48px));
}
.editor-member-list {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.editor-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 92px 92px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
}
.editor-member-row + .editor-member-row {
  border-top: 1px solid rgba(255,255,255,0.06);
}
.editor-member-row-head {
  background: rgba(255,255,255,0.08);
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255,255,255,0.72);
}
.editor-member-user {
  word-break: break-all;
}
.editor-member-role,
.editor-member-status {
  font-weight: 700;
}
.editor-member-note {
  margin-top: 12px;
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.62);
}
.editor-share-window {
  width: min(520px, calc(100vw - 48px));
}
.editor-share-copy {
  margin: 0 0 12px;
  color: rgba(255,255,255,0.82);
  font-size: 0.82rem;
  line-height: 1.45;
}
.editor-share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.editor-share-plan {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.editor-share-plan.is-paid {
  background: rgba(46, 204, 113, 0.14);
  color: #9fe7bc;
}
.editor-share-plan.is-free {
  background: rgba(255, 212, 71, 0.12);
  color: #ffe08a;
}
.editor-share-note {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
  margin-bottom: 8px;
}
.editor-share-status {
  min-height: 20px;
  margin-top: 12px;
  color: #9fe7bc;
  font-size: 0.78rem;
  font-weight: 700;
}
.editor-share-status.is-error {
  color: #ff9090;
}
.editor-window-launcher-btn-title {
  font-weight: 800;
}
.editor-window-launcher-btn-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.68);
}
@media (max-width: 640px) {
  .formation-convert-controls {
    right: 12px;
    left: 12px;
    justify-items: stretch;
  }
  .formation-convert-window {
    width: 100%;
  }
  .formation-convert-fab {
    justify-self: end;
  }
}

.formation-growth-detail[hidden] { display: none; }
.formation-growth-detail {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.76);
}
.formation-growth-detail-inner {
  width: min(92vw, 420px);
  max-height: 82vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.16);
  background: #12162b;
}
.formation-growth-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.formation-growth-detail-head h4 {
  font-size: 0.86rem;
  line-height: 1.4;
}
.formation-growth-close {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.formation-growth-body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 10px;
}
.formation-growth-summary {
  display: grid;
  gap: 12px;
}
.formation-growth-summary img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  object-fit: cover;
}
.formation-growth-meta {
  display: grid;
  gap: 6px;
  align-content: start;
}
.formation-growth-rarity {
  font-size: 0.72rem;
  color: #ffd47a;
  font-weight: 800;
}
.formation-growth-card-name {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.35;
}
.formation-growth-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.formation-growth-stats span {
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  padding: 7px 8px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
}
.formation-growth-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.formation-growth-btn {
  border: none;
  border-radius: 10px;
  padding: 9px 8px;
  background: linear-gradient(135deg, #64b5f6, #3f51b5);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.formation-growth-materials {
  display: grid;
  gap: 8px;
}
.formation-growth-materials-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.formation-growth-materials-head strong,
.formation-growth-materials-head span {
  font-size: 0.8rem;
  font-weight: 800;
}
.formation-growth-material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}
.formation-growth-material {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
}
.formation-growth-material img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.formation-growth-material.is-selected {
  border-color: rgba(255,212,71,0.72);
  box-shadow: 0 0 0 2px rgba(255,212,71,0.26);
}
.formation-growth-materials-empty {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.68);
  font-size: 0.74rem;
  line-height: 1.45;
}
.formation-growth-note {
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.72);
}

/* Card Detail Modal */
.card-detail[hidden] { display: none; }
.card-detail {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 250;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.card-detail-inner {
  width: 90%;
  max-width: 360px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
}
.card-detail-image {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
}
.card-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-detail-info {
  padding: 16px;
}
.card-detail-rarity {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--gold-dim);
  color: var(--gold);
  margin-bottom: 8px;
}
.card-detail-info h3 { font-size: 1.2rem; margin-bottom: 6px; }
.card-detail-info p { font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; }
.card-detail-attr {
  margin-bottom: 4px;
}
.attribute-chip {
  --attribute-color: #7f8c8d;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--attribute-color) 54%, rgba(255,255,255,0.12));
  background: color-mix(in srgb, var(--attribute-color) 18%, rgba(10,12,20,0.92));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
  vertical-align: middle;
}
.attribute-chip-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--attribute-color) 86%, #ffffff 14%);
  color: rgba(255,255,255,0.98);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}
.attribute-chip-label {
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
}
.attribute-chip-compact {
  min-height: 20px;
  gap: 4px;
  padding: 3px 7px 3px 4px;
}
.attribute-chip-compact .attribute-chip-icon {
  width: 14px;
  height: 14px;
  font-size: 0.52rem;
}
.attribute-chip-compact .attribute-chip-label {
  font-size: 0.64rem;
}
.attribute-chip-fire { --attribute-color: #e74c3c; }
.attribute-chip-thunder { --attribute-color: #9b59ff; }
.attribute-chip-wind { --attribute-color: #2ecc71; }
.attribute-chip-water { --attribute-color: #3498db; }
.attribute-chip-earth { --attribute-color: #e67e22; }
.attribute-chip-light { --attribute-color: #f1c40f; }
.attribute-chip-dark { --attribute-color: #4b3b6e; }
.attribute-chip-none { --attribute-color: #7f8c8d; }
.card-detail-stories {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}
.card-detail-voices {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}
.card-detail-voices h4,
.card-detail-stories h4 {
  font-size: 0.82rem;
  margin-bottom: 8px;
  color: var(--text);
}
.card-detail-voice-list,
.card-detail-story-list {
  display: grid;
  gap: 8px;
}
.card-detail-voice-item {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
}
.card-detail-voice-label {
  display: block;
  font-size: 0.72rem;
  color: var(--accent-light);
  margin-bottom: 4px;
}
.card-detail-voice-text {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}
.card-detail-story-btn {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.card-detail-close {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 16px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

/* ===== Base Character List ===== */
.editor-desc {
  padding: 0 0 12px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}
.base-char-list-section {
  margin-top: 20px;
}
.base-char-list-section h4 {
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.editor-list-section {
  margin-top: 24px;
}
.editor-list-section h4 {
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.base-char-list {
  display: grid;
  gap: 8px;
}
.base-char-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
}
.base-char-portrait {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-light);
  flex-shrink: 0;
}
.base-char-info {
  flex: 1;
  min-width: 0;
}
.base-char-info-name {
  font-size: 0.88rem;
  font-weight: 700;
}
.base-char-info-desc {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.base-char-color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.base-char-delete {
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: rgba(255,107,107,0.12);
  color: var(--ur);
  font-size: 0.72rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* Story scene character highlight in reader */
.story-reader-character-highlight {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 6px;
  border-radius: 3px;
}

/* ===== Editor Screen ===== */
.editor-panel {
  display: none;
  padding: 0 16px 20px;
}
.editor-panel.active { display: block; }

.editor-form {
  display: grid;
  gap: 14px;
}
.editor-form-actions-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -4px;
}
.editor-form-actions-inline {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}
.editor-form label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}
.editor-form input,
.editor-form select,
.editor-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.editor-form select {
  color: var(--text);
}
.editor-form select option {
  color: #fff;
  background: #0a0a12;
}
.editor-form textarea {
  min-height: 80px;
  resize: vertical;
}
.editor-form input::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.editor-preview {
  width: min(220px, 100%);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  max-height: 200px;
}
.editor-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-crop-editor,
.character-sd-editor,
.character-battle-editor {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
}
.character-collapsible > summary {
  font-weight: 700;
}
.character-crop-body,
.character-sd-body,
.character-battle-body {
  display: grid;
  gap: 14px;
  padding-top: 12px;
}
.editor-pack-note {
  margin: 8px 0 0;
  color: #9a3412;
  font-size: 0.85rem;
  font-weight: 700;
}
.character-battle-editor.is-pack-locked {
  opacity: 0.72;
}
.character-crop-header {
  display: grid;
  gap: 12px;
}
.character-crop-help,
.character-sd-help,
.character-battle-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.character-crop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.character-crop-tab {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.character-crop-tab.active {
  background: rgba(162,155,254,0.24);
  border-color: rgba(162,155,254,0.6);
  color: #fff;
}
.character-crop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 220px));
  gap: 12px;
  justify-content: start;
  align-items: start;
}
.character-crop-card {
  width: min(220px, 100%);
  min-width: 0;
  margin: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(7,10,20,0.38);
  cursor: pointer;
}
.character-crop-card.active {
  border-color: rgba(162,155,254,0.65);
  box-shadow: 0 0 0 1px rgba(162,155,254,0.32) inset;
}
.character-crop-card figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}
.character-crop-frame {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.character-crop-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.character-crop-frame-icon {
  aspect-ratio: 1 / 1;
}
.character-crop-frame-formationPortrait {
  aspect-ratio: 4 / 5;
}
.character-crop-frame-formationWide {
  aspect-ratio: 16 / 9;
}
.character-crop-frame-cutin {
  aspect-ratio: 21 / 9;
}
.character-crop-controls {
  display: grid;
  gap: 10px;
}
.character-crop-controls label {
  display: grid;
  grid-template-columns: 56px 1fr 48px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}
.character-crop-controls input[type="range"] {
  padding: 0;
}
.character-crop-controls span {
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.editor-record-list {
  display: grid;
  gap: 10px;
}
.editor-record-list-cards {
  grid-template-columns: 1fr;
}
.editor-record-empty {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
}
.editor-record-item,
.editor-record-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
}
.editor-record-item {
  padding: 14px;
}
.editor-record-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  overflow: hidden;
  padding: 0;
}
.editor-record-card img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  display: block;
}
.editor-record-card-body {
  padding: 12px 12px 12px 0;
}
.editor-record-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.editor-record-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(162,155,254,0.18);
  color: var(--accent-light);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.editor-record-badge.rarity-tier-5 {
  background: rgba(255,107,107,0.14);
  color: var(--ur);
}
.editor-record-badge.rarity-tier-4 {
  background: rgba(255,212,71,0.14);
  color: var(--ssr);
}
.editor-record-badge.rarity-tier-3 {
  background: rgba(162,155,254,0.18);
  color: var(--sr);
}
.editor-record-badge.rarity-tier-2 {
  background: rgba(116,185,255,0.16);
  color: var(--r);
}
.editor-record-badge.rarity-tier-1 {
  background: rgba(178,190,195,0.16);
  color: var(--n);
}
.editor-record-meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.editor-record-attribute {
  justify-self: end;
}
.editor-record-item h5,
.editor-record-card h5 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.editor-record-item p,
.editor-record-card p {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}
.editor-record-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.editor-inline-btn {
  padding: 6px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
}
#editor-story-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.editor-folder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.editor-folder-create-btn {
  width: auto;
  min-width: 112px;
}
.editor-folder-group {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.editor-folder-group + .editor-folder-group {
  margin-top: 10px;
}
.editor-folder-group summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  background: rgba(255,255,255,0.03);
  position: relative;
  padding-right: 40px;
}
.editor-folder-group summary::-webkit-details-marker {
  display: none;
}
.editor-folder-group summary::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  transition: transform 0.2s ease;
}
.editor-folder-group:not([open]) summary::after {
  transform: translateY(-50%) rotate(-90deg);
}
.editor-folder-group summary span {
  color: var(--muted);
  font-size: 0.8rem;
}
.editor-list-hint {
  margin-bottom: 10px;
  color: rgba(255,255,255,0.5);
  font-size: 0.76rem;
  line-height: 1.5;
}
.editor-folder-group-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}
.editor-inline-select {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.72rem;
}
.editor-inline-select select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
}
.editor-story-record {
  cursor: grab;
}
.editor-story-record.is-dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

/* Scene Editor */
.story-scenes-editor h4,
.story-variant-defaults h4,
.gacha-pool-selector h4,
.rate-inputs + h4 {
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.story-variant-default-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.story-variant-default-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
}
.story-variant-default-name {
  font-size: 0.9rem;
  color: var(--text);
}
.scene-list { display: grid; gap: 10px; margin-bottom: 10px; }
.scene-item {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
}
.scene-item label { margin-bottom: 6px; }
.scene-item .scene-remove {
  margin-top: 8px;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: rgba(255,107,107,0.15);
  color: var(--ur);
  font-size: 0.8rem;
  cursor: pointer;
}

/* Gacha Pool Chars */
.gacha-pool-chars {
  display: grid;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.gacha-pool-char {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}
.gacha-pool-char.selected {
  background: rgba(108,92,231,0.2);
  border: 1px solid var(--accent);
}
.gacha-pool-char img {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
}
.gacha-pool-char span { font-size: 0.82rem; }

.rate-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 6px;
}
.rate-inputs label {
  font-size: 0.75rem;
  text-align: center;
}
.rate-inputs input {
  width: 100%;
  text-align: center;
  padding: 8px 4px;
}

/* ===== Expression Editor ===== */
.expressions-editor h4,
.variants-editor h4,
.voice-lines-editor h4 {
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.editor-collapsible {
  margin: 8px 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.editor-collapsible summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.editor-collapsible summary::-webkit-details-marker {
  display: none;
}
.editor-collapsible summary::after {
  content: "+";
  color: var(--accent-light);
  font-size: 1rem;
}
.editor-collapsible[open] summary::after {
  content: "-";
}
.editor-collapsible .voice-lines-editor {
  padding: 0 14px 14px;
}
.editor-collapsible .voice-lines-editor:first-of-type {
  padding-top: 4px;
}
.voice-line-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.voice-line-fields label {
  margin-bottom: 0;
}
.relation-line-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}
.relation-line-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
}
.expression-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.expression-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
}
.expression-item input[name="expr-name"] {
  flex: 1;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}
.expression-upload {
  flex-shrink: 0;
}
.expression-upload input[type="file"] {
  width: 80px;
  font-size: 0.7rem;
}
.expr-set {
  color: #2ecc71;
  font-size: 1rem;
  flex-shrink: 0;
}
.expression-remove {
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  background: rgba(255,107,107,0.15);
  color: var(--ur);
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ===== Scene extras ===== */
.scene-extras[hidden] { display: none; }
.scene-extras {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--panel-border);
  display: grid;
  gap: 10px;
}
.scene-bottom-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.scene-extras-toggle {
  padding: 5px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: var(--accent-light);
  font-size: 0.75rem;
  cursor: pointer;
}
.scene-bg-set {
  font-size: 0.72rem;
  color: #2ecc71;
  margin-top: 4px;
}

.system-preview {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
}
.system-event-launcher-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.system-event-window-fields {
  display: grid;
  gap: 12px;
}
.system-preview h4 {
  font-size: 0.9rem;
}
.system-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.system-rarity-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(255,255,255,0.04);
}
.system-rarity-chip.rarity-tier-5 { color: var(--ur); }
.system-rarity-chip.rarity-tier-4 { color: var(--ssr); }
.system-rarity-chip.rarity-tier-3 { color: var(--sr); }
.system-rarity-chip.rarity-tier-2 { color: var(--r); }
.system-rarity-chip.rarity-tier-1 { color: var(--n); }

.editor-note {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
}

.home-edit-empty,
.layout-asset-library-empty {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.48);
}

/* ===== Story Reader Background Image ===== */
.story-reader-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.6;
}
.story-reader-bg-img[hidden] { display: none; }

/* ===== Story Reader Audio Controls ===== */
.story-reader-audio-ctrl {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
}
.story-reader-audio-ctrl[hidden] { display: none; }
.story-reader-audio-ctrl button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

/* ===== Utilities ===== */
.rarity-tier-5 .gacha-result-rarity, .collection-card-rarity.rarity-tier-5 { color: var(--ur); }
.rarity-tier-4 .gacha-result-rarity, .collection-card-rarity.rarity-tier-4 { color: var(--ssr); }
.rarity-tier-3 .gacha-result-rarity, .collection-card-rarity.rarity-tier-3 { color: var(--sr); }
.rarity-tier-2 .gacha-result-rarity, .collection-card-rarity.rarity-tier-2 { color: var(--r); }
.rarity-tier-1 .gacha-result-rarity, .collection-card-rarity.rarity-tier-1 { color: var(--n); }

/* Toast notification */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 150;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
  pointer-events: none;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ===== Landscape/Fullscreen shared styles (class-based) ===== */
/* Shared compact styles for both landscape-mode and fullscreen-mode */
body.landscape-mode,
body.fullscreen-mode {
  --nav-height: 48px;
}

body:is(.landscape-mode, .fullscreen-mode) .bottom-nav-icon { font-size: 1.1rem; }
body:is(.landscape-mode, .fullscreen-mode) .bottom-nav-label { font-size: 0.58rem; }

body:is(.landscape-mode, .fullscreen-mode) .home-topbar { padding: 4px 12px; }
body:is(.landscape-mode, .fullscreen-mode) .home-lv { padding: 2px 8px; }
body:is(.landscape-mode, .fullscreen-mode) .home-lv-num { font-size: 0.75rem; }
body:is(.landscape-mode, .fullscreen-mode) .home-player-name { font-size: 0.68rem; }
body:is(.landscape-mode, .fullscreen-mode) .home-currency { padding: 2px 6px; font-size: 0.62rem; }
body:is(.landscape-mode, .fullscreen-mode) .home-currency-icon { width: 11px; height: 11px; }

body:is(.landscape-mode, .fullscreen-mode) .home-side-left { top: 44px; left: 6px; gap: 4px; }
body:is(.landscape-mode, .fullscreen-mode) .home-side-btn { padding: 5px 6px; min-width: 40px; font-size: 0.55rem; border-radius: 8px; }
body:is(.landscape-mode, .fullscreen-mode) .home-side-icon { font-size: 0.9rem; }

body:is(.landscape-mode, .fullscreen-mode) .home-side-right {
  bottom: 8px;
  right: 8px;
}
body:is(.landscape-mode, .fullscreen-mode) .home-menu-btn { width: 56px; height: 56px; font-size: 0.6rem; }

body:is(.landscape-mode, .fullscreen-mode) .home-event-banner { top: 38px; right: 72px; width: min(180px, 25vw); }
body:is(.landscape-mode, .fullscreen-mode) .home-event-tag { padding: 1px 6px; font-size: 0.55rem; }
body:is(.landscape-mode, .fullscreen-mode) .home-event-body { padding: 5px 8px; }
body:is(.landscape-mode, .fullscreen-mode) .home-event-title { font-size: 0.7rem; }
body:is(.landscape-mode, .fullscreen-mode) .home-event-sub { font-size: 0.55rem; }

body:is(.landscape-mode, .fullscreen-mode) .home-character { bottom: 40px; }
body:is(.landscape-mode, .fullscreen-mode) .home-character img { max-height: calc(100vh - 140px); max-width: 50vw; }

body:is(.landscape-mode, .fullscreen-mode) .home-speech { bottom: 50px; right: 12px; max-width: 180px; padding: 7px 10px; }
body:is(.landscape-mode, .fullscreen-mode) .home-speech-name { font-size: 0.58rem; }
body:is(.landscape-mode, .fullscreen-mode) .home-speech-text { font-size: 0.68rem; }
body:is(.landscape-mode, .fullscreen-mode) .home-speech-2 { bottom: 100px; left: 12px; }

body:is(.landscape-mode, .fullscreen-mode) .home-ticker { bottom: 4px; left: 6px; right: 6px; padding: 4px 10px; }
body:is(.landscape-mode, .fullscreen-mode) .home-ticker-badge { font-size: 0.5rem; padding: 1px 6px; }
body:is(.landscape-mode, .fullscreen-mode) .home-ticker-text { font-size: 0.62rem; }

body:is(.landscape-mode, .fullscreen-mode) .home-config-panel { max-width: 90vw; max-height: 88vh; padding: 14px; }
body:is(.landscape-mode, .fullscreen-mode) .home-config-panel h4 { font-size: 0.9rem; margin-bottom: 8px; }
body:is(.landscape-mode, .fullscreen-mode) .home-config-stage { height: 200px; }

body:is(.landscape-mode, .fullscreen-mode) .gacha-active-area,
body:is(.landscape-mode, .fullscreen-mode) .gacha-history,
body:is(.landscape-mode, .fullscreen-mode) .gacha-banner-list,
body:is(.landscape-mode, .fullscreen-mode) .gacha-results {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
body:is(.landscape-mode, .fullscreen-mode) .gacha-banner-list {
  grid-template-columns: 1fr;
  padding: 0 16px 16px;
}
body:is(.landscape-mode, .fullscreen-mode) .gacha-active-area { padding: 16px; }
body:is(.landscape-mode, .fullscreen-mode) .gacha-results { padding: 16px; }
body:is(.landscape-mode, .fullscreen-mode) .gacha-results-grid { grid-template-columns: repeat(5, 1fr); max-width: 600px; margin: 0 auto; }
body:is(.landscape-mode, .fullscreen-mode) .gacha-no-banner { padding: 24px; }

body:is(.landscape-mode, .fullscreen-mode) .story-tabs,
body:is(.landscape-mode, .fullscreen-mode) .editor-tabs { padding: 0 24px; }
body:is(.landscape-mode, .fullscreen-mode) .story-list { padding: 0 24px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

body:is(.landscape-mode, .fullscreen-mode) .story-reader { max-width: 100%; flex-direction: column; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-character { flex: 1; align-items: flex-end; justify-content: center; min-width: 0; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-character img { max-height: calc(100vh - 110px); max-width: 60%; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-textbox { min-height: 90px; padding: 10px 24px; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-name { font-size: 0.8rem; margin-bottom: 4px; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-text { font-size: 0.85rem; line-height: 1.5; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-close { top: 8px; right: 8px; width: 32px; height: 32px; font-size: 0.85rem; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-audio-ctrl { top: 8px; left: 8px; }
body:is(.landscape-mode, .fullscreen-mode) .story-reader-audio-ctrl button { width: 32px; height: 32px; font-size: 0.85rem; }

body:is(.landscape-mode, .fullscreen-mode) .collection-filters { padding: 0 24px; }
body:is(.landscape-mode, .fullscreen-mode) .collection-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); padding: 0 24px; }

body:is(.landscape-mode, .fullscreen-mode) .card-detail-inner {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: 1fr auto;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}
body:is(.landscape-mode, .fullscreen-mode) .card-detail-image { aspect-ratio: auto; height: 100%; }
body:is(.landscape-mode, .fullscreen-mode) .card-detail-image img { height: 100%; object-fit: cover; }
body:is(.landscape-mode, .fullscreen-mode) .card-detail-info { overflow-y: auto; max-height: 60vh; }
body:is(.landscape-mode, .fullscreen-mode) .card-detail-close { grid-column: 1 / -1; }

body:is(.landscape-mode, .fullscreen-mode) .editor-panel { padding: 0 24px 20px; max-width: 720px; margin: 0 auto; }
body:is(.landscape-mode, .fullscreen-mode) .editor-tabs { max-width: 720px; margin-left: auto; margin-right: auto; }
body:is(.landscape-mode, .fullscreen-mode) .editor-record-list-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
body:is(.landscape-mode, .fullscreen-mode) .voice-line-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body:is(.landscape-mode, .fullscreen-mode) .toast { bottom: calc(var(--nav-height) + 8px); }

/* ===== Fullscreen: fill screen ===== */
body.fullscreen-mode .app-shell {
  max-width: 100%;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 4px);
}
body.fullscreen-mode .bottom-nav { max-width: 100%; height: var(--nav-height); }
body.fullscreen-mode #screen-home { height: calc(100vh - var(--nav-height)); }
body.fullscreen-mode .gacha-overlay { max-width: 100%; }
body.fullscreen-mode .card-detail { max-width: 100%; }
body.fullscreen-mode .story-reader { max-width: 100%; }

/* ===== Landscape: boxed (rotated portrait ratio) ===== */
body.landscape-mode .app-shell {
  width: min(100vw, var(--app-landscape-width));
  max-width: var(--app-landscape-width);
  height: min(100vh, var(--app-landscape-height));
  min-height: 0;
  margin: auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 0;
  border: 1px solid var(--panel-border);
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 853 / 480;
}
body.landscape-mode .bottom-nav {
  position: sticky;
  bottom: 0;
  left: 0;
  transform: none;
  width: 100%;
  max-width: none;
  height: var(--nav-height);
  flex-shrink: 0;
}
body.landscape-mode .screen {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
body.landscape-mode #screen-home {
  height: auto;
  flex: 1;
}
body.landscape-mode .gacha-overlay {
  position: absolute;
  max-width: var(--app-landscape-width);
}
body.landscape-mode .card-detail {
  position: absolute;
  max-width: var(--app-landscape-width);
}
body.landscape-mode .story-reader {
  position: absolute;
  max-width: var(--app-landscape-width);
  max-height: var(--app-landscape-height);
  top: 0;
  bottom: 0;
}
body.landscape-mode .home-character img {
  max-height: calc(var(--app-landscape-height) - 140px);
}
body.landscape-mode .story-reader-character img {
  max-height: calc(var(--app-landscape-height) - 110px);
}

/* Force portrait: override max-width even on wide screens */
body.portrait-mode .app-shell { max-width: 480px; }
body.portrait-mode .bottom-nav { max-width: 480px; }
body.portrait-mode .story-reader { max-width: 480px; }
body.portrait-mode .gacha-overlay { max-width: 480px; }
body.portrait-mode .card-detail { max-width: 480px; }

/* ===== Auto Landscape (device orientation) ===== */
/* Only applies when no forced class is set */
@media (orientation: landscape) and (max-height: 600px) {
  body:not(.portrait-mode) {
    --nav-height: 48px;
  }
  body:not(.portrait-mode) .app-shell {
    width: min(100vw, var(--app-landscape-width));
    max-width: var(--app-landscape-width);
    height: min(100vh, var(--app-landscape-height));
    min-height: 0;
    margin: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0;
    border: 1px solid var(--panel-border);
    position: relative;
    display: flex;
    flex-direction: column;
    aspect-ratio: 853 / 480;
  }
  body:not(.portrait-mode) .bottom-nav {
    position: sticky;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: none;
    height: var(--nav-height);
    flex-shrink: 0;
  }
  body:not(.portrait-mode) .bottom-nav-icon { font-size: 1.1rem; }
  body:not(.portrait-mode) .bottom-nav-label { font-size: 0.58rem; }

  body:not(.portrait-mode) .screen {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
  body:not(.portrait-mode) #screen-home { height: auto; flex: 1; }
  body:not(.portrait-mode) .home-topbar { padding: 4px 12px; }
  body:not(.portrait-mode) .home-lv { padding: 2px 8px; }
  body:not(.portrait-mode) .home-lv-num { font-size: 0.75rem; }
  body:not(.portrait-mode) .home-player-name { font-size: 0.68rem; }
  body:not(.portrait-mode) .home-currency { padding: 2px 6px; font-size: 0.62rem; }
  body:not(.portrait-mode) .home-currency-icon { width: 11px; height: 11px; }

  body:not(.portrait-mode) .home-side-left { top: 44px; left: 6px; gap: 4px; }
  body:not(.portrait-mode) .home-side-btn { padding: 5px 6px; min-width: 40px; font-size: 0.55rem; border-radius: 8px; }
  body:not(.portrait-mode) .home-side-icon { font-size: 0.9rem; }

  body:not(.portrait-mode) .home-side-right { bottom: 8px; right: 8px; }
  body:not(.portrait-mode) .home-menu-btn { height: 44px; font-size: 0.85rem; }

  body:not(.portrait-mode) .home-event-banner { top: 38px; right: 72px; width: min(180px, 25vw); }
  body:not(.portrait-mode) .home-event-tag { padding: 1px 6px; font-size: 0.55rem; }
  body:not(.portrait-mode) .home-event-body { padding: 5px 8px; }
  body:not(.portrait-mode) .home-event-title { font-size: 0.7rem; }
  body:not(.portrait-mode) .home-event-sub { font-size: 0.55rem; }

  body:not(.portrait-mode) .home-character { bottom: 40px; }
  body:not(.portrait-mode) .home-character img { max-height: calc(100vh - 140px); max-width: 50vw; }

  body:not(.portrait-mode) .home-speech { bottom: 50px; right: 12px; max-width: 180px; padding: 7px 10px; }
  body:not(.portrait-mode) .home-speech-name { font-size: 0.58rem; }
  body:not(.portrait-mode) .home-speech-text { font-size: 0.68rem; }
  body:not(.portrait-mode) .home-speech-2 { bottom: 100px; left: 12px; }

  body:not(.portrait-mode) .home-ticker { bottom: 4px; left: 6px; right: 6px; padding: 4px 10px; }
  body:not(.portrait-mode) .home-ticker-badge { font-size: 0.5rem; padding: 1px 6px; }
  body:not(.portrait-mode) .home-ticker-text { font-size: 0.62rem; }

  body:not(.portrait-mode) .home-config-panel { max-width: 90vw; max-height: 88vh; padding: 14px; }
  body:not(.portrait-mode) .home-config-panel h4 { font-size: 0.9rem; margin-bottom: 8px; }
  body:not(.portrait-mode) .home-config-stage { height: 200px; }

  body:not(.portrait-mode) .gacha-active-area,
  body:not(.portrait-mode) .gacha-history,
  body:not(.portrait-mode) .gacha-banner-list,
  body:not(.portrait-mode) .gacha-results {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }
  body:not(.portrait-mode) .gacha-banner-list { grid-template-columns: 1fr; padding: 0 16px 16px; }
  body:not(.portrait-mode) .gacha-active-area { padding: 16px; }
  body:not(.portrait-mode) .gacha-overlay { max-width: var(--app-landscape-width); }
  body:not(.portrait-mode) .gacha-results { padding: 16px; }
  body:not(.portrait-mode) .gacha-results-grid { grid-template-columns: repeat(5, 1fr); max-width: 600px; margin: 0 auto; }
  body:not(.portrait-mode) .gacha-no-banner { padding: 24px; }

  body:not(.portrait-mode) .story-tabs,
  body:not(.portrait-mode) .editor-tabs { padding: 0 24px; }
  body:not(.portrait-mode) .story-list { padding: 0 24px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

  body:not(.portrait-mode) .story-reader { max-width: 100%; flex-direction: column; }
  body:not(.portrait-mode) .story-reader-character { flex: 1; align-items: flex-end; justify-content: center; min-width: 0; }
  body:not(.portrait-mode) .story-reader-character img { max-height: calc(100vh - 110px); max-width: 60%; }
  body:not(.portrait-mode) .story-reader-textbox { min-height: 90px; padding: 10px 24px; }
  body:not(.portrait-mode) .story-reader-name { font-size: 0.8rem; margin-bottom: 4px; }
  body:not(.portrait-mode) .story-reader-text { font-size: 0.85rem; line-height: 1.5; }
  body:not(.portrait-mode) .story-reader-close { top: 8px; right: 8px; width: 32px; height: 32px; font-size: 0.85rem; }
  body:not(.portrait-mode) .story-reader-audio-ctrl { top: 8px; left: 8px; }
  body:not(.portrait-mode) .story-reader-audio-ctrl button { width: 32px; height: 32px; font-size: 0.85rem; }

  body:not(.portrait-mode) .collection-filters { padding: 0 24px; }
  body:not(.portrait-mode) .collection-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); padding: 0 24px; }

  body:not(.portrait-mode) .card-detail { max-width: 100%; }
  body:not(.portrait-mode) .card-detail-inner {
    display: grid; grid-template-columns: 200px 1fr; grid-template-rows: 1fr auto;
    max-width: 600px; max-height: 90vh; overflow-y: auto;
  }
  body:not(.portrait-mode) .card-detail-image { aspect-ratio: auto; height: 100%; }
  body:not(.portrait-mode) .card-detail-image img { height: 100%; object-fit: cover; }
  body:not(.portrait-mode) .card-detail-info { overflow-y: auto; max-height: 60vh; }
  body:not(.portrait-mode) .card-detail-close { grid-column: 1 / -1; }

  body:not(.portrait-mode) .editor-panel { padding: 0 24px 20px; max-width: 720px; margin: 0 auto; }
  body:not(.portrait-mode) .editor-tabs { max-width: 720px; margin-left: auto; margin-right: auto; }
  body:not(.portrait-mode) .editor-record-list-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  body:not(.portrait-mode) .voice-line-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body:not(.portrait-mode) .toast { bottom: calc(var(--nav-height) + 8px); }
}

/* Wider landscape for tablets/desktop */
@media (orientation: landscape) and (min-width: 900px) {
  body:not(.portrait-mode) .home-side-right { bottom: 12px; right: 16px; }
  body:not(.portrait-mode) .home-menu-btn { height: 48px; font-size: 0.9rem; }
  body:not(.portrait-mode) .home-character img { max-width: 40vw; }
  body:not(.portrait-mode) .story-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  body:not(.portrait-mode) .collection-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  body:not(.portrait-mode) .editor-panel { max-width: 900px; }
  body:not(.portrait-mode) .editor-tabs { max-width: 900px; }
  body:not(.portrait-mode) .voice-line-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Home Edit Windows */
.home-edit-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: visible;
}
.home-edit-overlay.active {
  pointer-events: auto;
}
.home-edit-window {
  position: absolute;
  width: min(420px, calc(100vw - 24px));
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10, 14, 28, 0.92);
  box-shadow: 0 24px 64px rgba(0,0,0,0.38);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
.home-edit-window[hidden],
.home-edit-window.is-hidden-window {
  display: none;
}
.home-edit-window-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: move;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.home-edit-window-head strong,
.home-edit-window-head h4 {
  display: block;
  margin: 0;
  font-size: 0.96rem;
}
.home-edit-window-head p {
  margin: 4px 0 0;
  color: rgba(255,255,255,0.68);
  font-size: 0.72rem;
  line-height: 1.5;
}
.home-edit-close,
.home-edit-window-hide {
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.home-edit-close {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  line-height: 1;
}
.home-edit-window-hide {
  padding: 8px 12px;
  white-space: nowrap;
}
.home-edit-menu-window {
  width: min(320px, calc(100vw - 24px));
}
.home-edit-menu-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px 16px;
}
.home-edit-menu-btn {
  min-height: 48px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.home-edit-menu-btn.active,
.home-edit-menu-btn.is-active {
  background: linear-gradient(135deg, rgba(108,92,231,0.38), rgba(52,152,219,0.26));
  border-color: rgba(162,155,254,0.45);
}
.home-edit-builder {
  width: min(430px, calc(100vw - 24px));
}
.home-edit-base-char-window {
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100vh - 110px);
}
.home-edit-folder-window {
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100vh - 110px);
}
.home-edit-window-body {
  max-height: calc(100vh - 172px);
  overflow: auto;
}
.home-edit-folder-window-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}
.home-edit-folder-section {
  display: grid;
  gap: 10px;
}
.home-edit-folder-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.home-edit-folder-list {
  display: grid;
  gap: 10px;
}
.home-edit-folder-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.home-edit-folder-card.active {
  border-color: rgba(162,155,254,0.5);
  box-shadow: 0 0 0 1px rgba(162,155,254,0.18) inset;
}
.home-edit-folder-main {
  display: grid;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.home-edit-folder-main-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.home-edit-folder-main-top strong {
  font-size: 0.9rem;
}
.home-edit-folder-main-top span {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.62);
}
.home-edit-folder-thumb-strip {
  display: flex;
  gap: 8px;
}
.home-edit-folder-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05) center/cover no-repeat;
  border: 1px solid rgba(255,255,255,0.08);
}
.home-edit-folder-thumb.is-empty {
  background-image: none;
}
.home-edit-folder-actions {
  display: flex;
  align-items: flex-start;
}
.home-edit-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.home-edit-icon-btn.danger {
  color: #ff9b9b;
}
.home-edit-window-panel {
  margin: 0;
  padding: 16px;
  max-width: none;
}
.home-edit-window-panel .editor-desc {
  margin-top: 0;
}
.home-edit-window-panel .base-char-list-section {
  margin-top: 18px;
}
body.home-edit-mode .home-side-left,
body.home-edit-mode .home-side-right {
  z-index: 40;
}
@media (max-width: 900px) {
  .home-edit-menu-window,
  .home-edit-builder,
  .home-edit-base-char-window {
    width: calc(100vw - 20px);
  }
  .home-edit-menu-body {
    grid-template-columns: 1fr;
  }
}
