:root {
  color-scheme: light dark;
  font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: url("./Picture/bg.jpg") center / cover no-repeat fixed;
  color: #1f2330;
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.2);
  pointer-events: none;
}

.app-container {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.panel {
  display: none;
  animation: fade-in 320ms ease-out;
}

.panel.visible {
  display: block;
}

.title {
  font-size: clamp(28px, 4.5vw, 46px);
  margin: 0 0 12px;
  text-align: center;
  letter-spacing: 0.08em;
}

.start-panel {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  row-gap: 80px;
  min-height: 20vh;
  text-align: center;
  width: 100%;
}

.panel-title {
  margin: 0 0 24px;
  font-size: clamp(24px, 4vw, 34px);
  text-align: center;
}

.game-stage {
  display: none;
  gap: 32px;
}

.game-stage.visible {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  align-items: start;
  gap: 32px;
  width: 100%;
}

#table-stage.game-stage.visible {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  gap: 0;
  min-height: 100vh;
}

#table-stage .table-wrapper {
  width: 100%;
}

.player-persona-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 0 0;
  background: none;
  box-shadow: none;
}

.persona-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.persona-figure img {
  width: 260px;
  height: 260px;
  border-radius: 26px;
  object-fit: cover;
  box-shadow: 0 16px 32px rgba(16, 23, 36, 0.24);
}

.persona-figure figcaption {
  font-size: 18px;
  font-weight: 700;
}

.persona-detail {
  display: none;
}

.persona-code {
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.persona-desc {
  margin: 0;
  white-space: pre-wrap;
}

.selection-panel {
  width: 100%;
  padding: 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px rgba(24, 32, 47, 0.06);
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: center;
}

.selection-title {
  display: none;
}

.selection-hint {
  display: none;
}

.selection-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.selection-block {
  padding: 0;
  border-radius: 0;
  background: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.selection-label {
  order: 3;
  margin-top: 16px;
  font-size: 16px;
  font-weight: 700;
  color: rgba(22, 34, 56, 0.9);
}

.persona-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(24, 32, 47, 0.18);
  background: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  color: #162238;
  transition: border-color 160ms ease;
  order: 0;
}

.persona-select:focus-visible {
  border-color: rgba(253, 160, 133, 0.85);
  outline: none;
  box-shadow: 0 0 0 2px rgba(253, 160, 133, 0.2);
}

.selection-preview {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 160px;
  order: 2;
}

.selection-preview img {
  width: 160px;
  height: 160px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 12px 24px rgba(16, 23, 36, 0.2);
}

.selection-preview figcaption {
  display: none;
}

#finalize-btn {
  align-self: center;
  margin-top: 32px;
}

#finalize-btn[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.table-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 100%;
  overflow: visible;
}

