:root {
  --bg: #f7efe3;
  --paper: #fffaf1;
  --ink: #241914;
  --muted: #766558;
  --line: #ead8c0;
  --red: #c9342b;
  --red-dark: #9f261f;
  --gold: #d89a22;
  --gold-dark: #966412;
  --gold-soft: #fff0c7;
  --green: #177245;
  --green-dark: #0e4c2d;
  --green-soft: #e2f4df;
  --yellow: #f4b942;
  --orange: #e87824;
  --brown: #3f2a21;
  --brown-dark: #251712;
  --shadow: 0 10px 24px rgba(61, 37, 20, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(244, 185, 66, 0.22), transparent 32%),
    linear-gradient(180deg, #fff6e6 0%, var(--bg) 42%, #f4e4cf 100%);
  overflow-x: hidden;
  touch-action: manipulation;
}

button {
  font: inherit;
  touch-action: manipulation;
}

#app {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 18px 14px 28px;
}

.screen-active {
  display: block;
}

.game-flow-screen {
  display: none;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
}

.game-flow-screen.screen-active {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

.home-panel {
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.home-panel h1,
.page-header h1,
.game-top h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.02;
  letter-spacing: 0;
}

.page-header,
.game-top {
  margin-bottom: 16px;
}

.fixed-game-top {
  position: sticky;
  top: 0;
  z-index: 12;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 246, 230, 0.96);
  backdrop-filter: blur(10px);
}

.page-header p,
.panel-title p,
.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.experience-note {
  display: inline-flex;
  width: fit-content;
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(216, 154, 34, 0.42);
  border-radius: 8px;
  color: #4b3016;
  background: #fff3cf;
  font-size: 13px;
  font-weight: 900;
}

.subtitle {
  max-width: 12em;
  font-size: 21px;
  font-weight: 800;
  color: #5a3328;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 900;
}

.day-label {
  display: inline-block;
  margin: 0 0 6px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #2c1d14;
  background: var(--gold-soft);
  font-size: 13px;
  font-weight: 1000;
}

.primary-btn,
.ghost-btn,
.action-btn,
.shop-btn {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.primary-btn:active,
.ghost-btn:active,
.action-btn:active,
.shop-btn:active {
  transform: translateY(1px);
}

.primary-btn {
  color: #fff8eb;
  background: var(--red);
  box-shadow: 0 8px 0 var(--red-dark), var(--shadow);
  font-weight: 900;
}

.big-btn {
  width: min(100%, 360px);
  min-height: 58px;
  padding: 15px 22px;
  font-size: 20px;
}

.full-btn {
  width: 100%;
}

.ghost-btn {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 250, 241, 0.82);
  font-weight: 800;
}

.danger-btn {
  color: var(--red-dark);
}

.identity-list {
  display: grid;
  gap: 14px;
  margin: 18px 0 12px;
}

.identity-card {
  width: 100%;
  display: grid;
  gap: 12px;
  overflow: hidden;
  padding: 0 0 15px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: left;
  transform: translateY(0);
}

.identity-card:hover,
.identity-card:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 14px 30px rgba(61, 37, 20, 0.16);
  transform: translateY(-2px);
}

.identity-card:active,
.identity-card.identity-selected {
  border-color: var(--red);
  background: #fff1df;
  transform: translateY(1px) scale(0.99);
}

.identity-card.map-locked {
  opacity: 0.72;
  filter: grayscale(0.25);
}

.identity-card.map-current {
  border-color: var(--gold);
}

.identity-card.map-completed {
  border-color: var(--green);
}

.identity-card.map-failed {
  box-shadow: 0 0 0 2px rgba(201, 52, 43, 0.14), var(--shadow);
}

.identity-card h2 {
  margin: 0;
  font-size: 22px;
}

.identity-cover {
  position: relative;
  min-height: 188px;
  overflow: hidden;
  background: #2c211c;
}

.identity-cover img {
  width: 100%;
  height: 100%;
  min-height: 188px;
  display: block;
  object-fit: cover;
  transform: scale(1.01);
}

.identity-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(21, 14, 10, 0.06), rgba(21, 14, 10, 0.72));
}

.identity-cover span {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  color: #fffaf1;
  font-size: 17px;
  font-weight: 1000;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.42);
}

.map-status-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 5px 9px;
  border-radius: 999px;
  color: #241914;
  background: var(--gold);
  font-size: 12px;
  font-weight: 1000;
}

.map-status-pill.locked {
  color: #fff8eb;
  background: rgba(36, 25, 20, 0.76);
}

.map-status-pill.completed {
  color: #fff8eb;
  background: var(--green);
}

.map-condition-list {
  display: grid;
  gap: 6px;
  padding: 0 15px;
}

.map-condition-list span {
  color: #50372e;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.map-condition-list span.done {
  color: var(--green);
}

.map-condition-list span.missing {
  color: var(--muted);
}

.identity-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px;
}

.identity-card-head span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: #2c1d14;
  background: var(--gold-soft);
  font-size: 12px;
  font-weight: 1000;
}

.identity-card p {
  margin: 0;
  padding: 0 15px;
  color: var(--muted);
  line-height: 1.5;
}

.identity-tag {
  color: #5a3328;
  font-weight: 900;
}

