:root {
  color-scheme: dark;
  --ink: #fff6ed;
  --muted: rgba(255, 238, 225, 0.72);
  --soft: rgba(255, 238, 225, 0.52);
  --wine: #4a1420;
  --wine-strong: #2a0710;
  --rose: #b24f5d;
  --brick: #963d32;
  --gold: #f0b56b;
  --amber: #ffd99a;
  --glass: rgba(58, 14, 24, 0.54);
  --glass-strong: rgba(42, 7, 16, 0.72);
  --line: rgba(255, 217, 154, 0.26);
  --shadow: 0 24px 80px rgba(20, 3, 8, 0.52);
  --phone-width: 430px;
  --card-surface-image: url("./generated/flirt-card-symmetric.png");
  --card-aspect: 720 / 1000;
  --card-width: min(270px, 72dvw);
  --loading-card-scale: 0.38;
  --loading-card-width: min(103px, 27.36dvw);
  font-family:
    "Inter",
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  background:
    linear-gradient(90deg, #160309, #2a0710 18%, #2a0710 82%, #160309),
    var(--wine-strong);
  overflow-x: hidden;
}

#app {
  position: relative;
  width: min(100dvw, var(--phone-width));
  min-height: 100dvh;
  margin: 0 auto;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.background-layer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100dvw, var(--phone-width));
  background-image:
    linear-gradient(180deg, rgba(62, 8, 20, 0.72) 0%, rgba(49, 7, 17, 0.58) 24%, rgba(37, 4, 12, 0.84) 100%),
    radial-gradient(circle at 55% 22%, rgba(128, 24, 40, 0.28), transparent 42%),
    url("./cover.png");
  background-size: cover, cover, cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: translateX(-50%) scale(1.04);
  filter: saturate(1.12) contrast(1.04);
  z-index: -3;
}

.background-vignette {
  display: none;
}

body[data-view="game"] .background-layer {
  background-image:
    linear-gradient(180deg, rgba(65, 8, 19, 0.82) 0%, rgba(42, 5, 14, 0.72) 28%, rgba(27, 3, 9, 0.92) 100%),
    radial-gradient(circle at 50% 26%, rgba(128, 24, 40, 0.3), transparent 44%),
    url("./cover.png");
  filter: blur(6px) saturate(1.1) contrast(1.08);
}

body[data-view="game"] .background-vignette {
  background:
    linear-gradient(180deg, rgba(65, 8, 19, 0.9) 0%, rgba(42, 5, 14, 0.72) 24%, rgba(27, 3, 9, 0.92) 100%),
    radial-gradient(circle at 50% 34%, rgba(255, 200, 142, 0.13), transparent 36%);
}

body[data-view="loading"] .background-layer {
  background-image:
    linear-gradient(180deg, rgba(65, 8, 19, 0.74) 0%, rgba(49, 7, 17, 0.62) 24%, rgba(37, 4, 12, 0.86) 100%),
    radial-gradient(circle at 50% 22%, rgba(128, 24, 40, 0.28), transparent 42%),
    url("./cover.png");
  filter: blur(3px) saturate(1.16) contrast(1.08);
}

.screen {
  width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(16px + env(safe-area-inset-top))
    14px
    calc(22px + env(safe-area-inset-bottom));
}

.screen-center {
  display: grid;
  place-items: center;
}

.loading-screen {
  align-content: center;
}

.entry-loading-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.entry-loading-panel p {
  margin: 0;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}

.draw-status-text {
  color: var(--amber);
  font-size: 18px;
  font-weight: 800;
}

.mini-card-loader {
  width: var(--loading-card-width);
  aspect-ratio: var(--card-aspect);
  display: grid;
  place-items: center;
  perspective: 700px;
}

.mini-card {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: var(--card-aspect);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 217, 154, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(68, 9, 19, 0.2), rgba(19, 2, 7, 0.42)),
    var(--card-surface-image) center / 100% 100%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 237, 0.14),
    0 16px 34px rgba(18, 3, 8, 0.46);
  transform-style: preserve-3d;
  animation: miniCardTurn 1.35s cubic-bezier(0.35, 0.02, 0.2, 1) infinite;
}

.mini-card::before {
  display: none;
}

@keyframes miniCardTurn {
  0% {
    transform: rotateY(0deg) rotateZ(-2deg);
  }
  48%,
  58% {
    transform: rotateY(180deg) rotateZ(2deg);
  }
  100% {
    transform: rotateY(360deg) rotateZ(-2deg);
  }
}