.table-background {
  position: relative;
  width: 100%;
  min-height: 100%;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

.table-surface {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 600px;
}

.trick-area {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 320px;
  min-height: 120px;
  padding: 12px 16px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.trick-cards {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trick-area .played-card {
  width: 64px;
  height: 96px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 8px;
  font-weight: 700;
  pointer-events: auto;
}

.trick-area .played-card.red {
  color: #c42c37;
}

.trick-area .played-card .card-corner {
  font-size: 14px;
}

.trick-area .played-card .card-center {
  font-size: 24px;
}

.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 5;
  width: 160px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.seat.active-seat {
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
}

.seat img {
  width: 140px;
  height: 180px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25);
}

.seat figcaption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(10, 16, 28, 0.68);
  color: #f4f6ff;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 12px 28px rgba(6, 8, 16, 0.3);
  backdrop-filter: blur(12px);
  min-width: 120px;
}

.seat-role {
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.seat-name {
  font-size: 15px;
  font-weight: 700;
}

.seat-player {
  left: 10%;
  bottom: 10%;
  transform: translate(-50%, 0);
}

.seat-opponent-left {
  left: 10%;
  top: 10%;
  transform: translate(-50%, 0);
}

.seat-ally {
  right: 10%;
  top: 10%;
  transform: translate(50%, 0);
}

.seat-opponent-right {
  right: 10%;
  bottom: 10%;
  transform: translate(50%, 0);
}

.hand-row {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  padding: 0;
  height: 132px;
  z-index: 3;
  pointer-events: auto;
  overflow: visible;
}

.hand-row .poker-card {
  width: 72px;
  height: 112px;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff, #f3f5ff);
  box-shadow: 0 16px 32px rgba(6, 8, 20, 0.28);
  border: 1px solid rgba(18, 22, 34, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  color: #151a2b;
  flex: 0 0 auto;
}

.hand-row .poker-card:not(:first-child) {
  margin-left: -44px;
}

.hand-row .poker-card.red {
  color: #c42c37;
}

.hand-row .poker-card {
  cursor: pointer;
  pointer-events: auto;
}

.hand-row .poker-card:hover {
  transform: translateY(-6px);
  transition: transform 120ms ease;
}

.hand-row .poker-card:active {
  transform: translateY(-2px);
}

.pass-btn {
  position: absolute;
  right: 50%;
  bottom: 0;
  transform: translateX(50%);
  margin-top: 16px;
  padding: 10px 24px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.pass-btn:hover {
  transform: translateX(50%) translateY(-2px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
}

.pass-btn:active {
  transform: translateX(50%);
  box-shadow: none;
}

.pass-tag {
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  display: none;
  pointer-events: none;
}

.pass-tag.visible {
  display: inline-block;
  animation: pass-pop 240ms ease;
}

.trick-cards.fade-out {
  opacity: 0;
  transition: opacity 200ms ease;
}

@keyframes pass-pop {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.card-corner {
  font-size: 16px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.card-corner.top {
  align-self: flex-start;
}

.card-corner.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

.card-center {
  font-size: 28px;
  line-height: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
}

.card-annotation {
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0.8;
  margin-top: 2px;
}

.hand-row .poker-card[data-suit="heart"],
.hand-row .poker-card[data-suit="diamond"] {
  color: #d02a36;
}

.hand-row .poker-card[data-suit="joker"] {
  background: linear-gradient(135deg, #161a2a, #313c73);
  color: #f5f6fa;
}

.final-hint {
  margin-top: 24px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 16px 32px;
  font-size: 22px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  color: #162238;
  background: linear-gradient(135deg, rgba(246, 211, 101, 0.92), rgba(253, 160, 133, 0.96));
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.start-panel .primary-btn {
  margin-top: 0;
}

.primary-btn:hover,
.primary-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(253, 160, 133, 0.28);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.question-block {
  border: none;
  margin: 0 0 24px;
  padding: 0;
}

.question-block legend {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 14px;
}

.option-card {
  display: block;
  position: relative;
  margin-bottom: 12px;
  padding: 16px 20px;
  border-radius: 18px;
  background: rgba(24, 32, 47, 0.12);
  border: 2px solid rgba(24, 32, 47, 0);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.option-card:hover {
  transform: translateY(-1px);
}

.option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-card span {
  font-size: 16px;
  line-height: 1.5;
  display: block;
}

.option-card input:checked + span {
  font-weight: 600;
}

.option-card input:checked ~ span {
  color: #18212f;
}

.option-card:has(input:checked) {
  border-color: rgba(253, 160, 133, 0.9);
  background: rgba(253, 160, 133, 0.24);
}

.error {
  margin: 12px 0;
  color: #ffb6b6;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.actions {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.info-text {
  font-size: 16px;
  margin: 14px 0;
  line-height: 1.6;
  text-align: center;
}

.info-text.more {
  font-size: 14px;
  opacity: 0.75;
}

.summary-box {
  white-space: pre-wrap;
  background: rgba(18, 30, 44, 0.12);
  border-radius: 14px;
  padding: 18px;
  margin: 18px 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.5;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 540px) {
  .app-container {
    padding: 24px 18px 28px;
  }

  .option-card {
    padding: 14px 16px;
  }

  .game-stage.visible {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .selection-list {
    grid-template-columns: 1fr;
  }

  .selection-preview img,
  .seat img {
    width: 110px;
  }

  .hand-row {
    gap: 10px;
    padding: 0 18px;
    bottom: 24px;
  }

  .hand-row .poker-card {
    width: 66px;
    height: 94px;
    padding: 6px 8px;
  }
}