.identity-scene,
.identity-route {
  display: grid;
  gap: 5px;
  padding: 0 15px;
}

.identity-scene span,
.identity-route span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 1000;
}

.identity-route strong {
  color: #50372e;
  font-size: 14px;
  line-height: 1.35;
}

.identity-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 15px;
}

.identity-stats span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0dfc8;
  color: #50372e;
  font-size: 12px;
  font-weight: 800;
}

.identity-start {
  display: block;
  margin: 0 15px;
  min-height: 42px;
  padding: 11px 12px;
  border-radius: 8px;
  color: #fff8eb;
  background: var(--red);
  box-shadow: 0 5px 0 var(--red-dark);
  font-size: 15px;
  font-weight: 1000;
  text-align: center;
}

.identity-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}

.game-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.game-top h1 {
  font-size: 28px;
}

.progress-box,
.panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.9);
  box-shadow: var(--shadow);
}

.progress-box {
  padding: 14px;
  margin-bottom: 14px;
}

.compact-progress {
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: none;
}

.compact-progress .progress-row {
  margin-bottom: 6px;
  font-size: 13px;
}

.pressure-box {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #e0c085;
  border-radius: 8px;
  background: #fff5df;
  box-shadow: var(--shadow);
}

.pressure-box div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pressure-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.pressure-box strong {
  color: var(--orange);
  font-size: 20px;
}

.pressure-box p {
  margin: 0;
  color: #5f473b;
  line-height: 1.45;
}

.danger-banner {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 2px solid rgba(201, 52, 43, 0.48);
  border-radius: 8px;
  color: #fffaf1;
  background: linear-gradient(135deg, #9f261f, #e87824);
  box-shadow: 0 10px 20px rgba(201, 52, 43, 0.22);
}

.danger-banner[hidden] {
  display: none;
}

.danger-banner strong {
  font-size: 15px;
}

.danger-banner p {
  margin: 0;
  color: #fff6e7;
  font-size: 13px;
  line-height: 1.45;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 900;
}

.progress-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8d5bd;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--gold));
  transition: width 0.25s ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.compact-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 0;
}

.stat-card {
  min-height: 86px;
  padding: 12px;
}

.compact-stats .stat-card {
  min-height: 54px;
  padding: 8px;
  box-shadow: none;
}

.stat-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.compact-stats .stat-card span {
  margin-bottom: 4px;
  font-size: 11px;
}

.stat-card strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(22px, 7vw, 34px);
  line-height: 1.05;
  letter-spacing: 0;
}

.compact-stats .stat-card strong {
  font-size: clamp(15px, 4.3vw, 20px);
}

.hidden-metrics {
  display: none;
}

.game-pages {
  position: relative;
  overflow: hidden;
  padding: 12px 14px 8px;
}

.game-page {
  display: none;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: pageIn 0.18s ease;
}

.game-page.active-page {
  display: block;
}

#page-action {
  scroll-padding-bottom: 110px;
}

#page-action.active-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.money-card strong {
  color: var(--red);
}

.debt-card strong {
  color: var(--green);
}

.income-card strong {
  color: var(--gold-dark);
}

.stamina-card strong,
.mood-card strong {
  color: var(--orange);
}

.network-card strong,
.credit-card strong {
  color: var(--gold-dark);
}

.risk-card strong {
  color: var(--orange);
}

.risk-card.risk-low strong {
  color: var(--green);
}

.risk-card.risk-high strong {
  color: var(--red);
}

.wide-card {
  grid-column: span 2;
  min-height: 72px;
}

.wide-card strong {
  font-size: 22px;
}

.panel {
  padding: 14px;
  margin-bottom: 14px;
}

.game-page .panel {
  min-height: min(100%, 420px);
  margin-bottom: 0;
}

.action-main-panel {
  display: grid;
  gap: 12px;
}

#page-action .action-main-panel {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.role-scene-card {
  position: relative;
  min-height: 160px;
  overflow: hidden;
  border-radius: 8px;
  background: #2b211c;
  box-shadow: var(--shadow);
}

.role-scene-card img {
  width: 100%;
  height: 100%;
  min-height: 160px;
  display: block;
  object-fit: cover;
}

.role-scene-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 12, 9, 0.04), rgba(17, 12, 9, 0.72));
}

.role-scene-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  display: grid;
  gap: 4px;
  color: #fffaf1;
}