.glass {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 230, 190, 0.08), transparent 28%),
    var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.22);
}

.top-bar,
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-title {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.34);
}

.art-title {
  position: relative;
  display: inline-block;
  width: max-content;
  max-width: 100%;
  font-family:
    "STXingkai",
    "FZShuTi",
    "KaiTi",
    "STKaiti",
    "Microsoft YaHei",
    serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: transparent;
  background: linear-gradient(135deg, #fff7df 0%, #f4bf78 36%, #d76b78 68%, #fff1cd 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-stroke: 1px rgba(255, 239, 205, 0.24);
  text-shadow:
    0 2px 0 rgba(94, 28, 28, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.38),
    0 0 24px rgba(240, 181, 107, 0.22);
}

.art-title::before,
.art-title::after {
  content: "";
  position: absolute;
  top: 52%;
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 217, 154, 0.86));
  transform: translateY(-50%);
  pointer-events: none;
}

.art-title::before {
  right: calc(100% + 10px);
}

.art-title::after {
  left: calc(100% + 8px);
  transform: translateY(-50%) scaleX(-1);
}

.gate-panel {
  width: 100%;
  padding: 26px;
  border-radius: 8px;
}

.brand-mark {
  display: block;
  width: max-content;
  margin-inline: auto;
  margin-bottom: 28px;
  font-size: 66px;
  line-height: 0.95;
}

.brand-mark.art-title::before,
.brand-mark.art-title::after {
  width: 42px;
}

.brand-mark.art-title::before {
  right: calc(100% + 10px);
}

.brand-mark.art-title::after {
  left: calc(100% + 10px);
}

.top-title.art-title {
  font-size: 46px;
  line-height: 0.95;
  margin-left: 18px;
}

.top-title.art-title::before,
.top-title.art-title::after {
  width: 24px;
}

.entry-loading-card {
  position: relative;
  width: min(310px, 86%);
  aspect-ratio: 0.72;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 217, 154, 0.54);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(45, 6, 14, 0.14), rgba(45, 6, 14, 0.34)),
    var(--card-surface-image) center / 100% 100%;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 237, 0.18),
    inset 0 0 0 1px rgba(255, 217, 154, 0.14),
    0 30px 86px rgba(20, 3, 8, 0.62);
}

.entry-loading-card::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 217, 154, 0.36);
  border-radius: 8px;
  pointer-events: none;
}

.entry-loading-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 224, 174, 0.18), transparent 30%),
    linear-gradient(180deg, transparent 58%, rgba(23, 3, 9, 0.26));
  pointer-events: none;
}

.loading-title,
.entry-loading-card p,
.loading-bar,
.loading-orbit {
  position: relative;
  z-index: 1;
}

.loading-title {
  color: #fff8ee;
  font-size: 56px;
  font-weight: 850;
  line-height: 1;
  text-shadow:
    0 2px 0 rgba(112, 36, 38, 0.26),
    0 12px 34px rgba(0, 0, 0, 0.42);
}

.entry-loading-card p {
  margin: 0;
  color: rgba(255, 246, 237, 0.74);
  font-size: 15px;
  font-weight: 700;
}

.loading-orbit {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  animation: loadingOrbit 1.8s linear infinite;
}

.loading-orbit::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 217, 154, 0.42);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(240, 181, 107, 0.16);
}

.loading-orbit span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff2cd, #f0b56b 58%, rgba(240, 181, 107, 0));
  transform-origin: 46px 46px;
}

.loading-orbit span:nth-child(1) {
  transform: rotate(0deg) translateX(37px);
}

.loading-orbit span:nth-child(2) {
  transform: rotate(120deg) translateX(37px);
}

.loading-orbit span:nth-child(3) {
  transform: rotate(240deg) translateX(37px);
}

.loading-bar {
  width: 54%;
  height: 2px;
  margin-top: 2px;
  overflow: hidden;
  background: rgba(255, 246, 237, 0.14);
}

.loading-bar i {
  display: block;
  width: 52%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 217, 154, 0.92), transparent);
  animation: loadingBar 1.4s ease-in-out infinite;
}

@keyframes loadingOrbit {
  from {
    rotate: 0deg;
  }
  to {
    rotate: 360deg;
  }
}

@keyframes loadingBar {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(200%);
  }
}

.passphrase-form {
  display: grid;
  gap: 14px;
}

