:root {
  --bg: #efe3c8;
  --panel: rgba(255, 249, 238, 0.94);
  --table: radial-gradient(circle at top, #356b43 0%, #1d4b2e 58%, #163521 100%);
  --ink: #1d1a16;
  --muted: #65594b;
  --accent: #b1422c;
  --gold: #c59842;
  --line: rgba(35, 26, 17, 0.18);
  --shadow: 0 18px 50px rgba(19, 34, 24, 0.24);
  --stage-width: 1600;
  --stage-height: 1000;
  --stage-scale: 1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 232, 184, 0.6), transparent 24%),
    linear-gradient(135deg, #e8d8b5 0%, #d2b788 100%);
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  width: calc(var(--stage-width) * 1px);
  height: calc(var(--stage-height) * 1px);
  max-width: none;
  margin: 0;
  padding: 4px 4px 3px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-stage-shell {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-stage {
  position: relative;
  width: calc(var(--stage-width) * 1px);
  height: calc(var(--stage-height) * 1px);
  transform: scale(var(--stage-scale));
  transform-origin: center center;
  will-change: transform;
}

body.mobile-portrait .game-stage {
  transform: rotate(90deg) scale(var(--stage-scale));
}

.mobile-rotate-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 26, 22, 0.78);
  color: #fff8ea;
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

body.mobile-portrait .mobile-rotate-hint {
  opacity: 1;
}

.bottom-drawer {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 0;
  flex-wrap: wrap;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  min-height: 32px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.topbar > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

h1 {
  font-size: 26px;
  line-height: 1;
}

.topbar .ghost-btn {
  padding: 8px 12px;
  font-size: 13px;
}

.audio-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(26, 32, 24, 0.1);
}

.audio-btn {
  min-width: 42px;
  padding: 8px 10px;
}

.audio-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.audio-slider {
  width: 96px;
  accent-color: #b28842;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.ghost-btn,
.action-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(26, 32, 24, 0.12);
  cursor: pointer;
}

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

.table-layout {
  background: var(--table);
  border-radius: 28px;
  padding: 5px 6px 5px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: min-content minmax(0, 1fr) min-content;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.player-band,
.center-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 3px;
  backdrop-filter: none;
}

.mid-row {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  gap: 6px;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.seat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.seat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.seat-role,
.seat-score {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
}

.seat-role.dealer {
  background: linear-gradient(180deg, #f0d79f 0%, #ccab62 100%);
}

.seat-status {
  color: var(--accent);
  font-weight: 700;
}

.concealed-hand,
.human-hand,
.meld-row {
  display: flex;
  gap: 8px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.concealed-hand {
  min-height: 56px;
}

.top-seat .concealed-hand .tile {
  width: 22px;
  height: 31px;
}

.human-hand {
  min-height: 88px;
  align-items: flex-end;
}

.left-seat .concealed-hand,
.right-seat .concealed-hand {
  flex-direction: column;
  align-items: center;
  min-height: 0;
  max-height: 238px;
  overflow: hidden;
  gap: 1px;
}

.left-seat .meld-row,
.right-seat .meld-row {
  flex-direction: column;
  align-items: center;
  min-height: 112px;
  max-height: 112px;
  overflow-x: hidden;
  overflow-y: auto;
  align-content: flex-start;
  gap: 4px;
  flex-wrap: nowrap;
  padding-right: 2px;
}

.left-seat .concealed-hand .tile,
.right-seat .concealed-hand .tile {
  width: 32px;
  height: 23px;
}

.player-hand-shell {
  overflow-x: auto;
  padding-bottom: 2px;
  position: relative;
  z-index: 6;
}

.left-seat,
.right-seat {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: min-content 96px 1fr;
  column-gap: 8px;
  justify-content: center;
  align-content: start;
  overflow: hidden;
}

.left-seat .seat-header,
.right-seat .seat-header {
  grid-column: 1 / -1;
}

.left-seat .meld-row {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  align-self: start;
}

.left-seat .concealed-hand {
  grid-column: 1;
  grid-row: 3;
  justify-self: start;
}

.right-seat .concealed-hand {
  grid-column: 2;
  grid-row: 3;
  justify-self: end;
}

.right-seat .meld-row {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  align-self: start;
}

.concealed.vertical,
.meld-row.vertical {
  min-height: 180px;
}

.center-panel {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-content: start;
  min-height: 0;
  overflow: hidden;
}

.wall-panel,
.table-board,
.settings-panel,
.log-panel {
  border: none;
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.2);
}

.wall-panel,
.table-board,
.settings-panel,
.log-panel {
  grid-column: 1 / -1;
}

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

.top-seat {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 0 4px 0;
  display: grid;
  grid-template-rows: min-content 56px 64px;
  row-gap: 2px;
  align-content: start;
  min-height: 0;
  overflow: hidden;
}

.top-seat .seat-header,
.top-seat .meld-row,
.top-seat .concealed-hand {
  justify-content: center;
}

.top-seat .seat-header {
  grid-row: 1;
  margin-bottom: 0;
}

.top-seat .concealed-hand {
  grid-row: 3;
  min-height: 64px;
  max-height: 64px;
  flex-wrap: nowrap;
  overflow: hidden;
  gap: 1px;
  align-items: flex-start;
}

.top-seat .meld-row {
  grid-row: 2;
  margin-top: 0;
  min-height: 64px;
  max-height: 64px;
  justify-content: flex-start;
  align-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  padding-bottom: 2px;
}

.bottom-seat {
  padding-top: 0;
  position: relative;
  z-index: 5;
  margin-top: 0;
  align-self: start;
}

.bottom-seat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  align-content: flex-start;
  position: relative;
  z-index: 6;
  padding: 2px 0 1px;
}

.bottom-seat-top .seat-header {
  margin-bottom: 0;
}

.bottom-seat-top .meld-row {
  flex: 0 1 260px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.action-context {
  display: none;
  flex: 0 1 280px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff3dc;
  font-size: 13px;
  line-height: 1.35;
}

.action-context.visible {
  display: block;
}

.bottom-seat-top .action-buttons {
  flex: 0 1 auto;
  min-height: 0;
  justify-content: flex-start;
}

.status-inline-bottom {
  flex: 1 1 300px;
  justify-content: flex-end;
  align-self: flex-end;
  max-width: 520px;
  position: relative;
  z-index: 6;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 12px;
}

.log-entry {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  font-size: 14px;
}

.wall-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.table-board {
  position: relative;
  padding: 10px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 50%),
    linear-gradient(180deg, rgba(24, 68, 41, 0.94) 0%, rgba(18, 52, 33, 0.98) 100%);
}

.table-board {
  min-height: 500px;
  border-radius: 28px;
  margin-bottom: 0;
  height: 100%;
  overflow: hidden;
}

.winner-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  min-width: 220px;
  padding: 18px 28px;
  border-radius: 22px;
  background: rgba(32, 14, 10, 0.82);
  color: #fff1dd;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 40px rgba(11, 8, 7, 0.34);
  backdrop-filter: blur(4px);
}

.winner-banner.hidden {
  display: none;
}

.dice-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 22, 14, 0.42);
  border-radius: 28px;
}