.role-scene-overlay span {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(36, 25, 20, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.role-scene-overlay strong {
  font-size: 18px;
  line-height: 1.25;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.52);
}

.panel-title {
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.action-btn:disabled,
.action-btn.action-disabled {
  cursor: not-allowed;
  opacity: 0.48;
  filter: grayscale(0.25);
  box-shadow: none;
}

.post-action-panel {
  display: none;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #e0c085;
  border-radius: 8px;
  background: #fff4d8;
}

.post-action-panel.show {
  display: grid;
  gap: 10px;
}

.post-action-panel p {
  margin: 0;
  color: #5a3328;
  font-weight: 900;
}

.action-btn {
  min-height: 64px;
  padding: 14px 10px;
  color: #fffaf1;
  background: var(--brown);
  box-shadow: 0 6px 0 var(--brown-dark);
  font-size: 17px;
  font-weight: 900;
}

.action-btn:nth-child(1),
.action-btn:nth-child(3) {
  background: var(--red);
  box-shadow: 0 5px 0 var(--red-dark);
}

.action-btn:nth-child(2),
.action-btn[data-action="quickUpgrade"] {
  color: #2c1d14;
  background: var(--gold);
  box-shadow: 0 5px 0 var(--gold-dark);
}

.pay-btn {
  background: var(--green);
  box-shadow: 0 5px 0 var(--green-dark);
}

.rest-btn,
.mindset-btn {
  background: var(--orange);
  box-shadow: 0 5px 0 #a64c18;
}

.day-btn {
  background: #6f3d24;
  box-shadow: 0 5px 0 #412113;
}

.helper-btn {
  background: #5a3328;
  box-shadow: 0 5px 0 #321a13;
}

.day-ready {
  outline: 3px solid var(--gold);
  color: #2c1d14;
  background: var(--gold);
  box-shadow: 0 5px 0 var(--gold-dark);
}

.locked-action {
  color: #4c382b;
  background: #e4d1b8;
  box-shadow: 0 5px 0 #aa9274;
}

.action-btn.locked-action {
  color: #4c382b;
  background: #e4d1b8;
  box-shadow: 0 5px 0 #aa9274;
}

.tutorial-focus {
  position: relative;
  outline: 4px solid #ffcf4a;
  animation: tutorialPulse 1s ease-in-out infinite;
}

@keyframes tutorialPulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(216, 154, 34, 0.58);
  }
  50% {
    transform: translateY(-2px);
    box-shadow: 0 0 0 8px rgba(216, 154, 34, 0.08);
  }
}

.end-day-hint {
  display: none;
  margin: 4px 0 0;
  padding: 10px 12px;
  border: 1px solid #d89a22;
  border-radius: 8px;
  color: #4b3016;
  background: #fff3cf;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.4;
}

.end-day-hint.show {
  display: block;
}

.tap-pulse {
  animation: tapPulse 0.2s ease;
}

@keyframes tapPulse {
  0% {
    transform: scale(1);
  }
  55% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

.today-loop-box,
.current-step-box,
.latest-feedback-box,
.ledger-summary,
.business-recommendation {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #e0c085;
  border-radius: 8px;
  background: #fff5df;
}

.current-step-box {
  border-color: #d89a22;
  background: #fff1c8;
}

.business-recommendation {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 12px;
  border-color: #d89a22;
  background: #fff1c8;
}

.business-recommendation span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 1000;
}

.business-recommendation strong {
  display: block;
  margin-top: 2px;
  color: #2c1d14;
  font-size: 16px;
  line-height: 1.25;
}

.business-recommendation p {
  margin: 4px 0 0;
  color: #5a3328;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.business-recommendation em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.recommendation-btn {
  min-width: 96px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #fffaf1;
  background: var(--brown);
  font-size: 13px;
  font-weight: 1000;
}

.current-step-box span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 1000;
}

.current-step-box h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.current-step-box p {
  margin: 0;
  color: #5a3328;
  line-height: 1.45;
}

.current-step-box strong {
  display: block;
  padding-top: 4px;
  color: #2c1d14;
  font-size: 14px;
  line-height: 1.35;
}

.today-loop-row,
.ledger-summary {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.today-loop-row {
  display: grid;
  gap: 10px;
}

.today-loop-row span,
.latest-feedback-box span,
.ledger-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.today-loop-row strong,
.ledger-summary strong {
  font-size: 15px;
  text-align: right;
}

.action-goal-list {
  margin-top: 2px;
}

.daily-action-meter {
  margin-top: 2px;
}

.daily-action-fill {
  background: linear-gradient(90deg, var(--red), var(--gold));
}

.latest-feedback-box p {
  margin: 0;
  color: #4d3429;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.45;
}

.opportunity-section {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #e0c085;
  border-radius: 8px;
  background: #fff9ed;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading-row div {
  display: grid;
  gap: 2px;
}

.section-heading-row span,
.skill-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.section-heading-row strong,
.skill-strip strong {
  color: #3f2a21;
  font-size: 15px;
}

.section-heading-row small {
  max-width: 16em;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: right;
}

.opportunity-card-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
  overscroll-behavior: contain;
  padding: 0;
  scroll-padding-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}

.opportunity-card-list::-webkit-scrollbar {
  width: 10px;
}

.opportunity-card-list::-webkit-scrollbar-thumb {
  border: 2px solid #fff9ed;
  border-radius: 999px;
  background: #bfa98d;
}

.opportunity-card-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #f2dfc3;
}

.opportunity-empty,
.opportunity-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6e8;
}

.opportunity-empty strong {
  display: block;
  margin-bottom: 4px;
}

.opportunity-empty p,
.opportunity-card p {
  margin: 0;
  color: #5f473b;
  font-size: 13px;
  line-height: 1.45;
}

.opportunity-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 8px;
  border-left-width: 6px;
}

.action-grid.action-dock {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  position: relative;
  z-index: 10;
  gap: 5px;
  padding: 7px 10px 9px;
  margin: 0;
  border-top: 1px solid rgba(224, 192, 133, 0.42);
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.88), var(--paper) 34%);
  box-shadow: 0 -10px 18px rgba(61, 37, 20, 0.06);
}

.action-dock .action-btn {
  min-height: 44px;
  padding: 7px 5px;
  font-size: 13px;
  line-height: 1.12;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--brown-dark);
}