.field-label,
.number-field span {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 217, 154, 0.26);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(22, 3, 9, 0.34);
  outline: none;
  padding: 0 14px;
}

input:focus {
  border-color: rgba(255, 217, 154, 0.72);
  box-shadow: 0 0 0 3px rgba(240, 181, 107, 0.14);
}

.primary-button,
.ghost-button,
.icon-text-button,
.feedback-button,
.reroll-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #f3b56c, #b24f5d 52%, #7a2230);
  color: #fffaf0;
  font-weight: 700;
  box-shadow: 0 14px 34px rgba(78, 11, 23, 0.35);
}

.primary-button:hover,
.ghost-button:hover,
.icon-text-button:hover,
.feedback-button:hover,
.reroll-button:hover {
  transform: translateY(-1px);
}

.ghost-button,
.icon-text-button {
  background: rgba(255, 246, 237, 0.08);
  border-color: rgba(255, 217, 154, 0.28);
  color: var(--ink);
}

.ghost-button.small {
  min-height: 36px;
  padding: 0 14px;
}

.primary-button.large,
.ghost-button.large {
  width: 100%;
  min-height: 54px;
  font-size: 18px;
}

.notice,
.hint {
  margin: 14px 0 0;
  color: var(--amber);
  line-height: 1.65;
}

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

.lobby-layout {
  min-height: calc(100dvh - 92px);
  display: grid;
  place-items: center;
  padding-bottom: 0;
}

.lobby-panel {
  width: min(440px, 100%);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 34px);
}

.lobby-title {
  font-size: 58px;
  font-weight: 800;
  line-height: 0.96;
}

.lobby-status {
  margin: 16px 0 26px;
  color: var(--muted);
}

.lobby-actions,
.settings-actions,
.admin-actions {
  display: grid;
  gap: 12px;
}

.settings-actions {
  margin-top: 18px;
}

.settings-layout {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.settings-panel,
.admin-panel,
.slot-panel,
.game-hud {
  border-radius: 8px;
  padding: 18px;
}

.slot-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
  min-height: 232px;
  padding: 24px 14px;
  background:
    linear-gradient(180deg, rgba(255, 226, 180, 0.12), transparent 18%),
    linear-gradient(145deg, rgba(98, 25, 33, 0.82), rgba(34, 5, 12, 0.74));
}

.slot-panel::before,
.slot-panel::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 217, 154, 0.62), transparent);
  pointer-events: none;
}

.slot-panel::before {
  top: 10px;
}

.slot-panel::after {
  bottom: 10px;
  opacity: 0.55;
}

.section-heading {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.section-heading + .settings-grid,
.section-heading + .settings-grid.three {
  margin-top: 16px;
}

.sub-heading {
  margin: 18px 0 10px;
  color: var(--muted);
  font-weight: 700;
}

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

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

.settings-grid + .settings-grid {
  margin-top: 18px;
}

.number-field {
  display: grid;
  gap: 6px;
}

.number-field div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.number-field em {
  min-width: 28px;
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
}

.weight-bands {
  display: grid;
  gap: 10px;
}

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

.game-screen {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  min-height: 100dvh;
  padding:
    calc(12px + env(safe-area-inset-top))
    14px
    calc(14px + env(safe-area-inset-bottom));
}

.game-hud {
  position: sticky;
  top: 10px;
  z-index: 4;
  min-height: 72px;
  display: grid;
  grid-template-columns: 48px 52px minmax(0, 1fr) auto;
  align-items: center;
  background: var(--glass-strong);
}

.hud-stat {
  min-width: 50px;
  text-align: center;
}

.hud-stat span {
  display: block;
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
}

.hud-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 19px;
}

.score-progress {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.score-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.score-progress-meta span {
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
}

.score-progress-meta strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.score-progress-track {
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 217, 154, 0.24);
  border-radius: 999px;
  background: rgba(20, 3, 8, 0.42);
  box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.32);
}

.score-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9c3540, #f0b56b);
  box-shadow: 0 0 14px rgba(240, 181, 107, 0.38);
  transition: width 420ms ease;
}

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

.slot {
  min-width: 0;
  position: relative;
}

.slot-title {
  margin-bottom: 5px;
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.32);
}

