/* ── INTRO SCREEN ──────────────────────────────────────────────────────────── */
#screen-intro {
  background: #080810;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.intro-text-section {
  flex-shrink: 0;
  padding: 32px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Base style for all intro lines — start invisible */
.intro-line {
  margin: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  font-family: 'Georgia', 'Times New Roman', serif;
  color: var(--text);
  line-height: 1.7;
}
.intro-line.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Opening sentence — full weight, slightly larger */
.intro-line-opening {
  font-size: 15px;
  font-weight: normal;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* "While other Orcs..." lead-in */
.intro-line-lead {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Indented bullet lines */
.intro-line-item {
  font-size: 13px;
  color: var(--text);
  padding-left: 14px;
  border-left: 2px solid rgba(200,150,26,0.35);
}

/* "Not anymore." */
.intro-not-anymore {
  font-size: 1.5rem;
  font-style: italic;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
  margin-top: 8px;
}

.intro-img-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.intro-scene-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.8s ease, transform 1.8s ease;
}
.intro-scene-img.visible {
  opacity: 1;
  transform: scale(1);
}

#skip-intro-btn {
  position: absolute;
  bottom: 14px; right: 14px;
  z-index: 9999;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  border-radius: var(--radius);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: rgba(255,255,255,0.2);
}

/* ── MAIN / TITLE SCREEN ───────────────────────────────────────────────────── */
#screen-main {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 24px 32px;
  width: 100%;
}

.main-logo-wrap {
  width: 80%;
  max-width: 280px;
}
.main-logo-img {
  width: 100%;
  display: block;
}