.action-dock .action-btn:nth-child(1),
.action-dock .action-btn:nth-child(3) {
  box-shadow: 0 3px 0 var(--red-dark);
}

.action-dock .action-btn:nth-child(2),
.action-dock .action-btn[data-action="quickUpgrade"] {
  box-shadow: 0 3px 0 var(--gold-dark);
}

.action-dock .pay-btn {
  box-shadow: 0 3px 0 var(--green-dark);
}

.action-dock .rest-btn,
.action-dock .mindset-btn {
  box-shadow: 0 3px 0 #a64c18;
}

.opportunity-card.white {
  border-left-color: #b5aa9f;
}

.opportunity-card.blue {
  border-left-color: #2f74c0;
  background: #eef6ff;
}

.opportunity-card.purple {
  border-left-color: #7a45b6;
  background: #f7efff;
}

.opportunity-card.gold {
  border-color: #d79a1f;
  border-left-color: var(--gold);
  background: #fff3cf;
  animation: goldOrderGlow 1.6s ease-in-out infinite;
}

.opportunity-card.high-risk-order {
  border-right: 2px solid rgba(201, 52, 43, 0.7);
}

.opportunity-card.gold.high-risk-order {
  box-shadow: 0 10px 24px rgba(216, 154, 34, 0.22), 0 0 0 2px rgba(201, 52, 43, 0.18) inset;
}

.opportunity-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.opportunity-title-stack {
  display: grid;
  gap: 5px;
}

.opportunity-card-head span {
  padding: 3px 7px;
  border-radius: 999px;
  color: #fffaf1;
  background: #766558;
  font-size: 11px;
  font-weight: 900;
}

.opportunity-card.blue .opportunity-card-head span {
  background: #2f74c0;
}

.opportunity-card.purple .opportunity-card-head span {
  background: #7a45b6;
}

.opportunity-card.gold .opportunity-card-head span {
  color: #3f2a21;
  background: var(--gold);
}

.opportunity-card-head strong {
  font-size: 16px;
  text-align: right;
}

.recommend-tag {
  padding: 5px 8px;
  border-radius: 999px;
  color: #2c1d14;
  background: var(--gold);
  font-size: 12px;
  font-style: normal;
  font-weight: 1000;
  white-space: nowrap;
}

