:root {
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #241f1b;
  background: #f8f3eb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(248, 243, 235, 0.4)),
    #f8f3eb;
}

.age-gate[hidden] {
  display: none;
}

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(36, 31, 27, 0.72);
}

.age-gate-panel {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid #e2d6c5;
  border-radius: 8px;
  background: #fffaf3;
  box-shadow: 0 20px 60px rgba(36, 31, 27, 0.28);
}

.age-gate-panel h2 {
  margin: 14px 0 10px;
  font-size: 24px;
}

.age-gate-panel p {
  color: #5f554e;
  line-height: 1.7;
}

.age-gate-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

button,
textarea {
  font: inherit;
}

select,
input {
  font: inherit;
}

select,
input {
  min-height: 38px;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  padding: 0 10px;
  color: #241f1b;
  background: #fff;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
textarea:disabled {
  cursor: progress;
  opacity: 0.62;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.top-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid #e2d6c5;
  background: rgba(255, 252, 247, 0.88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 3;
}

.brand-lockup,
.wallet,
.section-title,
.play-header,
.status-pill,
.choice-button,
.send-button,
.primary-button,
.icon-text-button {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #8d2f2f;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand-lockup p,
.play-header span,
.scenario-button span,
.message span,
.plan-button span,
.notice {
  color: #76675c;
}

.wallet {
  gap: 10px;
  min-height: 42px;
  padding: 6px 8px 6px 12px;
  border: 1px solid #dfd2c0;
  background: #fffaf3;
  border-radius: 8px;
  white-space: nowrap;
}

.coin-icon,
.mini-icon,
.empty-icon {
  display: inline-block;
  border-radius: 999px;
  background: #b58122;
}

.coin-icon {
  width: 15px;
  height: 15px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45);
}

.mini-icon {
  width: 12px;
  height: 12px;
  background: #2f6f68;
}

.empty-icon {
  width: 48px;
  height: 48px;
  background: conic-gradient(from 45deg, #b58122, #8d2f2f, #2f6f68, #b58122);
}

.icon-text-button,
.primary-button,
.choice-button,
.send-button {
  gap: 8px;
  border-radius: 8px;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.icon-text-button {
  min-height: 32px;
  padding: 0 10px;
  color: #fff;
  background: #2f6f68;
}

.icon-text-button.secondary {
  color: #2f6f68;
  border: 1px solid #aacbc5;
  background: #edf7f4;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(420px, 1fr) minmax(260px, 320px);
  gap: 18px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px 24px 24px;
}

.setup-panel,
.play-panel,
.ops-panel {
  min-width: 0;
}

.poster {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  background: #efe1d0;
}

.section-title {
  gap: 8px;
  margin: 16px 0 10px;
  font-weight: 800;
}

.scenario-list,
.role-grid,
.stats-list,
.plans {
  display: grid;
  gap: 8px;
}

.scenario-button,
.role,
.plan-button {
  text-align: left;
  border: 1px solid #ded1be;
  background: #fffaf3;
  border-radius: 8px;
}

.scenario-button {
  display: grid;
  gap: 5px;
  min-height: 74px;
  padding: 12px;
}

.scenario-button strong,
.plan-button strong {
  color: #241f1b;
}

.scenario-button.selected,
.role.selected {
  border-color: #8d2f2f;
  background: #fff3ec;
  box-shadow: 0 0 0 3px rgba(141, 47, 47, 0.1);
}

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

.role {
  min-height: 40px;
  padding: 8px 10px;
  color: #392d25;
}

.primary-button {
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  color: #fff;
  background: #8d2f2f;
  font-weight: 800;
}

.play-panel {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  min-height: calc(100vh - 124px);
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  background: #fffaf3;
  overflow: hidden;
}

.play-header {
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid #e4d8c9;
}

.play-header h2 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.2;
}

.status-pill {
  min-height: 32px;
  padding: 0 10px;
  color: #1f5c55;
  border: 1px solid #aacbc5;
  border-radius: 999px;
  background: #edf7f4;
  white-space: nowrap;
}

.transcript {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow: auto;
  background:
    linear-gradient(rgba(255, 250, 243, 0.92), rgba(255, 250, 243, 0.92)),
    url("/assets/stage.svg") center / cover;
}

.message {
  width: min(720px, 92%);
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.72;
  white-space: pre-wrap;
  box-shadow: 0 10px 30px rgba(61, 42, 24, 0.08);
}

.message.narrator {
  justify-self: start;
  background: #ffffff;
  border: 1px solid #eadfce;
}

.message.player {
  justify-self: end;
  color: #fff;
  background: #2f6f68;
}

.message.player span {
  color: rgba(255, 255, 255, 0.82);
}

.message span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 360px;
  padding: 24px;
  color: #6b5c50;
  text-align: center;
}

.input-zone {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #e4d8c9;
  background: #fffaf3;
}

textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  padding: 12px;
  color: #241f1b;
  background: #fff;
  outline: none;
}

textarea:focus {
  border-color: #2f6f68;
  box-shadow: 0 0 0 3px rgba(47, 111, 104, 0.12);
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 74px;
  gap: 8px;
}

.choice-button {
  justify-content: flex-start;
  min-height: 44px;
  padding: 8px 10px;
  color: #332820;
  border: 1px solid #d8c7b4;
  background: #f7eadb;
  text-align: left;
}

.send-button {
  justify-content: center;
  min-width: 74px;
  min-height: 44px;
  color: #fff;
  background: #8d2f2f;
}

.stat-row {
  display: grid;
  grid-template-columns: 44px 1fr 38px;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 14px;
}

.stat-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7d9c8;
}

