:root {
  --ink: #17231e;
  --muted: #64736d;
  --line: #0b3d2b;
  --surface: #f8fbf5;
  --paper: #fffdf0;
  --mint: #bdf7d6;
  --yellow: #ffe456;
  --blue: #47c7ff;
  --pink: #ff72a6;
  --danger: #e84f75;
  --shadow: rgba(8, 40, 28, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef4ef;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

.lab-shell {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.lab-sidebar {
  min-width: 0;
  min-height: 100vh;
  padding: 24px;
  background: #111b17;
  color: #f6fff9;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  border: 3px solid #f6fff9;
  color: var(--line);
  font-weight: 900;
  box-shadow: 5px 5px 0 #f6fff9;
}

.brand-title {
  font-size: 18px;
  font-weight: 850;
}

.brand-subtitle {
  margin-top: 3px;
  color: rgba(246, 255, 249, 0.68);
  font-size: 13px;
}

.control-label {
  display: block;
  margin: 18px 0 8px;
  color: rgba(246, 255, 249, 0.74);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

select,
.lab-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(246, 255, 249, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #f6fff9;
  padding: 0 12px;
}

select option {
  color: #111b17;
}

.side-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.lab-button {
  cursor: pointer;
  font-weight: 800;
}

.lab-button-secondary {
  background: rgba(255, 228, 86, 0.14);
}

.state-panel,
.inspector {
  margin-top: 22px;
}

.panel-title {
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
  color: inherit;
}

pre {
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 360px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(246, 255, 249, 0.82);
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(90deg, rgba(11, 61, 43, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(11, 61, 43, 0.06) 1px, transparent 1px),
    #e8f6df;
  background-size: 24px 24px;
}

.workspace-head {
  min-width: 0;
  min-height: 118px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 34px 20px;
  border-bottom: 3px solid var(--line);
  background: var(--paper);
}

.workspace-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.workspace-head p {
  max-width: 660px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--mint);
  color: var(--line);
  font-size: 12px;
  font-weight: 900;
}

.status-pill-muted {
  background: #ffffff;
}

.preview-layout {
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  padding: 26px;
  width: 100%;
  max-width: 100%;
}

.device-stage {
  min-width: 0;
  max-width: 100%;
  display: grid;
  place-items: start center;
  overflow: auto;
}

.phone-frame {
  width: min(var(--phone-width, 390px), 100%);
  max-width: 100%;
  height: 760px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0b1712;
  border: 10px solid #0b1712;
  border-radius: 34px;
  box-shadow: 0 26px 80px var(--shadow);
}

.phone-320 {
  --phone-width: 320px;
}

.phone-390 {
  --phone-width: 390px;
}

.phone-430 {
  --phone-width: 430px;
}

.phone-status {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: #effcf5;
  font-size: 12px;
  font-weight: 800;
}

.miniapp-root {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: #e9f8d8;
  background-image:
    linear-gradient(90deg, rgba(6, 61, 42, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(6, 61, 42, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}

.mini-screen {
  min-height: 100%;
  padding: 18px 16px 86px;
}

.mini-top {
  margin-bottom: 14px;
  padding: 18px;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 7px 0 var(--line);
}

.mini-kicker {
  font-size: 11px;
  font-weight: 900;
  color: #0e8a5a;
}

.mini-title {
  margin: 4px 0 0;
  color: var(--line);
  font-size: 26px;
  line-height: 1.05;
}

.mini-desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
}

.mini-section {
  margin-top: 14px;
  padding: 16px;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--line);
}

.mini-section h2 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.2;
}

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

.stat-tile {
  padding: 12px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--mint);
}

.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 950;
}

.stat-label {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.mini-item {
  padding: 12px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.mini-item-title {
  font-weight: 900;
}

.mini-item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.mini-input {
  min-height: 44px;
  width: 100%;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--mint);
  color: var(--line);
  padding: 0 12px;
  font-weight: 900;
}

.mini-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-button {
  min-height: 42px;
  flex: 1 1 120px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--yellow);
  color: var(--line);
  box-shadow: 0 5px 0 var(--line);
  font-weight: 950;
  cursor: pointer;
}

.mini-button.compact {
  flex: 0 0 auto;
  width: auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.mini-button.blue {
  background: var(--blue);
}

.mini-button.pink {
  background: var(--pink);
}

.mini-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--line);
}

.empty-block,
.error-block {
  text-align: center;
  padding: 24px 14px;
}

.error-block {
  background: var(--yellow);
}

.tabbar {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px;
  background: var(--paper);
  border-top: 3px solid var(--line);
}

.tabbar button {
  min-height: 42px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--line);
  font-size: 12px;
  font-weight: 950;
}

.tabbar button.active {
  background: var(--yellow);
}

.inspector {
  min-width: 0;
  margin-top: 0;
  padding: 18px;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 7px 0 var(--line);
  overflow: hidden;
}

.action-log {
  max-height: 620px;
  overflow: auto;
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.action-log strong {
  color: var(--line);
}

.mahjong-quest-panel {
  display: grid;
  gap: 14px;
}

.mahjong-table-art {
  position: relative;
  height: 168px;
  border: 4px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    #0e8a5a;
  background-size: 16px 16px;
  box-shadow: inset 0 0 0 8px #0b6a46;
}

.mahjong-table-art .seat,
.mahjong-table-art .tile {
  position: absolute;
  display: grid;
  place-items: center;
  border: 3px solid var(--line);
  font-weight: 950;
}

.mahjong-table-art .seat {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--yellow);
}