.opportunity-queue-note {
  padding: 7px 8px;
  border: 1px solid rgba(216, 154, 34, 0.3);
  border-radius: 8px;
  color: #5a3328;
  background: rgba(255, 240, 199, 0.56);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.opportunity-compact-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.opportunity-compact-meta span {
  min-height: 28px;
  padding: 5px 6px;
  border-radius: 6px;
  color: #5a3328;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.requirement-strip {
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 1000;
}

.requirement-strip.met {
  color: #235136;
  background: #e6f2e7;
}

.requirement-strip.unmet {
  color: var(--red-dark);
  background: #ffe8dc;
}

.opportunity-details {
  display: none;
  gap: 8px;
}

.opportunity-details.expanded {
  display: grid;
}

.opportunity-customer {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid rgba(119, 96, 80, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.customer-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fffaf1;
  background: #5a3328;
  font-size: 15px;
  font-weight: 1000;
}

.opportunity-customer strong {
  display: block;
  color: #3f2a21;
  font-size: 13px;
}

.opportunity-customer p {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
}

.opportunity-customer em {
  padding: 4px 6px;
  border-radius: 999px;
  color: #fffaf1;
  background: var(--red);
  font-size: 11px;
  font-style: normal;
  font-weight: 1000;
  white-space: nowrap;
}

.opportunity-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.opportunity-meta span {
  min-height: 24px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #5a3328;
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 900;
}

.opportunity-meta .requirement-pill {
  grid-column: 1 / -1;
}

.opportunity-meta .requirement-pill.met {
  color: #235136;
  background: #e6f2e7;
}

.opportunity-meta .requirement-pill.unmet {
  color: var(--red-dark);
  background: #ffe8dc;
}

.opportunity-warning {
  padding: 8px 9px;
  border-radius: 8px;
  color: #fffaf1;
  background: linear-gradient(135deg, #c9342b, #e87824);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.4;
}

.opportunity-consequence {
  display: grid;
  gap: 5px;
  padding: 8px 9px;
  border: 1px dashed rgba(90, 51, 40, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.opportunity-consequence span {
  color: #5a3328;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.opportunity-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.opportunity-actions .opportunity-btn {
  grid-column: 1 / -1;
}

.opportunity-btn {
  min-height: 38px;
  border-radius: 8px;
  color: #fffaf1;
  background: var(--brown);
  font-weight: 900;
}

.opportunity-btn.locked-action {
  color: #4c382b;
  background: #e4d1b8;
}

.opportunity-btn:disabled {
  opacity: 0.48;
}

.reject-order-btn {
  min-height: 38px;
  border: 1px solid rgba(201, 52, 43, 0.4);
  border-radius: 8px;
  color: var(--red-dark);
  background: #fff6e8;
  font-weight: 900;
}

.detail-toggle-btn {
  min-height: 38px;
  border: 1px solid rgba(63, 42, 33, 0.18);
  border-radius: 8px;
  color: #4c382b;
  background: #fffaf1;
  font-weight: 900;
}

.inline-risk-confirm {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(201, 52, 43, 0.46);
  border-radius: 8px;
  color: #fffaf1;
  background: #8f251f;
}

.inline-risk-confirm strong {
  font-size: 14px;
}

.inline-risk-confirm p {
  margin: 0;
  color: #fff2df;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.inline-risk-confirm div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.confirm-order-btn,
.cancel-confirm-btn {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 1000;
}

.confirm-order-btn {
  color: #2c1d14;
  background: var(--gold);
}

.cancel-confirm-btn {
  color: #fffaf1;
  border: 1px solid rgba(255, 250, 241, 0.34);
  background: rgba(255, 250, 241, 0.16);
}

.opportunity-card-enter {
  animation: cardSlideIn 0.42s ease both;
}

.skill-strip {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #e0c085;
  border-radius: 8px;
  background: #fff5df;
}

.skill-strip > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.skill-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-badge,
.skill-empty {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.skill-badge {
  color: #3f2a21;
  background: var(--gold-soft);
  border: 1px solid #e0c085;
}

.skill-empty {
  color: var(--muted);
  background: #fffaf1;
}

.skill-point-summary {
  width: 100%;
  color: #5a3328;
  font-size: 13px;
  font-weight: 900;
}

.skill-upgrade-btn {
  min-height: 30px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  color: #fff8eb;
  background: var(--red);
  font-size: 12px;
  font-weight: 1000;
}

.skill-upgrade-btn:disabled {
  color: #765f50;
  background: #ead8c0;
}

.feedback-pop {
  animation: feedbackPop 0.24s ease;
}

@keyframes feedbackPop {
  0% {
    transform: translateY(3px);
    opacity: 0.6;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes cardSlideIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    box-shadow: 0 0 0 rgba(216, 154, 34, 0);
  }
  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
    box-shadow: 0 0 22px rgba(216, 154, 34, 0.22);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: none;
  }
}

@keyframes goldOrderGlow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(216, 154, 34, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(216, 154, 34, 0.34);
  }
}

.mission-panel {
  border-color: #d7b46f;
}

.mission-list {
  display: grid;
  gap: 8px;
}

.target-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.target-block:first-of-type {
  margin-top: 0;
}

.target-block h3 {
  margin: 0;
  color: #5a3328;
  font-size: 15px;
}

.mission-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6e8;
}

.mission-check {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #fffaf1;
  background: #9a8675;
  font-size: 13px;
  font-weight: 1000;
}

.mission-item.done .mission-check {
  color: #2c1d14;
  background: var(--gold);
}

.mission-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.mission-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.helper-status {
  margin-top: 7px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f4e8d4;
  color: #5a3328;
  font-size: 12px;
  font-weight: 800;
}

.helper-status.good {
  color: var(--red-dark);
  background: #fff0df;
}

.helper-status.bad {
  color: #325640;
  background: #edf2ec;
}

.tab-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  min-height: 44px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff6e8;
  font-weight: 900;
}

.tab-btn.tab-active {
  color: #fffaf1;
  border-color: var(--brown);
  background: var(--brown);
}

.tab-panel {
  display: none;
}

.tab-panel-active {
  display: block;
}

.shop-list {
  display: grid;
  gap: 10px;
}

.shop-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6e8;
}

.shop-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.shop-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.shop-meta {
  margin-top: 6px;
  color: #65483a;
  font-size: 12px;
  font-weight: 800;
}

.shop-btn {
  min-width: 94px;
  min-height: 44px;
  padding: 9px 10px;
  color: #2c1d14;
  background: var(--gold);
  font-size: 14px;
  font-weight: 900;
}

.shop-btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  background: #877363;
}

.shop-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.shop-pager span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.shop-pager .ghost-btn:disabled {
  opacity: 0.42;
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.latest-event-card {
  margin-bottom: 12px;
}

.latest-event-card .event-item {
  padding: 16px;
  border-left-width: 7px;
}

.latest-event-card .event-item strong {
  font-size: 22px;
  line-height: 1.2;
}

.latest-event-card .event-item p {
  font-size: 15px;
}

.ledger-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.event-panel {
  border-color: #e0b15e;
  background: #fff4d8;
}

.debt-ledger {
  display: grid;
  gap: 10px;
}

.debt-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6e8;
}

.debt-item.warning {
  border-color: #e0b15e;
  background: #fff1d7;
}

.debt-item.urgent {
  border-color: rgba(201, 52, 43, 0.62);
  background: #fff0df;
}

.debt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 900;
}

.debt-row span {
  color: var(--muted);
  font-size: 13px;
}

.debt-mini-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ead8c0;
}

.debt-mini-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.debt-pressure-note {
  margin: 7px 0 0;
  color: #6b4c3e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.debt-item.urgent .debt-pressure-note {
  color: var(--red-dark);
}

.event-item {
  padding: 10px;
  border-left: 5px solid var(--line);
  border-radius: 8px;
  background: #fff6e8;
}

.event-item.good {
  border-left-color: var(--red);
  background: #fff0df;
}

.event-item.bad {
  border-left-color: var(--green);
  background: #edf2ec;
}

.event-item.neutral {
  border-left-color: var(--orange);
  background: #fff0d8;
}