.dice-overlay.hidden,
.tai-table-panel.hidden,
.settings-panel.hidden,
.log-panel.hidden,
.history-panel.hidden {
  display: none;
}

.dice-cup {
  min-width: 240px;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(247, 239, 223, 0.96);
  box-shadow: 0 18px 40px rgba(10, 18, 12, 0.24);
  text-align: center;
}

.dice-list {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.die {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdfa 0%, #efe7db 100%);
  box-shadow: 0 8px 20px rgba(27, 22, 14, 0.18);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 8px;
  gap: 4px;
  animation: dice-bounce 360ms ease;
}

.die-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1f2024;
  justify-self: center;
  align-self: center;
  z-index: 1;
}

.die-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: rgba(31, 32, 36, 0.32);
  pointer-events: none;
}

.dice-caption {
  color: #3d362d;
  font-size: 14px;
}

@keyframes dice-bounce {
  0% { transform: translateY(-10px) rotate(-4deg); opacity: 0; }
  100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.discard-zone {
  position: absolute;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px;
}

.top-zone {
  top: 12px;
  left: 132px;
  right: 132px;
  height: 118px;
}

.left-zone {
  top: 102px;
  bottom: 108px;
  left: 14px;
  width: 132px;
}

.right-zone {
  top: 102px;
  bottom: 108px;
  right: 14px;
  width: 132px;
}

.bottom-zone {
  bottom: 12px;
  left: 132px;
  right: 132px;
  height: 118px;
}

.board-core {
  position: absolute;
  top: 138px;
  bottom: 138px;
  left: 132px;
  right: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.discard-lane {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  align-content: flex-start;
  width: 100%;
  height: 100%;
  flex-wrap: wrap;
  overflow: hidden;
}

.discard-lane.horizontal {
  justify-content: center;
  row-gap: 4px;
}

.top-zone .discard-lane {
  align-content: flex-start;
}

.bottom-zone .discard-lane {
  align-content: flex-end;
  flex-wrap: wrap-reverse;
}

.discard-lane.side-horizontal {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: flex-start;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  gap: 6px;
}

.left-zone .discard-lane {
  align-content: flex-end;
}

.right-zone .discard-lane {
  align-content: flex-start;
}

.discard-lane.vertical {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wall-visual {
  display: none;
}

.wall-panel {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wall-ring {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 1;
}

.wall-side {
  position: absolute;
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.wall-side.top-side {
  top: 0;
  left: 52px;
  right: 52px;
  height: 42px;
  flex-direction: row;
}

.wall-side.bottom-side {
  bottom: 0;
  left: 52px;
  right: 52px;
  height: 42px;
  flex-direction: row-reverse;
}

.wall-side.left-side {
  top: 52px;
  bottom: 52px;
  left: 0;
  width: 42px;
  flex-direction: column-reverse;
}

.wall-side.right-side {
  top: 52px;
  bottom: 52px;
  right: 0;
  width: 42px;
  flex-direction: column;
}

.wall-center-meta {
  position: absolute;
  inset: 102px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 18px;
  background: rgba(13, 40, 26, 0.36);
  color: #f8f1df;
  padding: 12px 14px;
  text-align: center;
  white-space: pre-line;
  font-size: 12px;
  line-height: 1.45;
  backdrop-filter: blur(2px);
}

.wall-stack {
  position: relative;
  flex: 0 0 auto;
  border-radius: 7px;
}

.top-side .wall-stack,
.bottom-side .wall-stack {
  width: 12px;
  height: 30px;
}

.left-side .wall-stack,
.right-side .wall-stack {
  width: 30px;
  height: 12px;
}

.wall-brick {
  position: absolute;
  border-radius: 6px;
  background: linear-gradient(180deg, #c89f74 0%, #efdec4 18%, #f7ecda 84%, #c79f73 100%);
  box-shadow:
    0 2px 6px rgba(10, 8, 4, 0.22),
    inset 0 0 0 1px rgba(116, 77, 40, 0.24);
}

.top-side .wall-brick,
.bottom-side .wall-brick {
  left: 0;
  width: 12px;
  height: 24px;
}

.left-side .wall-brick,
.right-side .wall-brick {
  top: 0;
  width: 24px;
  height: 12px;
}

.top-side .wall-brick.level-0,
.bottom-side .wall-brick.level-0 {
  bottom: 0;
}

.top-side .wall-brick.level-1,
.bottom-side .wall-brick.level-1 {
  bottom: 5px;
}

.left-side .wall-brick.level-0,
.right-side .wall-brick.level-0 {
  right: 0;
}

.left-side .wall-brick.level-1,
.right-side .wall-brick.level-1 {
  right: 5px;
}

.wall-stack.empty {
  opacity: 0.16;
}

.wall-stack.partial {
  opacity: 0.74;
}

.wall-stack.full {
  opacity: 1;
}

.wall-stack.break {
  outline: 2px solid #f0d79f;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(240, 215, 159, 0.12);
}

.wall-stack.drawn {
  animation: wall-pop 420ms ease;
}

@keyframes wall-pop {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  40% {
    transform: translateY(-8px) scale(1.04);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.72;
  }
}

.tile {
  width: 52px;
  height: 67px;
  border: 1px solid rgba(28, 19, 10, 0.2);
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdfa 0%, #f2eadf 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 12px 24px rgba(20, 19, 12, 0.18);
  padding: 2px;
  transition: transform 120ms ease, box-shadow 120ms ease;
  overflow: hidden;
  position: relative;
}

.tile-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  margin-left: 0;
  pointer-events: none;
  --tile-scale: 1.1;
  --tile-shift-x: 4px;
  transform: translateX(var(--tile-shift-x)) scale(var(--tile-scale));
}

.tile-image[alt="白"] {
  --tile-scale: 1.06;
  --tile-shift-x: 0px;
}


.top-seat .tile-image,
.top-zone .tile-image {
  transform: rotate(180deg) translateX(var(--tile-shift-x)) scale(var(--tile-scale));
}

.left-seat .tile-image,
.left-zone .tile-image {
  transform: rotate(90deg) translateX(var(--tile-shift-x)) scale(var(--tile-scale));
}

.right-seat .tile-image,
.right-zone .tile-image {
  transform: rotate(-90deg) translateX(var(--tile-shift-x)) scale(var(--tile-scale));
}

.tile.selectable:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 20px rgba(41, 28, 11, 0.18);
}

.tile.tenpai-candidate {
  border-color: rgba(214, 48, 49, 0.95);
  box-shadow:
    0 0 0 3px rgba(214, 48, 49, 0.38),
    0 12px 24px rgba(20, 19, 12, 0.18);
}

.tile.tenpai-candidate::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff8787 0%, #d63031 100%);
  box-shadow: 0 0 0 1px rgba(109, 18, 18, 0.22);
}

.tile.back {
  background: linear-gradient(180deg, #8d2d1e 0%, #6d1d11 100%);
}

.tile.small {
  width: 38px;
  height: 54px;
  font-size: 12px;
}

.tile.tiny {
  width: 32px;
  height: 46px;
  font-size: 11px;
}

.meld-row .tile.tiny,
.meld-row .tile.small,
.player-band .meld-block .tile,
.player-band .meld-block .tile.tiny {
  width: 38px;
  height: 54px;
}

.left-seat .meld-row .tile,
.right-seat .meld-row .tile,
.left-seat .meld-row .tile.tiny,
.right-seat .meld-row .tile.tiny {
  width: 44px;
  height: 31px;
}

.meld-row .tile-image,
.meld-block .tile-image {
  width: 100%;
  margin-left: 0;
}

.top-seat .tile.small,
.left-seat .tile.small,
.right-seat .tile.small {
  width: 26px;
  height: 36px;
}

.top-seat .tile,
.top-zone .tile,
.bottom-zone .tile,
.left-zone .tile,
.right-zone .tile {
  width: 52px;
  height: 67px;
}

.left-seat .tile,
.right-seat .tile {
  width: 32px;
  height: 23px;
}

.top-seat .tile.small,
.top-zone .tile.small,
.bottom-zone .tile.small,
.left-zone .tile.small,
.right-zone .tile.small {
  width: 38px;
  height: 54px;
}

.left-seat .tile.small,
.right-seat .tile.small {
  width: 36px;
  height: 26px;
}

.top-seat .tile.tiny,
.top-zone .tile.tiny,
.bottom-zone .tile.tiny,
.left-zone .tile.tiny,
.right-zone .tile.tiny {
  width: 32px;
  height: 46px;
}

.left-seat .tile.tiny,
.right-seat .tile.tiny {
  width: 36px;
  height: 26px;
}

.left-zone .tile,
.right-zone .tile {
  width: 56px;
  height: 44px;
}

.left-zone .tile.tiny,
.right-zone .tile.tiny {
  width: 56px;
  height: 44px;
}

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

.action-buttons:empty {
  display: none;
  min-height: 0;
}

.left-seat .drawn-tile,
.right-seat .drawn-tile {
  margin-left: 0;
  margin-top: 8px;
}

.meld-block {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  border-radius: 14px;
  background: transparent;
  flex-wrap: nowrap;
}

.left-seat .meld-block,
.right-seat .meld-block {
  flex-direction: column;
}

.top-seat .meld-row::-webkit-scrollbar,
.bottom-seat-top .meld-row::-webkit-scrollbar,
.left-seat .meld-row::-webkit-scrollbar,
.right-seat .meld-row::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.top-seat .meld-row::-webkit-scrollbar-thumb,
.bottom-seat-top .meld-row::-webkit-scrollbar-thumb,
.left-seat .meld-row::-webkit-scrollbar-thumb,
.right-seat .meld-row::-webkit-scrollbar-thumb {
  background: rgba(255, 248, 234, 0.35);
  border-radius: 999px;
}

.left-seat .meld-row.vertical,
.right-seat .meld-row.vertical {
  align-self: start;
}

.settings-panel h3 {
  margin-bottom: 0;
}

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

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

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.setting-field input {
  width: 100%;
  border-radius: 10px;
  border: none;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.84);
}

.small-btn {
  margin-top: 12px;
}

.secondary-btn {
  margin-top: 0;
  padding: 8px 14px;
}

.score-summary {
  margin-top: 10px;
  font-size: 13px;
  color: #f6f0df;
  white-space: pre-line;
}

.history-panel {
  margin-top: 14px;
}

.tai-table-panel {
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
}

.tai-table-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.tai-row {
  display: grid;
  grid-template-columns: 1.4fr 72px;
  gap: 10px;
  align-items: center;
  color: #fff8ea;
}

.tai-row input {
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
}

.tai-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tai-note {
  font-size: 12px;
  color: rgba(255, 245, 225, 0.72);
}

.history-panel h3 {
  margin-bottom: 10px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.history-entry {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff8ea;
  font-size: 13px;
  white-space: pre-line;
}

.action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff8ea;
  font-size: 12px;
  min-height: 30px;
  max-width: 100%;
}

.status-chip .muted {
  color: rgba(255, 248, 234, 0.72);
  font-size: 11px;
}

.status-chip.wide {
  max-width: 220px;
}

.status-chip strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-buttons {
  min-height: 44px;
  justify-content: flex-end;
  flex: 1 1 240px;
}

.action-btn.primary {
  background: linear-gradient(180deg, #cbad6d 0%, #b28842 100%);
}

.hover-tooltip {
  position: fixed;
  z-index: 60;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(16, 20, 18, 0.95);
  color: #fff8ea;
  box-shadow: 0 12px 24px rgba(10, 10, 10, 0.28);
  pointer-events: none;
}

.hover-tooltip.hidden {
  display: none;
}

.hover-tooltip-text {
  font-size: 12px;
  line-height: 1.35;
}

.hover-tooltip-tiles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hover-tooltip-tile {
  width: 34px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfa 0%, #f2eadf 100%);
  padding: 2px;
}

.hover-tooltip-tile .tile-image {
  width: 100%;
  height: 100%;
  transform: none;
}