.main-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.main-credit {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.main-feedback {
  font-size: 12px;
  color: var(--gold-bright);
  text-decoration: none;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border: 1px solid rgba(200,150,26,0.3);
  border-radius: var(--radius);
  transition: background 0.15s;
}
.main-feedback:hover { background: rgba(200,150,26,0.1); }

.main-difficulty-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.main-diff-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.main-diff-btns {
  display: flex;
  gap: 8px;
}
.diff-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: var(--tap-min);
}
.diff-btn.active {
  background: linear-gradient(135deg, #7a5c10, #c8961a);
  border-color: var(--gold-bright);
  color: #1a1000;
  font-weight: bold;
}
.main-diff-desc {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  min-height: 2.4em;
  line-height: 1.4;
  max-width: 280px;
}

.main-start-btn {
  width: 100%;
  max-width: 280px;
  font-size: 1rem;
  letter-spacing: 0.08em;
  min-height: 52px;
}

/* ── PARTY TACTICS SCREEN ──────────────────────────────────────────────────── */
#screen-tactics {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tactics-header {
  flex-shrink: 0;
  padding: 10px 14px;
  border-bottom: 2px solid var(--gold);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tactics-title {
  font-size: 14px;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
  font-weight: bold;
  flex: 1;
  min-width: 0;
}

.tactics-continue-btn {
  flex-shrink: 0;
  font-size: 12px;
  padding: 8px 14px;
}

.tactics-units {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tactics-unit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.tactics-unit.lortar {
  border-color: var(--gold);
}

/* ── Info row (portrait + stats) ── */
.tactics-unit-info-row {
  display: flex;
  gap: 10px;
  padding: 10px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
}

.tactics-portrait-wrap {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.tactics-unit-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tactics-unit-name {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lortar-badge {
  font-size: 9px;
  background: var(--gold);
  color: #000;
  border-radius: 3px;
  padding: 1px 4px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

.tactics-unit-hp {
  font-size: 11px;
  color: var(--text-dim);
}

.tactics-unit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.tactics-action {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.tactics-action.red    { background: var(--red-bg);    color: var(--red-bright); }
.tactics-action.blue   { background: var(--blue-bg);   color: var(--blue-bright); }
.tactics-action.purple { background: var(--purple-bg); color: var(--purple-bright); }

/* ── Cards area (active + reserve columns) ── */
.tactics-cards-area {
  display: flex;
  padding: 8px;
  gap: 8px;
}

.tactics-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.active-col  { flex: 3; }
.reserve-col { flex: 2; border-left: 1px solid var(--border); padding-left: 8px; }

.tactics-col-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
}
.active-col  .tactics-col-label { color: var(--green-bright); }
.reserve-col .tactics-col-label { color: var(--text-dim); }

.tactics-col-label span {
  color: var(--text-dark);
  font-size: 8px;
  font-weight: normal;
}

/* ── Individual card slots ── */
.tactics-slot {
  border-radius: 5px;
  border: 1px solid var(--border);
  padding: 4px 6px;
  min-height: 36px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  transition: border-color 0.15s, opacity 0.15s;
}

.tactics-slot.empty {
  background: var(--surface2);
  border-style: dashed;
  justify-content: center;
}

.tactics-slot.picked {
  border-color: var(--gold-bright) !important;
  box-shadow: 0 0 0 1px var(--gold-bright);
  opacity: 0.85;
}

.tactics-slot:not(.empty):active { opacity: 0.75; }

.tactics-empty-label {
  font-size: 10px;
  color: var(--text-dark);
}

.tactics-card-icon {
  font-size: 13px;
  flex-shrink: 0;
  line-height: 1;
}

.tactics-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tactics-card-name {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tactics-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  white-space: normal;
  line-height: 1.4;
}

/* Color-coded slot backgrounds (inherits from card-* classes in style.css) */
.tactics-slot.card-red    { background: var(--red-bg);    border-color: var(--red); }
.tactics-slot.card-blue   { background: var(--blue-bg);   border-color: var(--blue); }
.tactics-slot.card-purple { background: var(--purple-bg); border-color: var(--purple); }

/* Base actions (innate unit abilities) get a slightly brighter border to distinguish from loot */
.tactics-slot.base-action { opacity: 1; }
.tactics-slot.base-action .tactics-card-name::after {
  content: ' ★';
  font-size: 7px;
  opacity: 0.5;
}

/* ── TACTICS DISCARD BAR ───────────────────────────────────────────────────── */
.tactics-discard-bar {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 2px solid var(--red-bright);
  gap: 12px;
}
.tactics-discard-bar.visible { display: flex; }
.tactics-discard-label {
  font-size: 13px;
  color: var(--text-dim);
  flex: 1;
}
.tactics-discard-btn {
  padding: 8px 20px;
  background: transparent;
  border: 2px solid var(--red-bright);
  border-radius: var(--radius);
  color: var(--red-bright);
  font-size: 14px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  min-height: var(--tap-min);
  letter-spacing: 0.04em;
}
.tactics-discard-btn:active { background: var(--red-bg); }

/* ── LOOT SCREEN ───────────────────────────────────────────────────────────── */
#screen-loot {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.loot-header {
  padding: 16px 16px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.loot-header h2 { color: var(--gold-bright); }
.loot-header p  { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.loot-cards-area {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
}

/* Single-card layout (new flow: one card shown, no selection) */
.loot-single-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.loot-card-single {
  flex: none !important;
  width: 220px;
  cursor: default !important;
  animation: slideUp 0.4s ease;
}
.loot-card-single:active { transform: none !important; }
.loot-card-single.card-red    { box-shadow: 0 0 0 2px var(--red-bright),    0 8px 28px rgba(183,72,75,0.45); }
.loot-card-single.card-blue   { box-shadow: 0 0 0 2px var(--blue-bright),   0 8px 28px rgba(41,128,185,0.45); }
.loot-card-single.card-purple { box-shadow: 0 0 0 2px var(--purple-bright), 0 8px 28px rgba(142,68,173,0.45); }

.loot-card {
  flex: 1;
  max-width: 120px;
  min-height: 180px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  padding: 10px 8px;
  gap: 6px;
  animation: slideUp 0.3s ease;
}
.loot-card:nth-child(2) { animation-delay: 0.1s; }
.loot-card:nth-child(3) { animation-delay: 0.2s; }

.loot-card:active { transform: scale(0.97); }

.loot-card.selected {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.8);
}
.loot-card.selected.card-red    { box-shadow: 0 8px 24px rgba(183,72,75,0.5); }
.loot-card.selected.card-blue   { box-shadow: 0 8px 24px rgba(41,128,185,0.5); }
.loot-card.selected.card-purple { box-shadow: 0 8px 24px rgba(142,68,173,0.5); }

.loot-card-icon {
  font-size: 1.8rem;
  text-align: center;
  line-height: 1;
}
.loot-card-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.loot-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.loot-card-icon-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.loot-card-name {
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  line-height: 1.3;
  color: var(--text);
}
.loot-card-effect {
  font-size: 11px;
  text-align: center;
  color: var(--text-dim);
}
.loot-card-val {
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
}
.loot-card-rarity {
  font-size: 10px;
  text-align: center;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.rarity-common   { color: var(--text-dim); }
.rarity-uncommon { color: var(--blue-bright); }
.rarity-rare     { color: var(--gold-bright); }

/* Assign panel slides up */
.assign-panel {
  background: var(--surface);
  border-top: 2px solid var(--gold);
  padding: 12px 16px;
  transition: transform 0.3s ease;
  transform: translateY(100%);
  flex-shrink: 0;
}
.assign-panel.visible { transform: translateY(0); }

.assign-panel h3 {
  font-size: 13px;
  color: var(--gold-bright);
  margin-bottom: 10px;
  text-align: center;
}

.ally-choices {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.ally-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 10px 8px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface2);
  min-width: 84px;
  transition: border-color 0.2s, background 0.2s;
}
.ally-choice-btn:active { background: var(--surface); }
.ally-choice-btn.lortar { border-color: var(--gold); }

.ally-choice-btn .ally-portrait-sm {
  width: 64px; height: 64px;
  border-radius: var(--radius);
  object-fit: cover;
}
.ally-choice-btn .ally-name-sm {
  font-size: 13px;
  color: var(--text);
  text-align: center;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loot-controls {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── RECRUIT SCREEN ────────────────────────────────────────────────────────── */
#screen-recruit {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.recruit-header {
  padding: 16px 16px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.recruit-header h2 { color: var(--gold-bright); }
.recruit-header p  { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── Single-ally recruit layout ── */
.recruit-single-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.recruit-single-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.35s ease;
}

.recruit-portrait-lg {
  width: 120px !important;
  height: 120px !important;
}

.recruit-single-name {
  font-size: 18px;
  font-weight: bold;
  color: var(--gold-bright);
  text-align: center;
}

.recruit-single-hp {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
}

.recruit-single-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recruit-action-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.recruit-action-label {
  font-size: 10px;
  opacity: 0.6;
  font-style: italic;
  flex-shrink: 0;
  width: 52px;
}

.recruit-action-name {
  flex: 1;
  font-size: 13px;
  font-weight: bold;
}

.recruit-action-val {
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

.recruit-action-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
  padding-left: 58px;
}

/* Legacy card styles kept for compatibility */
.recruit-cards-area {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
}

.recruit-card {
  flex: 1;
  max-width: 130px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 10px 8px;
  gap: 6px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  animation: slideUp 0.3s ease;
}
.recruit-card:nth-child(2) { animation-delay: 0.1s; }
.recruit-card:nth-child(3) { animation-delay: 0.2s; }
.recruit-card:active { transform: scale(0.97); }
.recruit-card.selected {
  border-color: var(--gold);
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(200,150,26,0.4);
}

.recruit-portrait {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  align-self: center;
}
.recruit-portrait-wrap { width: 80px; height: 80px; align-self: center; }
.recruit-portrait-wrap .portrait-placeholder { font-size: 1.5rem; }

.recruit-name {
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  color: var(--gold-bright);
}
.recruit-hp {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
.recruit-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.recruit-action-row {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.recruit-action-row.red    { background: var(--red-bg);    color: var(--red-bright); }
.recruit-action-row.blue   { background: var(--blue-bg);   color: var(--blue-bright); }
.recruit-action-row.purple { background: var(--purple-bg); color: var(--purple-bright); }

.recruit-controls {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.recruit-controls .btn { flex: 1; }

/* ── GAMEOVER / WIN SCREEN ─────────────────────────────────────────────────── */
#screen-gameover, #screen-win {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 20px;
  text-align: center;
}

.endgame-portrait-wrap {
  width: 160px; height: 160px;
}
.endgame-portrait-wrap .portrait-placeholder {
  font-size: 3rem;
}

.endgame-defeat-img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  border-radius: 8px;
}

.endgame-btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.endgame-title {
  font-size: 2.5rem;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 16px rgba(0,0,0,0.9);
}
.endgame-title.defeat { color: var(--red-bright); }
.endgame-title.victory { color: var(--gold-bright); }

.endgame-subtitle {
  font-size: var(--font-min);
  color: var(--text-dim);
  max-width: 280px;
  line-height: 1.6;
}

/* ── LEVEL BADGE ───────────────────────────────────────────────────────────── */
.level-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
  z-index: 10;
}