.slot-window {
  position: relative;
  height: 48px;
  min-width: 4.5em;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 217, 154, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 235, 196, 0.18), rgba(255, 235, 196, 0.03) 42%, rgba(0, 0, 0, 0.22)),
    linear-gradient(90deg, rgba(255, 217, 154, 0.1), transparent 18%, transparent 82%, rgba(255, 217, 154, 0.1)),
    rgba(23, 3, 9, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 221, 0.18),
    inset 0 -14px 22px rgba(14, 2, 7, 0.36),
    0 10px 22px rgba(18, 3, 8, 0.22);
  transform: translateZ(0);
}

.slot-window::before,
.slot-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 34%;
  z-index: 1;
  pointer-events: none;
}

.slot-window::before {
  top: 0;
  background: linear-gradient(180deg, rgba(18, 3, 8, 0.5), transparent);
}

.slot-window::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(18, 3, 8, 0.58), transparent);
}

.slot.active .slot-window {
  border-color: rgba(255, 217, 154, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 221, 0.26),
    inset 0 -14px 22px rgba(14, 2, 7, 0.32),
    0 0 0 1px rgba(255, 217, 154, 0.22),
    0 14px 30px rgba(240, 181, 107, 0.16);
  transform: translateY(-1px);
}

.slot.revealed .slot-window {
  background:
    linear-gradient(180deg, rgba(255, 226, 176, 0.22), rgba(255, 226, 176, 0.04) 48%, rgba(20, 3, 8, 0.2)),
    linear-gradient(135deg, rgba(132, 37, 45, 0.82), rgba(63, 11, 21, 0.82));
  border-color: rgba(240, 181, 107, 0.42);
}

.slot-value {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  padding: 0 8px;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.38);
}

.slot.revealed .slot-value {
  color: #fff8ee;
  animation: slotPop 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reel-strip {
  position: relative;
  z-index: 2;
  display: grid;
  color: rgba(255, 246, 237, 0.64);
  font-size: 18px;
  font-weight: 700;
  animation: reelSpin 1.35s linear infinite;
}

.reel-strip span {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  white-space: nowrap;
}

.slot.active .reel-strip {
  animation-duration: 520ms;
  color: var(--amber);
}

@keyframes slotPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes reelSpin {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(calc(var(--reel-count) * -48px));
  }
}

.card-area {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 12px;
  min-height: 0;
}

.draw-button {
  width: min(240px, 74%);
  min-height: 56px;
  font-size: 19px;
}

.draw-start-panel {
  width: 100%;
  align-self: end;
  display: grid;
  justify-items: center;
  align-items: end;
  min-height: 112px;
}