.event-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.event-item p {
  margin: 0;
  color: #5f473b;
  font-size: 13px;
  line-height: 1.45;
}

.bottom-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 12px;
}

.flow-nav {
  position: sticky;
  bottom: 0;
  z-index: 14;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 246, 230, 0.96);
  backdrop-filter: blur(10px);
}

.flow-nav .ghost-btn {
  min-height: 44px;
  padding: 7px 4px;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

.flow-nav .ghost-btn.tab-active {
  color: #fffaf1;
  border-color: var(--brown);
  background: var(--brown);
}

.flow-nav .day-ready {
  border-color: var(--gold-dark);
}

.utility-actions {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 10px 10px;
  background: rgba(255, 246, 230, 0.96);
}

.utility-actions .ghost-btn {
  min-height: 34px;
  padding: 6px;
  font-size: 12px;
}

.toast-list {
  position: fixed;
  left: 50%;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  width: min(calc(100% - 28px), 420px);
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}

.float-list {
  position: fixed;
  top: 118px;
  right: max(14px, calc((100vw - 720px) / 2 + 14px));
  z-index: 22;
  display: grid;
  gap: 6px;
  pointer-events: none;
}

.float-list .float-number:nth-last-child(n + 4) {
  display: none;
}

.float-number {
  padding: 7px 10px;
  border-radius: 999px;
  color: #fffaf1;
  box-shadow: var(--shadow);
  font-size: 18px;
  font-weight: 1000;
  animation: floatUp 1.1s ease forwards;
}

.float-number.up {
  color: #fff8eb;
  background: linear-gradient(135deg, var(--red), var(--gold));
}

.float-number.down {
  background: var(--green);
}

.float-number.debt {
  background: var(--green);
  animation-name: floatDown;
}

.float-number.reward {
  color: #2c1d14;
  background: var(--gold);
}

.float-number.risk-up {
  background: var(--red);
}

.float-number.risk-down {
  background: var(--green);
}

.stat-bounce {
  animation: statBounce 0.36s ease;
}

.debt-drop {
  animation: debtDrop 0.42s ease;
}

body.breakthrough-fx #app {
  animation: breakthroughShake 0.42s ease;
}

body.breakthrough-fx::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 29;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255, 213, 88, 0.34), transparent 55%);
  animation: breakthroughLight 0.86s ease forwards;
}

@keyframes statBounce {
  0%,
  100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
    color: var(--red);
  }
}

@keyframes debtDrop {
  0%,
  100% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(4px);
    color: var(--green);
  }
}

@keyframes breakthroughShake {
  0%,
  100% {
    transform: translateX(0);
  }
  18% {
    transform: translateX(-4px);
  }
  36% {
    transform: translateX(4px);
  }
  54% {
    transform: translateX(-3px);
  }
  72% {
    transform: translateX(3px);
  }
}

@keyframes breakthroughLight {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  18% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-34px) scale(1.02);
  }
}

@keyframes floatDown {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
  18% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(32px) scale(1.02);
  }
}

.toast {
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: #fffaf1;
  background: rgba(36, 25, 20, 0.88);
  box-shadow: 0 8px 18px rgba(36, 25, 20, 0.18);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  animation: toastIn 1.5s ease forwards;
}

.toast-out {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  12%,
  82% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

.role-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(36, 25, 20, 0.58);
}

.role-detail-modal.show {
  display: flex;
}

.role-detail-card {
  position: relative;
  width: min(100%, 430px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(36, 25, 20, 0.36);
}

.role-detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  color: #fffaf1;
  background: rgba(36, 25, 20, 0.66);
  font-size: 24px;
  line-height: 1;
}

.role-detail-card img {
  width: 100%;
  height: 240px;
  display: block;
  object-fit: cover;
}

.role-detail-content {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.role-detail-content > span {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  color: #2c1d14;
  background: var(--gold-soft);
  font-size: 12px;
  font-weight: 1000;
}

.role-detail-content h2 {
  margin: 0;
  font-size: 26px;
}

.role-detail-content > p {
  margin: 0;
  color: #4d3429;
  font-size: 17px;
  font-weight: 1000;
  line-height: 1.35;
}

.role-detail-block {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6e8;
}

.role-detail-block strong {
  color: var(--red-dark);
  font-size: 13px;
}

.role-detail-block p {
  margin: 0;
  color: #5f473b;
  font-size: 14px;
  line-height: 1.55;
}

.collapse-screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  color: #fffaf1;
  background: #1f1512;
}

.collapse-layout {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: minmax(300px, 43vh) 1fr;
}

.collapse-hero {
  position: relative;
  overflow: hidden;
}

.collapse-hero img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.collapse-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 11, 9, 0.12), rgba(18, 11, 9, 0.92));
}

.collapse-hero-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.collapse-hero-overlay span {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #2c1d14;
  background: var(--gold);
  font-size: 13px;
  font-weight: 1000;
}