.mahjong-table-art .north {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.mahjong-table-art .east {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.mahjong-table-art .south {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.mahjong-table-art .west {
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
}

.mahjong-table-art .tile {
  width: 34px;
  height: 48px;
  top: 62px;
  border-radius: 7px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--line);
}

.mahjong-table-art .tile-a {
  left: calc(50% - 48px);
  color: #0e8a5a;
}

.mahjong-table-art .tile-b {
  left: calc(50% - 17px);
  color: var(--danger);
}

.mahjong-table-art .tile-c {
  left: calc(50% + 14px);
  color: var(--line);
}

.mahjong-chip-row,
.mahjong-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mahjong-chip-row span,
.mahjong-filter-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--line);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 950;
}

.mahjong-chip-row .win {
  background: var(--mint);
}

.mahjong-chip-row .lose {
  background: #ffd5e1;
}

.mahjong-filter-chip {
  flex: 1 1 118px;
  border-radius: 12px;
  cursor: pointer;
}

.mahjong-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mahjong-section-head h2 {
  margin: 0;
}

.mahjong-section-head span {
  font-size: 12px;
  font-weight: 950;
}

.mahjong-game-list {
  display: grid;
  gap: 12px;
}

.mahjong-game-card {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 116px;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--line);
  text-align: left;
  box-shadow: 0 5px 0 var(--line);
  cursor: pointer;
}

.mahjong-game-card.win {
  background: #f0fff5;
}

.mahjong-game-card.lose {
  background: #fff3f6;
}

.mahjong-game-card.reservation {
  background: #f4f2ff;
}

.game-card-title {
  padding-right: 78px;
  font-size: 17px;
  font-weight: 950;
}

.game-card-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.game-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  max-width: 78px;
  padding: 4px 7px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  font-size: 11px;
  font-weight: 950;
  text-align: center;
}

.game-bars {
  display: grid;
  gap: 5px;
  margin-top: 4px;
}

.game-bar {
  min-width: 42%;
  max-width: 100%;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 950;
}

.game-bar.win {
  background: var(--mint);
}

.game-bar.lose {
  background: #ffd5e1;
}

.setup-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 2px dashed rgba(11, 61, 43, 0.22);
  font-size: 13px;
}

.setup-row strong {
  text-align: right;
}

.seat-cross-mock {
  display: grid;
  grid-template-columns: 1fr 88px 1fr;
  grid-template-rows: 86px 86px 86px;
  gap: 8px;
  align-items: stretch;
}

.seat-card-mock,
.fee-center-mock {
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--line);
  box-shadow: 0 4px 0 var(--line);
  font-weight: 950;
  cursor: pointer;
}

.seat-card-mock {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 8px 6px;
}

.seat-card-mock.north {
  grid-column: 2;
  grid-row: 1;
}

.seat-card-mock.west {
  grid-column: 1;
  grid-row: 2;
}

.seat-card-mock.east {
  grid-column: 3;
  grid-row: 2;
}

.seat-card-mock.south {
  grid-column: 2;
  grid-row: 3;
}

.fee-center-mock {
  grid-column: 2;
  grid-row: 2;
  background: var(--yellow);
  line-height: 1.3;
}

.seat-dir {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--yellow);
  font-size: 12px;
}

.seat-player {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.seat-score {
  font-size: 17px;
}

.seat-card-mock.positive .seat-score {
  color: #0e8a5a;
}

.seat-card-mock.negative .seat-score {
  color: var(--danger);
}

.mahjong-balance {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 10px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 950;
}

.mahjong-balance em {
  font-style: normal;
}

.mahjong-balance.valid em {
  color: #0e8a5a;
}

.mahjong-balance.invalid em {
  color: var(--danger);
}

.arcade-light-row {
  display: flex;
  gap: 7px;
  margin-bottom: 12px;
}

.arcade-light-row span {
  width: 14px;
  height: 14px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
}

.arcade-light-row span:nth-child(2) {
  background: var(--pink);
}

.arcade-light-row span:nth-child(3) {
  background: var(--blue);
}

.rank-list-mock {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.rank-row-mock {
  display: grid;
  grid-template-columns: 28px 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.rank-row-mock.top {
  background: var(--mint);
}

.rank-pos,
.rank-avatar {
  font-weight: 950;
  text-align: center;
}

.rank-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: var(--yellow);
}

.rank-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.rank-copy strong,
.rank-copy em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-copy em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.rank-value {
  color: #0e8a5a;
  font-weight: 950;
}

.profile-card-mock {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.profile-avatar-mock {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 4px solid var(--line);
  border-radius: 16px;
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--line);
  font-size: 28px;
  font-weight: 950;
}

.profile-card-mock h2 {
  margin: 0;
}

.action-like {
  width: 100%;
  color: var(--line);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 900px) {
  .lab-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .lab-sidebar {
    min-height: auto;
    padding: 16px;
  }

  .lab-sidebar,
  .workspace {
    width: 100%;
    max-width: 100%;
  }

  .preview-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .workspace-head {
    flex-direction: column;
    min-height: auto;
    gap: 14px;
    padding: 18px 16px 14px;
  }

  .workspace-head > * {
    min-width: 0;
    max-width: 100%;
  }

  .workspace-head h1 {
    font-size: 24px;
  }

  .status-pills {
    justify-content: flex-start;
  }

  .device-stage {
    overflow: visible;
    width: 100%;
    place-items: start center;
  }

  .phone-frame {
    width: min(var(--phone-width, 390px), calc(100vw - 28px));
    height: min(760px, calc(100svh - 28px));
    border-width: 8px;
    border-radius: 28px;
  }

  .inspector {
    padding: 14px;
  }
}

@media (max-width: 360px) {
  .brand-block {
    margin-bottom: 18px;
  }

  .workspace-head p {
    font-size: 13px;
  }

  .preview-layout {
    padding: 10px;
  }

  .phone-frame {
    width: calc(100vw - 20px);
  }
}