.stat-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
}

.notice {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid #e6c9b7;
  border-radius: 8px;
  background: #fff4ec;
  line-height: 1.55;
}

.payment-info {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  background: #fffaf3;
  line-height: 1.5;
}

.payment-info a {
  color: #2f6f68;
  font-weight: 800;
  text-decoration: none;
}

.payment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.payment-claim {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.payment-lead {
  display: grid;
  grid-template-columns: minmax(112px, 0.8fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.payment-lead .small-button {
  grid-column: 1 / -1;
  justify-content: center;
}

.payment-claim textarea {
  min-height: 72px;
}

.order-lookup {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e4d8c9;
}

.order-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.recent-orders {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recent-order,
.recent-order-empty {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.recent-order {
  color: #2f6f68;
  border: 1px solid #aacbc5;
  background: #edf8f5;
}

.recent-order-empty {
  color: #76675c;
  background: #f7eadb;
}

.paywall {
  display: none;
}

.paywall.open {
  display: block;
}

.feedback-box {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.feedback-box textarea {
  min-height: 82px;
}

.feedback-submit {
  justify-content: center;
  width: 100%;
}

.plan-button {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.plan-badge {
  width: fit-content;
  padding: 3px 7px;
  color: #fff !important;
  background: #b58122;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.plan-button b {
  color: #8d2f2f;
}

.plan-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  background: #f4eee6;
}

.icon-text-button:hover,
.primary-button:hover,
.choice-button:hover,
.send-button:hover,
.scenario-button:hover,
.role:hover,
.plan-button:hover {
  transform: translateY(-1px);
}

.plan-button:disabled:hover {
  transform: none;
}

.redeem-box {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e4d8c9;
}

.admin-shell {
  min-height: 100vh;
}

.admin-top {
  position: static;
}

.admin-link {
  color: #2f6f68;
  font-weight: 800;
  text-decoration: none;
}

.admin-grid {
  display: grid;
  gap: 16px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.admin-card {
  padding: 16px;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  background: #fffaf3;
}

.admin-card h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.admin-token-row,
.orders-header {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.orders-header > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-token-row input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  background: #fff;
}

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

.settings-form label {
  display: grid;
  gap: 6px;
  color: #76675c;
  font-size: 13px;
  font-weight: 700;
}

.settings-form input,
.settings-form select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  background: #fff;
  color: #392d25;
}

.settings-form .checkbox-line {
  align-items: center;
  display: flex;
  min-height: 40px;
}

.settings-form .checkbox-line input {
  height: 18px;
  min-height: 18px;
  width: 18px;
}

.settings-form input[readonly] {
  background: #fbf6ef;
  color: #2f6f68;
  font-weight: 700;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0;
}

.admin-token-row button,
.small-button,
.confirm-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff;
  background: #2f6f68;
}

.small-button {
  color: #392d25;
  border: 1px solid #d8c7b4;
  background: #f7eadb;
}

.small-button.selected {
  color: #fff;
  background: #8d2f2f;
}

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

.metric-item {
  display: grid;
  gap: 7px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid #e4d8c9;
  border-radius: 8px;
  background: #fff;
}

.metric-item span,
.order-row span,
.order-row em,
.admin-empty {
  color: #76675c;
}

.metric-item strong {
  font-size: 24px;
}

.orders-list,
.campaign-list {
  display: grid;
  gap: 10px;
}

.readiness-list,
.launch-status {
  display: grid;
  gap: 8px;
}

.readiness-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #e4d8c9;
  border-radius: 8px;
  background: #fff;
}

.readiness-item.ok {
  border-color: #aacbc5;
  background: #f0faf7;
}

.readiness-item.warning {
  border-color: #dcc08a;
  background: #fff8e8;
}

.readiness-item.error {
  border-color: #dfa7a7;
  background: #fff0f0;
}

.readiness-item span {
  color: #76675c;
}

.order-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e4d8c9;
  border-radius: 8px;
  background: #fff;
}

.campaign-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1.6fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #e4d8c9;
  border-radius: 8px;
  background: #fff;
}

.campaign-row > div,
.campaign-stats {
  display: grid;
  gap: 6px;
}

.campaign-row span {
  color: #76675c;
}

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

.campaign-stats span {
  display: grid;
  gap: 3px;
  min-height: 46px;
  padding: 8px;
  border: 1px solid #eee1d2;
  border-radius: 8px;
  background: #fffaf3;
}

.campaign-stats b {
  color: #2f6f68;
}

.order-row.expired {
  border-color: #d8c7b4;
  background: #fbf6ef;
}

.order-row.contacted {
  border-color: #b8c8de;
  background: #f3f7fc;
}

.order-row.lead-high {
  border-color: #d7a262;
  background: #fff8ed;
}

.order-row.lead-medium {
  border-color: #c8b88a;
  background: #fffdf3;
}

.order-row > div,
.order-side {
  display: grid;
  gap: 6px;
}

.order-side {
  min-width: 128px;
  align-content: start;
  align-items: start;
  justify-items: end;
  text-align: right;
}

.order-side .small-button,
.order-side .confirm-button {
  min-width: 84px;
}

.order-side b {
  color: #8d2f2f;
}

.confirm-button {
  background: #8d2f2f;
}

.site-footer {
  display: grid;
  gap: 8px;
  padding: 18px 24px 24px;
  border-top: 1px solid #e2d6c5;
  background: #fffaf3;
  color: #76675c;
  font-size: 13px;
}

.site-footer > div,
.site-footer nav,
.record-links,
.legal-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.site-footer a,
.legal-footer a {
  color: #2f6f68;
  font-weight: 800;
  text-decoration: none;
}

.legal-shell {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 28px 18px 40px;
  line-height: 1.75;
}

.legal-shell h1 {
  margin: 18px 0 6px;
  font-size: 28px;
}

.legal-shell section {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #d8c7b4;
  border-radius: 8px;
  background: #fffaf3;
}

.legal-shell h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.legal-footer {
  margin-top: 22px;
  color: #76675c;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 260px 1fr;
  }

  .ops-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 760px) {
  .top-band {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .wallet {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    justify-content: initial;
  }

  .wallet #creditText {
    text-align: center;
  }

  .wallet .icon-text-button {
    grid-column: 1 / -1;
    justify-content: center;
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .play-panel {
    min-height: 70vh;
    grid-template-rows: auto minmax(360px, 1fr) auto;
  }

  .play-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .choice-row,
  .payment-lead,
  .paywall.open .plans {
    grid-template-columns: 1fr;
  }

  .send-button {
    width: 100%;
  }

  .site-footer {
    padding: 16px 14px 22px;
  }

  .admin-token-row,
  .orders-header,
  .settings-form,
  .campaign-row,
  .order-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

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

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

  .order-side {
    text-align: left;
  }
}
