:root {
  --felt: #0d6b58;
  --felt-dark: #074337;
  --jade: #22b08d;
  --gold: #f4c76f;
  --cinnabar: #b42335;
  --lacquer: #271814;
  --ink: #17211f;
  --paper: #fff8ea;
  --paper-2: #efe2c6;
  --danger: #db4354;
  --panel: rgba(255, 248, 234, 0.92);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(244, 199, 111, 0.22), transparent 23rem),
    radial-gradient(circle at 85% 14%, rgba(34, 176, 141, 0.2), transparent 22rem),
    linear-gradient(135deg, #141716 0%, #103f39 48%, #251b18 100%);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto 16px;
}

.brand,
.wallet,
.top-actions,
.panel {
  background: linear-gradient(180deg, rgba(255, 250, 238, 0.95), rgba(235, 222, 193, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #8b1e2d;
  background: linear-gradient(145deg, #fffdf6, #e6d5ab);
  box-shadow: inset -4px -5px 10px rgba(0, 0, 0, 0.14), inset 4px 4px 10px #fff, 0 6px 0 #a67d37;
  font-size: 28px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.15;
}

.brand p {
  margin-top: 2px;
  color: #52615d;
  font-size: 13px;
}

.wallet {
  min-width: 150px;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.wallet span {
  display: block;
  color: #52615d;
  font-size: 12px;
}

.wallet strong {
  color: #9a6312;
  font-size: 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius);
}

.music-badge,
.sound-badge {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(180deg, #8b1e2d, #4e1119);
  border: 1px solid rgba(255, 235, 201, 0.25);
  box-shadow: 0 5px 0 #2d080d, 0 12px 20px rgba(78, 17, 25, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 13px;
  font-weight: 800;
}

.sound-badge {
  background: linear-gradient(180deg, #0f806a, #073d35);
  box-shadow: 0 5px 0 #032b25, 0 12px 20px rgba(7, 61, 53, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.icon-btn,
.text-btn,
.mode-tabs button,
.difficulty-switch button,
.suit-picker button,
.action-bar button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: #1b2b28;
  background: linear-gradient(180deg, #fff8e9, #dbc497);
  border: 1px solid rgba(70, 45, 19, 0.2);
  box-shadow: 0 5px 0 #a98243, 0 10px 18px rgba(47, 27, 8, 0.14), inset 0 1px 0 #fff;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icon-btn {
  width: 40px;
  padding: 0;
  font-weight: 800;
}

button:hover {
  transform: translateY(-2px);
  filter: saturate(1.06) brightness(1.02);
}

button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #8d6d37, 0 5px 12px rgba(47, 27, 8, 0.18), inset 0 2px 5px rgba(0, 0, 0, 0.12);
}

.game-layout {
  display: grid;
  grid-template-columns: 290px minmax(520px, 1fr) 280px;
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto;
}

.panel {
  align-self: start;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius);
}

.section-title {
  margin-bottom: 9px;
  color: #60706c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.mode-tabs,
.difficulty-switch,
.suit-picker {
  display: grid;
  gap: 8px;
}

.difficulty-switch,
.suit-picker {
  grid-template-columns: repeat(3, 1fr);
}

.mode-tabs button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 46px;
  text-align: left;
}

.mode-tabs button.active,
.difficulty-switch button.active,
.suit-picker button.active,
.action-bar button.primary-action {
  color: #fff;
  background: linear-gradient(180deg, #0f9a7f, #073f36);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 5px 0 #032c26, 0 14px 26px rgba(12, 126, 104, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.rule-card,
.hint-box {
  display: grid;
  gap: 8px;
  color: #384642;
  font-size: 13px;
  line-height: 1.55;
}

.rule-card strong,
.hint-box strong {
  color: #152522;
}

.primary-btn {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(180deg, #df9b28, #7c3e09);
  border: 1px solid rgba(255, 244, 206, 0.34);
  box-shadow: 0 6px 0 #512705, 0 16px 32px rgba(124, 62, 9, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.mahjong-stage {
  position: relative;
  min-height: calc(100vh - 110px);
  overflow: hidden;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 42%, #18846d 0%, var(--felt) 44%, var(--felt-dark) 100%);
  background-size: 34px 34px, 34px 34px, auto;
  border: 10px solid rgba(76, 43, 21, 0.96);
  box-shadow: var(--shadow), inset 0 0 80px rgba(0, 0, 0, 0.25), inset 0 0 0 6px rgba(244, 199, 111, 0.18);
  perspective: 1100px;
}

.mahjong-stage::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(244, 199, 111, 0.36);
  border-radius: 16px;
  pointer-events: none;
}

.mahjong-stage::after {
  content: "";
  position: absolute;
  inset: 46px;
  border-radius: 18px;
  background:
    linear-gradient(45deg, transparent 48%, rgba(244, 199, 111, 0.08) 49%, rgba(244, 199, 111, 0.08) 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(244, 199, 111, 0.08) 49%, rgba(244, 199, 111, 0.08) 51%, transparent 52%);
  pointer-events: none;
  opacity: 0.55;
}

.opponent {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  min-width: 170px;
  border-radius: 8px;
  color: #eefcf7;
  background: linear-gradient(180deg, rgba(6, 48, 41, 0.86), rgba(4, 29, 25, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.opponent strong,
.opponent span {
  display: block;
}

.opponent span {
  color: #bde0d5;
  font-size: 12px;
}

.opponent-top {
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
}

.opponent-left {
  top: 48%;
  left: 18px;
  transform: translateY(-50%);
}

.opponent-right {
  top: 48%;
  right: 18px;
  transform: translateY(-50%);
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #3c2409;
  background: var(--gold);
  font-weight: 900;
}

.mini-hand {
  display: flex;
  gap: 3px;
  margin-left: auto;
}

.mini-hand.vertical {
  flex-direction: column;
}

.mini-tile {
  width: 16px;
  height: 24px;
  border-radius: 3px;
  background: linear-gradient(145deg, #fff9e9, #d4b577);
  box-shadow: inset -2px -3px 4px rgba(0, 0, 0, 0.18);
}

.table-core {
  position: absolute;
  inset: 120px 120px 190px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  place-items: center;
  z-index: 1;
}

.round-info,
.special-tile,
.last-message {
  color: #ecfff8;
  background: rgba(3, 38, 32, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.round-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
}

.round-info strong {
  color: var(--gold);
}

.special-tile {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.dice-tray {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(3, 38, 32, 0.44);
  border: 1px solid rgba(244, 199, 111, 0.2);
  box-shadow: inset 0 8px 20px rgba(0, 0, 0, 0.16);
}

.die {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 8px;
  color: #83202c;
  background:
    radial-gradient(circle at 30% 22%, #fff, transparent 30%),
    linear-gradient(145deg, #fffdf7, #e3d0a8);
  box-shadow: 0 5px 0 #a47c3d, 0 9px 12px rgba(0, 0, 0, 0.22), inset -2px -3px 5px rgba(0, 0, 0, 0.12);
  font-weight: 900;
}

.dice-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dice-pip.active {
  background: radial-gradient(circle at 35% 35%, #ff8290, #9c1525 70%);
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.34);
}

.discard-river {
  align-content: center;
  display: grid;
  grid-template-columns: repeat(10, minmax(28px, 38px));
  justify-content: center;
  gap: 7px;
  width: min(520px, 100%);
  min-height: 180px;
  padding: 14px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08), transparent 70%),
    rgba(4, 55, 45, 0.48);
  border: 1px solid rgba(244, 199, 111, 0.18);
  box-shadow: inset 0 12px 36px rgba(0, 0, 0, 0.2);
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
}

.player-zone {
  position: absolute;
  right: 28px;
  bottom: 24px;
  left: 28px;
  z-index: 3;
}

.player-status {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 10px;
  color: #eefcf7;
}

.player-status strong,
.player-status span {
  display: block;
}

.player-status span {
  color: #d1e7df;
  font-size: 13px;
}

.last-message {
  max-width: 55%;
  padding: 7px 10px;
  color: var(--gold);
  font-size: 13px;
  text-align: right;
}

.player-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(3px, 0.7vw, 9px);
  min-height: 96px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(3, 38, 32, 0.24), rgba(3, 38, 32, 0.62));
  border: 1px solid rgba(244, 199, 111, 0.16);
  box-shadow: inset 0 12px 28px rgba(0, 0, 0, 0.18);
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(42px, 5vw, 62px);
  height: clamp(62px, 7.5vw, 88px);
  overflow: hidden;
  padding: 6px;
  border: 1px solid rgba(116, 83, 34, 0.26);
  border-radius: 8px 8px 6px 6px;
  color: #17211f;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(145deg, #fffdf7 0%, #f5ead0 48%, #d1b273 100%);
  box-shadow:
    0 10px 0 #9b7a3d,
    0 16px 18px rgba(0, 0, 0, 0.3),
    inset 4px 4px 10px rgba(255, 255, 255, 0.9),
    inset -5px -5px 10px rgba(0, 0, 0, 0.16);
  transform: rotateX(8deg) translateZ(0);
  transition: transform 160ms ease, filter 160ms ease;
  user-select: none;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(114, 79, 29, 0.18);
  border-radius: 5px;
  pointer-events: none;
}

.tile.playable:hover {
  transform: rotateX(8deg) translateY(-14px) scale(1.03);
  filter: brightness(1.06);
}

.tile.just-drawn {
  margin-left: 14px;
}

.tile.discarded {
  width: 38px;
  height: 54px;
  padding: 4px;
  font-size: 17px;
  box-shadow: 0 6px 0 #94743a, 0 10px 12px rgba(0, 0, 0, 0.24);
  animation: land 220ms ease-out;
}

.tile-art {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.75));
}

.wan-top,
.honor-glyph {
  font-family: KaiTi, STKaiti, "Microsoft YaHei", serif;
  font-weight: 900;
  fill: #16135e;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 1.2px;
}

.wan-top {
  font-size: 40px;
}

.wan-bottom {
  font-family: KaiTi, STKaiti, "Microsoft YaHei", serif;
  font-size: 34px;
  font-weight: 900;
  fill: #bd1f31;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 1.1px;
}

.dot.blue,
.dot-core.blue {
  fill: #153f86;
}

.dot.green,
.dot-core.green {
  fill: #16934f;
}

.dot.red,
.dot-core.red {
  fill: #bd1f31;
}

.dot-hole {
  fill: #fff9eb;
  stroke: rgba(21, 63, 134, 0.18);
  stroke-width: 1px;
}

.dot-big-outer {
  fill: none;
  stroke: #153f86;
  stroke-width: 5px;
}

.dot-big-mid {
  fill: none;
  stroke: #16934f;
  stroke-width: 5px;
  stroke-dasharray: 3 3;
}

.dot-big-inner {
  fill: none;
  stroke: #bd1f31;
  stroke-width: 5px;
}

.dot-center-char {
  font-family: KaiTi, STKaiti, serif;
  font-size: 25px;
  font-weight: 900;
  fill: #bd1f31;
}

.bamboo-stick path:first-child {
  stroke: #087a54;
  stroke-width: 2px;
}

.green-stick path:first-child {
  fill: #faffec;
}

.red-stick path:first-child {
  fill: #fff1f1;
  stroke: #bd1f31;
}

.stick-line {
  fill: none;
  stroke: #18a663;
  stroke-width: 1.6px;
  stroke-linecap: round;
}

.red-stick .stick-line {
  stroke: #bd1f31;
}

.eight-bamboo-line,
.eight-bamboo-stroke,
.eight-bamboo-side,
.eight-bamboo-link {
  fill: none;
  stroke: #148a4d;
  stroke-width: 5.2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eight-bamboo-link.fine,
.eight-bamboo-stroke.fine,
.eight-bamboo-line.inner {
  stroke-width: 2.8px;
}

.eight-bamboo-side {
  stroke-width: 5.8px;
}

.eight-bamboo-group {
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.75));
}

.bird-body {
  fill: #fff7df;
  stroke: #153f86;
  stroke-width: 3px;
}

.blue-line,
.green-line,
.red-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4px;
}

.blue-line {
  stroke: #153f86;
}

.green-line {
  stroke: #16934f;
}

.red-line {
  stroke: #bd1f31;
}

.bird-eye {
  fill: #171717;
}

.red-fill {
  fill: #bd1f31;
}

.honor-glyph {
  font-size: 72px;
}

.honor-red {
  fill: #bd1f31;
}

.honor-green {
  fill: #13824c;
}

.honor-blue {
  fill: #16135e;
}

.white-board,
.white-board-inner {
  fill: none;
  stroke: #1d6f92;
  stroke-width: 4px;
}

.white-board-inner {
  stroke-width: 2px;
}

.white-corner {
  fill: none;
  stroke: #1d6f92;
  stroke-width: 2px;
  stroke-linecap: round;
}

.wan-tile {
  grid-template-rows: 1fr auto;
}

.wan-num {
  color: var(--cinnabar);
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 #fff, 0 2px 0 rgba(116, 20, 32, 0.16);
}

.wan-mark {
  color: #1b7b54;
  font-family: Georgia, serif;
  font-size: clamp(14px, 2.1vw, 22px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 #fff;
}

.dot-pattern {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 3px;
  width: 88%;
  height: 82%;
  align-items: center;
  justify-items: center;
}

.dot-pattern i {
  width: clamp(7px, 1.1vw, 12px);
  height: clamp(7px, 1.1vw, 12px);
  border-radius: 50%;
}

.dot-pattern i.active {
  background:
    radial-gradient(circle, #fff 0 20%, transparent 22%),
    radial-gradient(circle at 35% 35%, #fff 0 8%, transparent 9%),
    conic-gradient(from 30deg, #1b75bb, #1b75bb 33%, #c52838 34%, #c52838 66%, #1f8a5a 67%);
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.28), 0 1px 0 #fff;
}

.bamboo-pattern {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px 4px;
  width: 88%;
  height: 82%;
  align-content: center;
  justify-items: center;
}

.bamboo-pattern i {
  position: relative;
  display: block;
  width: clamp(6px, 0.9vw, 10px);
  height: clamp(18px, 2.2vw, 28px);
  border-radius: 8px;
  background: linear-gradient(90deg, #0c6d4d, #20a276 42%, #0b5e45);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.42), inset 0 -2px 0 rgba(0, 0, 0, 0.24);
}

.bamboo-pattern i b,
.bamboo-pattern i::before,
.bamboo-pattern i::after {
  content: "";
  position: absolute;
  right: -3px;
  left: -3px;
  height: 2px;
  border-radius: 3px;
  background: rgba(244, 248, 226, 0.8);
}

.bamboo-pattern i::before {
  top: 25%;
}

.bamboo-pattern i b {
  top: 50%;
}

.bamboo-pattern i::after {
  top: 75%;
}

.bamboo-pattern .red-bamboo {
  background: linear-gradient(90deg, #9f1f2d, #d64a56 42%, #8b1d28);
}

.bamboos-1 {
  grid-template-columns: 1fr;
}

.bamboos-1 i {
  width: clamp(15px, 2vw, 22px);
  height: clamp(31px, 4vw, 44px);
}

.honor-tile {
  grid-template-rows: 1fr auto;
}

.honor-main {
  font-size: clamp(24px, 3.4vw, 38px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 #fff, 0 2px 0 rgba(0, 0, 0, 0.14);
}

.honor-sub {
  color: #6f5b35;
  font-size: 11px;
  font-weight: 800;
}

.tile.red .honor-main {
  color: var(--cinnabar);
}

.tile.green .honor-main {
  color: #087a54;
}

.tile.blue .honor-main {
  color: #245fa8;
}

.tile.gold-tile::after,
.tile.wild-tile::after {
  content: "金";
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: #5b3303;
  background: var(--gold);
  font-size: 10px;
  font-weight: 900;
  z-index: 3;
}

.tile.wild-tile::after {
  content: "癞";
}

.log-list {
  display: grid;
  gap: 8px;
  max-height: 42vh;
  overflow: auto;
  padding-right: 4px;
}

.log-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: #374541;
  font-size: 13px;
  line-height: 1.45;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 19, 17, 0.72);
}

.tutorial-card {
  position: relative;
  width: min(820px, 100%);
  padding: 28px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 15% 0%, rgba(244, 199, 111, 0.22), transparent 18rem),
    var(--paper);
  box-shadow: var(--shadow);
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eadab8;
  font-size: 24px;
}

.eyebrow {
  color: #9a6312;
  font-size: 12px;
  font-weight: 900;
}

.tutorial-card h2 {
  margin: 6px 0 18px;
  font-size: clamp(26px, 4vw, 42px);
}

.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.tutorial-grid div {
  padding: 14px;
  border-radius: 8px;
  background: #f3e6cc;
}

.tutorial-grid p {
  margin-top: 6px;
  color: #57635f;
  line-height: 1.5;
}

.mode-lessons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.mode-lessons article {
  padding: 14px;
  border: 1px solid rgba(116, 83, 34, 0.16);
  border-radius: 8px;
  background: #fff5df;
}

.mode-lessons h3 {
  margin: 0 0 7px;
  color: #783f0d;
  font-size: 16px;
}

.mode-lessons p {
  color: #52615d;
  font-size: 13px;
  line-height: 1.55;
}

@keyframes land {
  from {
    opacity: 0;
    transform: translateY(-12px) rotateZ(-6deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateZ(0);
  }
}

@media (max-width: 1080px) {
  .topbar,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .panel {
    max-height: none;
  }

  .setup-panel {
    order: 1;
  }

  .mahjong-stage {
    order: 2;
    min-height: 720px;
  }

  .log-panel {
    order: 3;
  }

  .mode-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    min-height: 100dvh;
    padding: 6px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    gap: 6px;
    margin-bottom: 6px;
  }

  .brand {
    min-height: 44px;
    padding: 7px 9px;
    align-items: center;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 21px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p {
    display: none;
  }

  .wallet {
    min-width: 94px;
    padding: 7px 9px;
  }

  .wallet strong {
    font-size: 16px;
  }

  .top-actions {
    display: none;
  }

  .game-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    max-width: none;
  }

  .panel {
    padding: 8px;
    gap: 8px;
    border-radius: 8px;
    max-height: none;
  }

  .setup-panel {
    order: 1;
    grid-template-columns: 1fr;
  }

  .setup-panel section:nth-of-type(3),
  .setup-panel section:nth-of-type(4) {
    display: none;
  }

  .setup-panel .section-title {
    margin-bottom: 5px;
  }

  .mode-tabs,
  .difficulty-switch {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

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

  .mode-tabs button,
  .difficulty-switch button {
    min-height: 32px;
    padding: 0 6px;
    font-size: 12px;
    box-shadow: 0 3px 0 #a98243, 0 6px 12px rgba(47, 27, 8, 0.12), inset 0 1px 0 #fff;
  }

  .mode-tabs button span {
    display: none;
  }

  .primary-btn {
    min-height: 38px;
  }

  .mahjong-stage {
    order: 2;
    height: calc(100dvh - 168px);
    min-height: 390px;
    border-width: 5px;
    border-radius: 12px;
  }

  .opponent {
    min-width: 92px;
    padding: 5px 7px;
    gap: 6px;
    font-size: 12px;
  }

  .opponent span {
    font-size: 10px;
  }

  .avatar {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .opponent-top {
    top: 9px;
  }

  .opponent-left,
  .opponent-right {
    top: 31%;
  }

  .opponent-left {
    left: 7px;
  }

  .opponent-right {
    right: 7px;
  }

  .mini-hand {
    display: none;
  }

  .table-core {
    inset: 62px 8px 130px;
    gap: 6px;
    grid-template-rows: auto auto auto 1fr auto;
  }

  .round-info,
  .special-tile,
  .last-message {
    font-size: 12px;
  }

  .round-info {
    gap: 8px;
    padding: 6px 9px;
  }

  .dice-tray {
    padding: 5px 7px;
    gap: 7px;
  }

  .die {
    width: 28px;
    height: 28px;
    padding: 5px;
    border-radius: 7px;
  }

  .dice-pip {
    width: 5px;
    height: 5px;
  }

  .discard-river {
    grid-template-columns: repeat(8, 26px);
    gap: 5px;
    width: min(310px, 100%);
    min-height: 98px;
    padding: 8px;
  }

  .player-zone {
    right: 7px;
    bottom: 7px;
    left: 7px;
  }

  .player-status {
    align-items: flex-end;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 5px;
  }

  .player-status > div:first-child {
    max-width: 38%;
  }

  .player-status strong {
    font-size: 16px;
  }

  .player-status span {
    font-size: 11px;
  }

  .last-message {
    max-width: 62%;
    padding: 6px 8px;
    text-align: right;
    line-height: 1.35;
  }

  .player-hand {
    min-height: 82px;
    gap: 4px;
    padding: 8px;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .player-hand::-webkit-scrollbar {
    display: none;
  }

  .tile {
    flex: 0 0 auto;
    width: 42px;
    height: 60px;
    padding: 4px;
    border-radius: 7px 7px 5px 5px;
    box-shadow:
      0 7px 0 #9b7a3d,
      0 10px 12px rgba(0, 0, 0, 0.26),
      inset 3px 3px 8px rgba(255, 255, 255, 0.9),
      inset -4px -4px 8px rgba(0, 0, 0, 0.14);
  }

  .tile.just-drawn {
    margin-left: 10px;
  }

  .tile.discarded {
    width: 26px;
    height: 38px;
    padding: 3px;
    box-shadow: 0 4px 0 #94743a, 0 7px 8px rgba(0, 0, 0, 0.22);
  }

  .action-bar button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .log-panel {
    display: none;
  }

  .tutorial-grid,
  .mode-lessons {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .mahjong-stage::before {
    content: "建议横屏体验";
    inset: auto 10px 8px auto;
    display: grid;
    place-items: center;
    width: auto;
    height: auto;
    padding: 5px 8px;
    border-radius: 999px;
    color: #f4c76f;
    background: rgba(3, 38, 32, 0.72);
    font-size: 11px;
    z-index: 5;
  }
}

@media (max-width: 920px) and (orientation: landscape) {
  .app-shell {
    padding: 6px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    margin-bottom: 6px;
  }

  .brand {
    padding: 6px 9px;
  }

  .brand p,
  .log-panel {
    display: none;
  }

  .wallet {
    min-width: 110px;
    padding: 7px 9px;
  }

  .top-actions {
    display: none;
  }

  .game-layout {
    grid-template-columns: 220px 1fr;
    gap: 8px;
    max-width: none;
  }

  .setup-panel {
    order: 1;
    max-height: calc(100dvh - 64px);
    padding: 8px;
    gap: 8px;
  }

  .setup-panel section:nth-of-type(4) {
    display: none;
  }

  .mode-tabs button,
  .difficulty-switch button {
    min-height: 32px;
    font-size: 12px;
  }

  .mahjong-stage {
    order: 2;
    height: calc(100dvh - 64px);
    min-height: 360px;
    border-width: 6px;
  }

  .table-core {
    inset: 68px 70px 120px;
  }

  .player-zone {
    bottom: 8px;
  }

  .player-hand {
    min-height: 86px;
    overflow-x: auto;
    justify-content: center;
  }

  .tile {
    width: 42px;
    height: 60px;
    padding: 4px;
  }
}