.collapse-hero-overlay h1 {
  margin: 0;
  font-size: clamp(34px, 10vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.collapse-hero-overlay p {
  max-width: 28em;
  margin: 0;
  color: #fff3dc;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.5;
}

.collapse-panel {
  display: grid;
  gap: 14px;
  padding: 18px 14px 26px;
  background: linear-gradient(180deg, #251712 0%, #3f2a21 100%);
}

.collapse-exp {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(244, 185, 66, 0.4);
  border-radius: 8px;
  color: #fff3dc;
  background: rgba(255, 246, 230, 0.08);
  font-weight: 900;
  line-height: 1.45;
}

.collapse-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.collapse-stat {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.08);
}

.collapse-stat span {
  color: #d9c5ad;
  font-size: 12px;
  font-weight: 900;
}

.collapse-stat strong {
  color: #fffaf1;
  font-size: 17px;
}

.collapse-advice {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  color: #2c1d14;
  background: #fff3cf;
}

.collapse-advice p {
  margin: 0;
  color: #4d3429;
  line-height: 1.55;
}

.collapse-actions {
  display: grid;
  gap: 10px;
}

.collapse-screen .ghost-btn {
  color: #fffaf1;
  border-color: rgba(255, 250, 241, 0.24);
  background: rgba(255, 250, 241, 0.1);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(36, 25, 20, 0.48);
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(100%, 420px);
  padding: 22px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(36, 25, 20, 0.32);
}

.modal.story-modal .modal-card,
.modal.pressure-modal .modal-card,
.modal.settlement-modal .modal-card {
  position: relative;
  overflow: hidden;
  color: #fffaf1;
  background:
    linear-gradient(180deg, rgba(24, 16, 12, 0.3), rgba(24, 16, 12, 0.88)),
    var(--modal-role-image);
  background-position: center;
  background-size: cover;
}

.modal.story-modal .modal-card::before,
.modal.pressure-modal .modal-card::before,
.modal.settlement-modal .modal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 213, 88, 0.1), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.modal.story-modal .modal-card > *,
.modal.pressure-modal .modal-card > *,
.modal.settlement-modal .modal-card > * {
  position: relative;
  z-index: 1;
}

.modal.story-modal .modal-card h2,
.modal.pressure-modal .modal-card h2,
.modal.settlement-modal .modal-card h2,
.modal.story-modal .modal-card p,
.modal.pressure-modal .modal-card p,
.modal.settlement-modal .modal-card p {
  color: #fffaf1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.38);
}

.modal.settlement-modal .choice-btn,
.modal.pressure-modal .choice-btn {
  background: rgba(255, 250, 241, 0.92);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 25px;
}

.modal-card p {
  margin: 0 0 18px;
  color: #553b31;
  line-height: 1.7;
  white-space: pre-line;
}

.modal-choice-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.choice-btn {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff6e8;
  font-weight: 900;
  text-align: left;
}

.choice-btn:active {
  transform: translateY(1px);
}

@media (max-width: 560px) {
  .screen {
    padding: 14px 12px 22px;
  }

  .game-flow-screen {
    height: 100vh;
    height: 100dvh;
    padding: 0;
  }

  .home-panel {
    min-height: calc(100dvh - 28px);
  }

  .page-header {
    margin-bottom: 12px;
  }

  .page-header h1 {
    font-size: 30px;
  }

  .page-header p {
    font-size: 14px;
  }

  .identity-list {
    grid-template-columns: 1fr;
    gap: 11px;
    margin: 14px 0 10px;
  }

  .identity-card {
    gap: 9px;
    padding: 14px;
  }

  .identity-card h2 {
    font-size: 21px;
  }

  .identity-card p,
  .identity-route strong {
    font-size: 13px;
    line-height: 1.42;
  }

  .identity-stats {
    gap: 5px;
  }

  .identity-stats span {
    padding: 4px 7px;
    font-size: 11px;
  }

  .identity-start {
    min-height: 44px;
    padding: 12px;
  }

  .identity-cover {
    min-height: 176px;
  }

  .identity-cover img {
    min-height: 176px;
  }

  .identity-cover span {
    font-size: 16px;
  }

  .fixed-game-top {
    padding: 5px 9px 6px;
  }

  .game-top {
    align-items: center;
    margin-bottom: 6px;
  }

  .game-top h1 {
    display: none;
  }

  .day-label {
    margin-bottom: 3px;
    padding: 3px 8px;
    font-size: 12px;
  }

  .fixed-game-top .eyebrow {
    margin-bottom: 0;
    font-size: 12px;
  }

  #restart-btn-top {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .compact-progress {
    display: none;
  }

  .compact-progress .progress-row {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .progress-track {
    height: 10px;
  }

  .compact-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .compact-stats .stat-card {
    min-height: 34px;
    padding: 4px 5px;
  }

  .compact-stats .stat-card span {
    margin-bottom: 2px;
    font-size: 9px;
    text-align: center;
  }

  .compact-stats .stat-card strong {
    font-size: 12px;
    line-height: 1.05;
    text-align: center;
  }

  .game-pages {
    padding: 8px 10px 10px;
  }

  .game-page {
    padding-bottom: 6px;
  }

  .panel {
    padding: 11px;
  }

  .game-page .panel {
    min-height: auto;
  }

  .action-main-panel {
    gap: 9px;
  }

  .role-scene-card,
  .role-scene-card img {
    min-height: 138px;
  }

  .role-scene-overlay strong {
    font-size: 16px;
  }

  .panel-title {
    margin-bottom: 6px;
  }

  .panel-title h2 {
    font-size: 18px;
  }

  .panel-title p {
    font-size: 13px;
    line-height: 1.42;
  }

  .pressure-box {
    gap: 5px;
    padding: 9px 10px;
    margin-bottom: 0;
  }

  .pressure-box strong {
    font-size: 16px;
  }

  .pressure-box p {
    font-size: 13px;
    line-height: 1.35;
  }

  .today-loop-box,
  .latest-feedback-box,
  .ledger-summary {
    gap: 7px;
    padding: 9px;
  }

  .opportunity-section {
    gap: 7px;
    padding: 9px;
  }

  .opportunity-card-list {
    max-height: none;
    padding: 0;
  }

  .section-heading-row {
    align-items: flex-start;
  }

  .section-heading-row small {
    max-width: 13em;
    font-size: 11px;
  }

  .opportunity-card {
    gap: 7px;
    padding: 9px;
  }

  .opportunity-card-head strong {
    font-size: 15px;
  }

  .opportunity-compact-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .opportunity-compact-meta span {
    min-height: 25px;
    padding: 4px 5px;
    font-size: 11px;
  }

  .opportunity-meta {
    gap: 4px;
  }

  .opportunity-meta span {
    min-height: 22px;
    padding: 4px 5px;
    font-size: 11px;
  }

  .opportunity-btn {
    min-height: 36px;
    font-size: 13px;
  }

  .skill-strip {
    margin-bottom: 9px;
    padding: 9px;
  }

  .today-loop-row {
    gap: 6px;
  }

  .today-loop-row strong,
  .ledger-summary strong {
    font-size: 13px;
  }

  .daily-action-meter .progress-row {
    margin-bottom: 5px;
    font-size: 13px;
  }

  .action-grid {
    gap: 8px;
  }

  .action-dock {
    padding: 6px 9px 8px;
  }

  .action-grid.action-dock {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .action-dock .action-btn {
    min-height: 44px;
    padding: 6px 4px;
    font-size: 12px;
    box-shadow: 0 3px 0 var(--brown-dark);
  }

  .action-btn {
    min-height: 54px;
    padding: 10px 8px;
    font-size: 15px;
    box-shadow: 0 4px 0 var(--brown-dark);
  }

  .action-btn:nth-child(1),
  .action-btn:nth-child(3) {
    box-shadow: 0 4px 0 var(--red-dark);
  }

  .action-dock .action-btn:nth-child(1),
  .action-dock .action-btn:nth-child(3) {
    box-shadow: 0 3px 0 var(--red-dark);
  }

  .action-btn:nth-child(2),
  .action-btn[data-action="quickUpgrade"] {
    box-shadow: 0 4px 0 var(--gold-dark);
  }

  .action-dock .action-btn:nth-child(2),
  .action-dock .action-btn[data-action="quickUpgrade"] {
    box-shadow: 0 3px 0 var(--gold-dark);
  }

  .pay-btn {
    box-shadow: 0 4px 0 var(--green-dark);
  }

  .action-dock .pay-btn {
    box-shadow: 0 3px 0 var(--green-dark);
  }

  .rest-btn,
  .mindset-btn {
    box-shadow: 0 4px 0 #a64c18;
  }

  .action-dock .rest-btn,
  .action-dock .mindset-btn {
    box-shadow: 0 3px 0 #a64c18;
  }

  .latest-feedback-box p {
    font-size: 14px;
    line-height: 1.35;
  }

  .flow-nav {
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    gap: 4px;
  }

  .flow-nav .ghost-btn {
    min-height: 46px;
    padding: 6px 2px;
    font-size: 11px;
  }

  .toast-list {
    bottom: calc(66px + env(safe-area-inset-bottom));
    width: min(calc(100% - 20px), 420px);
  }

  .toast {
    font-size: 13px;
  }

  .role-detail-modal {
    padding: 10px;
  }

  .role-detail-card img {
    height: 220px;
  }

  .role-detail-content {
    gap: 10px;
    padding: 14px;
  }

  .role-detail-content h2 {
    font-size: 23px;
  }

  .role-detail-content > p {
    font-size: 16px;
  }

  .float-list {
    top: 96px;
    right: 10px;
  }

  .float-number {
    padding: 6px 9px;
    font-size: 15px;
  }

  .modal {
    padding: 12px;
    align-items: center;
  }

  .modal-card {
    width: min(100%, 390px);
    max-height: calc(100dvh - 42px);
    overflow: auto;
    padding: 18px;
  }

  .modal-card h2 {
    font-size: 22px;
  }

  .modal-card p {
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.58;
  }

  .choice-btn,
  #modal-close-btn {
    min-height: 48px;
  }
}

@media (min-width: 680px) {
  .screen {
    padding: 28px 18px 36px;
  }

  .identity-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .compact-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .wide-card {
    grid-column: span 2;
  }

  .action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-grid.action-dock {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    padding: 7px 10px 9px;
  }

  .action-dock .action-btn {
    min-height: 44px;
    padding: 7px 4px;
    font-size: 12px;
  }

  .flow-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1040px) {
  #app {
    max-width: 1080px;
  }

  .identity-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-flow-screen {
    max-width: 720px;
    margin: 0 auto;
  }
}

@media (max-width: 360px) {
  .bottom-actions {
    grid-template-columns: 1fr;
  }

  .shop-item {
    grid-template-columns: 1fr;
  }

  .shop-btn {
    width: 100%;
  }
}