.card-controls {
  width: 100%;
  min-height: 112px;
  display: grid;
  align-content: end;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.card-controls.is-loading {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.draw-status {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.draw-loading-card {
  width: var(--card-width);
  aspect-ratio: var(--card-aspect);
  display: grid;
  place-items: center;
}

.card-motion-stage {
  position: relative;
  width: var(--card-width);
  aspect-ratio: var(--card-aspect);
  display: grid;
  place-items: center;
  isolation: isolate;
}

.flip-card {
  width: var(--card-width);
  aspect-ratio: var(--card-aspect);
  perspective: 1400px;
  filter: drop-shadow(0 24px 42px rgba(15, 2, 7, 0.5));
  transform: scale(1);
  transform-origin: center;
  transition:
    transform 620ms cubic-bezier(0.18, 0.86, 0.28, 1),
    filter 620ms ease;
  will-change: transform;
}

.flip-card.is-loading {
  transform: scale(var(--loading-card-scale));
  filter:
    drop-shadow(0 12px 26px rgba(15, 2, 7, 0.48))
    drop-shadow(0 0 18px rgba(240, 181, 107, 0.22));
}

.card-spinner {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.flip-card.is-loading .card-spinner {
  animation: cardLoadingSpin 2.05s linear infinite;
}

.card-shell {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform var(--flip-duration, 900ms) cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card-shell:not([data-action]) {
  cursor: default;
}

.flip-card.flipped .card-shell {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  border: 1px solid rgba(255, 217, 154, 0.56);
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 237, 0.18),
    inset 0 0 0 1px rgba(255, 217, 154, 0.13),
    0 28px 80px rgba(20, 3, 8, 0.56);
}

.card-back {
  background:
    linear-gradient(180deg, rgba(68, 9, 19, 0.2), rgba(19, 2, 7, 0.42)),
    var(--card-surface-image) center / 100% 100%;
}

.card-back::before {
  display: none;
}

.card-back::after {
  display: none;
}

.card-back-mark {
  position: relative;
  z-index: 1;
  font-size: 56px;
  font-weight: 800;
  color: #fff8ee;
  text-shadow:
    0 2px 0 rgba(112, 36, 38, 0.28),
    0 12px 32px rgba(0, 0, 0, 0.42);
}

.hexagram-mark {
  position: relative;
  z-index: 1;
  width: 96px;
  height: 96px;
  overflow: visible;
  filter:
    drop-shadow(0 0 10px rgba(240, 181, 107, 0.42))
    drop-shadow(0 14px 26px rgba(0, 0, 0, 0.32));
}

.hexagram-mark polygon {
  fill: rgba(255, 226, 167, 0.08);
  stroke: rgba(255, 232, 184, 0.96);
  stroke-width: 5;
  stroke-linejoin: round;
}

.hexagram-mark circle {
  fill: rgba(255, 232, 184, 0.96);
}

.mini-hexagram {
  width: 36%;
  height: 36%;
}

.mini-hexagram polygon {
  stroke-width: 8;
}


.card-back-line {
  display: none;
}

.card-back-caption {
  display: none;
}

.card-front {
  transform: rotateY(180deg);
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(68, 9, 19, 0.5), rgba(19, 2, 7, 0.78)),
    var(--card-surface-image) center / 100% 100%;
}

.card-front::before {
  display: none;
}

.card-front::after {
  display: none;
}

.card-front p {
  position: relative;
  z-index: 1;
  width: min(82%, 220px);
  margin: 0;
  margin-inline: auto;
  color: #fff8ee;
  font-size: 19px;
  font-weight: 750;
  line-height: 1.45;
  text-align: justify;
  text-align-last: left;
  word-break: break-word;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.42);
}

.card-status-text {
  position: absolute;
  left: 50%;
  top: calc(50% + clamp(104px, 28vw, 124px));
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition:
    opacity 260ms ease,
    transform 260ms ease;
  white-space: nowrap;
}

.flip-card.is-loading + .card-status-text {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes cardLoadingSpin {
  0% {
    transform: rotateZ(0deg) rotateY(0deg);
  }
  50% {
    transform: rotateZ(180deg) rotateY(8deg);
  }
  100% {
    transform: rotateZ(360deg) rotateY(0deg);
  }
}

.feedback-panel {
  width: 100%;
  display: grid;
  gap: 12px;
  min-height: 112px;
  align-content: end;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.feedback-panel.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.feedback-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

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

.feedback-button {
  min-height: 48px;
  padding: 0 8px;
  font-weight: 700;
}

.feedback-button.boost {
  background: rgba(240, 181, 107, 0.22);
  border-color: rgba(240, 181, 107, 0.56);
}

.feedback-button.keep {
  background: rgba(255, 246, 237, 0.1);
  border-color: rgba(255, 246, 237, 0.25);
}

.feedback-button.cool {
  background: rgba(178, 79, 93, 0.2);
  border-color: rgba(178, 79, 93, 0.48);
}

.reroll-button {
  width: 100%;
  background: rgba(20, 3, 8, 0.28);
  border-color: rgba(255, 246, 237, 0.18);
  color: var(--soft);
}

.admin-panel {
  margin-top: 22px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.admin-summary div {
  border: 1px solid rgba(255, 217, 154, 0.18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(20, 3, 8, 0.22);
}

.admin-summary span {
  display: block;
  color: var(--soft);
  font-size: 13px;
}

.admin-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
}

.stats-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.stat-row {
  border: 1px solid rgba(255, 217, 154, 0.2);
  border-radius: 8px;
  padding: 12px;
  background: rgba(20, 3, 8, 0.24);
}

.stat-row summary {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.stat-row p {
  margin: 12px 0 8px;
  line-height: 1.6;
}

.stat-row small,
.empty-state {
  color: var(--soft);
}

@media (max-width: 640px) {
  .screen {
    padding:
      calc(14px + env(safe-area-inset-top))
      12px
      calc(18px + env(safe-area-inset-bottom));
  }

  .gate-panel {
    padding: 22px;
  }

  .game-hud {
    gap: 8px;
    padding: 10px;
  }

  .hud-stat strong {
    font-size: 18px;
  }

  .slot-grid {
    gap: 8px;
  }

  .slot-window {
    height: 52px;
  }

  .feedback-row {
    gap: 6px;
  }

  .feedback-button {
    font-size: 14px;
  }

  .stat-row summary {
    grid-template-columns: 1fr auto;
  }

  .stat-row summary em {
    grid-column: 1 / -1;
  }
}
