:root {
  --ink: #1c1712;
  --muted: #7b6b5a;
  --paper: #f7f2ea;
  --panel: rgba(255, 251, 244, 0.9);
  --line: rgba(56, 42, 28, 0.16);
  --accent: #b85c38;
  --accent-strong: #8f3826;
  --gold: #c99533;
  --green: #2e7d63;
  --red: #b93c32;
  --shadow: 0 18px 50px rgba(50, 33, 19, 0.18);
  font-family:
    Pretendard,
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #ece3d5;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  color: var(--ink);
  background: #ece3d5;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background-color: #ece3d5;
  background-image: var(--screen-bg, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
}

body::after {
  z-index: -1;
  background:
    linear-gradient(120deg, rgba(36, 63, 63, 0.17), transparent 35%),
    linear-gradient(240deg, rgba(170, 91, 49, 0.16), transparent 40%),
    rgba(236, 227, 213, 0.5);
  backdrop-filter: blur(1.5px);
}

body[data-screen="auth"]::after {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 251, 244, 0.2), rgba(236, 227, 213, 0.48) 58%, rgba(216, 198, 174, 0.56)),
    linear-gradient(120deg, rgba(36, 63, 63, 0.16), transparent 36%),
    linear-gradient(240deg, rgba(170, 91, 49, 0.16), transparent 42%);
}

body[data-screen="game"]::after {
  background:
    linear-gradient(120deg, rgba(36, 63, 63, 0.14), transparent 36%),
    linear-gradient(240deg, rgba(170, 91, 49, 0.14), transparent 42%),
    rgba(54, 45, 36, 0.38);
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  font: inherit;
  outline: none;
}

input:focus {
  border-color: rgba(184, 92, 56, 0.58);
  box-shadow: 0 0 0 3px rgba(184, 92, 56, 0.12);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar,
.access-panel,
.access-card,
.lobby-header,
.match-lobby-panel,
.join-card,
.match-strip,
.side-panel,
.player-card,
.rules-card,
.asset-card,
.modal-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 86px;
  padding: 16px 20px;
  border-radius: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-screen {
  min-height: calc(100vh - 46px);
}

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

.access-panel {
  display: grid;
  width: min(1120px, 100%);
  overflow: hidden;
  padding: 0;
  border-radius: 8px;
}

.match-lobby-panel {
  width: min(760px, 100%);
  padding: 22px;
  border-radius: 8px;
}

.access-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

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

.access-hero {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #eadfce;
}

.access-bottom {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
  background: rgba(255, 251, 244, 0.94);
}

.login-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) 86px;
  gap: 10px;
  align-items: end;
}

.login-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.access-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgba(56, 42, 28, 0.42);
  font-weight: 900;
}

.access-links button {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.access-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(56, 42, 28, 0.42);
  font-size: 12px;
  font-weight: 800;
}

.access-footer a {
  color: var(--muted);
  text-decoration: none;
}

.access-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

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

.google-login {
  background: rgba(255, 255, 255, 0.76);
}

.kakao-login {
  border-color: rgba(92, 72, 14, 0.22);
  background: #fee861;
}

.signup-panel {
  display: grid;
  gap: 14px;
  width: min(520px, 100%);
}

.signup-panel h2 {
  margin-top: 2px;
}

.signup-consent {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.signup-consent strong {
  font-size: 14px;
}

.signup-consent span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.signup-social {
  margin-top: 2px;
}

.signup-policy-links {
  justify-content: flex-start;
}

.policy-body {
  min-height: 100vh;
}

.policy-shell {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.policy-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 251, 244, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.policy-back {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
}

.policy-back:hover {
  color: var(--ink);
  text-decoration: underline;
}

.policy-panel h1 {
  margin: 8px 0 6px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.05;
}

.policy-updated {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.policy-panel section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.policy-panel section + section {
  margin-top: 20px;
}

.policy-panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.policy-panel p,
.policy-panel li {
  color: #4f4134;
  font-size: 15px;
  line-height: 1.75;
}

.policy-panel ul {
  margin: 0;
  padding-left: 20px;
}

.game-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 5px 14px rgba(50, 33, 19, 0.18);
}

.access-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  box-shadow: none;
}

.access-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.lobby-screen {
  display: grid;
  gap: 16px;
  align-content: start;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  font-size: 18px;
  font-weight: 900;
}

.lobby-divider {
  color: rgba(56, 42, 28, 0.36);
}

.ticket-inline {
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.ticket-inline b {
  color: var(--ink);
  font-size: 20px;
}

.lobby-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.lobby-profile {
  align-content: start;
}

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

.profile-stats div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.profile-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

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

.lobby-action {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 251, 244, 0.82);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.lobby-action strong {
  display: block;
  margin-bottom: 8px;
  font-size: 24px;
}

.lobby-action > span:last-child {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.lobby-action.primary-action {
  border-color: rgba(184, 92, 56, 0.38);
  background:
    linear-gradient(120deg, rgba(184, 92, 56, 0.18), transparent 54%),
    rgba(255, 251, 244, 0.9);
}

.lobby-action.locked {
  opacity: 0.48;
  filter: grayscale(0.7);
}

.match-lobby-panel {
  display: grid;
  gap: 14px;
  position: relative;
}

.back-button {
  justify-self: start;
}

.join-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  box-shadow: none;
}

.join-card strong {
  display: block;
  font-size: 24px;
}

.match-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.sheet-title {
  display: grid;
  place-items: center;
  min-height: 40px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
  font-size: 20px;
}

.character-sheet {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(28, 23, 18, 0.18);
  background: #201915;
  color: #f7ead5;
  font-weight: 800;
  font-size: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p,
.hint,
.rules-card li,
.event-log,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 10px;
}

.stat {
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.stat span,
.reward-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat strong,
.reward-row strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.game-layout {
  display: grid;
  grid-template-columns: 300px minmax(520px, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.side-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
}

.player-card,
.rules-card,
.asset-card {
  padding: 14px;
  border-radius: 8px;
  box-shadow: none;
}

.player-card.active {
  border-color: rgba(184, 92, 56, 0.4);
}

.character-card {
  display: grid;
  place-items: center;
  position: relative;
  width: 100%;
  height: 176px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.18)),
    rgba(122, 82, 47, 0.12);
}

.character-placeholder {
  display: grid;
  place-items: center;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  border: 1px dashed rgba(56, 42, 28, 0.28);
  border-radius: 8px;
  color: rgba(56, 42, 28, 0.48);
  background: rgba(255, 255, 255, 0.22);
  font-size: 16px;
  font-weight: 900;
}

.portrait-slot {
  display: grid;
  place-items: center;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  overflow: hidden;
  border: 1px dashed rgba(56, 42, 28, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
}

.portrait-slot .character-placeholder {
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  background: transparent;
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stone-badge {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 8px 0 8px 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 900;
}

.stone-badge img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(28, 23, 18, 0.22));
}

.my-character {
  box-shadow: inset 0 -18px 40px rgba(20, 18, 15, 0.08);
}

.rival-character {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.24)),
    rgba(81, 105, 111, 0.13);
}

.meter-row {
  margin-top: 16px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.meter-label strong {
  color: var(--ink);
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(44, 32, 20, 0.12);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #f0c96d);
  transition: width 180ms ease;
}

.meter.timer span {
  background: linear-gradient(90deg, var(--green), #7cbf86);
}

.meter.timer.warning span {
  background: linear-gradient(90deg, var(--red), #e28469);
}

.meter.muted span {
  width: 100%;
  background: repeating-linear-gradient(135deg, rgba(28, 23, 18, 0.14) 0 7px, rgba(28, 23, 18, 0.06) 7px 14px);
}

.meter.unknown {
  position: relative;
}

.meter.unknown span {
  width: 100%;
  background: repeating-linear-gradient(135deg, rgba(28, 23, 18, 0.18) 0 7px, rgba(28, 23, 18, 0.07) 7px 14px);
}

.meter.unknown em {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff8ef;
  background: #2c251f;
  font-style: normal;
  font-weight: 900;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

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

.skill-slots,
.skill-grid {
  display: grid;
  gap: 8px;
}

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

.skill-button,
.book-button {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 56px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  text-align: left;
  cursor: pointer;
}

.skill-button.empty-slot,
.skill-button.hidden-slot {
  cursor: default;
  border-style: dashed;
  color: rgba(28, 23, 18, 0.42);
  background: rgba(255, 255, 255, 0.28);
}

.skill-button.hidden-slot .skill-icon,
.skill-button.empty-slot .skill-icon {
  background: rgba(77, 57, 43, 0.42);
}

.skill-button.hidden-slot {
  grid-template-columns: 34px 1fr;
}

.skill-status-stack {
  position: absolute;
  right: 8px;
  top: 8px;
  display: none;
  gap: 4px;
}

.skill-status {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff8ef;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(60, 30, 18, 0.2);
}

.skill-status.cooldown {
  background: #2f6fa8;
}

.skill-status.duration {
  color: #3b2a12;
  background: #f0c84f;
}

.skill-button.has-status {
  padding-right: 66px;
}

.skill-button.has-status .skill-status-stack {
  display: flex;
}

.skill-button:disabled,
.book-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.skill-button.revealed-slot:disabled {
  opacity: 1;
}

.skill-button.empty-slot:disabled,
.skill-button.hidden-slot:disabled {
  opacity: 0.7;
}

.skill-button.selected,
.book-button.selected {
  border-color: rgba(184, 92, 56, 0.55);
  background: rgba(184, 92, 56, 0.12);
}

.skill-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff8ec;
  font-size: 14px;
  font-weight: 900;
  background: #4d392b;
}

.skill-copy strong {
  display: block;
  font-size: 13px;
}

.skill-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  border-radius: 8px;
  border: 0;
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  color: #fff8ef;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: default;
  opacity: 0.48;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.board-stage {
  min-width: 0;
}

.match-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border-radius: 8px;
}

.set-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 104px;
}

.set-dot {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(56, 42, 28, 0.22);
  border-radius: 50%;
  background: rgba(56, 42, 28, 0.16);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.45);
}

.set-dot.black {
  border-color: rgba(0, 0, 0, 0.34);
  background: radial-gradient(circle at 35% 24%, #545454 0 9%, #171514 56%, #050403 100%);
}

.set-dot.white {
  border-color: rgba(80, 68, 54, 0.34);
  background: radial-gradient(circle at 35% 24%, #ffffff 0 18%, #f2ede4 60%, #b8aea1 100%);
}

.board-wrap {
  position: relative;
  width: min(100%, 760px);
  margin: 16px auto 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(40, 27, 16, 0.24);
  background: #c69b68;
}

.match-finale {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(20, 13, 8, 0.24);
  pointer-events: none;
}

.match-finale strong {
  z-index: 2;
  color: #ffd86b;
  font-size: clamp(58px, 10vw, 112px);
  line-height: 1;
  text-shadow:
    0 3px 0 rgba(92, 45, 11, 0.8),
    0 0 24px rgba(255, 203, 84, 0.9);
}

.fireworks span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffd86b;
  box-shadow:
    0 -38px #fff4b8,
    32px -18px #d95745,
    36px 22px #72b07a,
    0 40px #f2a43a,
    -34px 20px #fff4b8,
    -30px -20px #d95745;
  animation: fireworkPop 980ms ease-out infinite;
}

.fireworks span:nth-child(1) { left: 18%; top: 22%; animation-delay: 0ms; }
.fireworks span:nth-child(2) { left: 76%; top: 28%; animation-delay: 140ms; }
.fireworks span:nth-child(3) { left: 28%; top: 68%; animation-delay: 280ms; }
.fireworks span:nth-child(4) { left: 72%; top: 70%; animation-delay: 420ms; }
.fireworks span:nth-child(5) { left: 48%; top: 18%; animation-delay: 560ms; }
.fireworks span:nth-child(6) { left: 50%; top: 78%; animation-delay: 700ms; }

@keyframes fireworkPop {
  0% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.35) rotate(38deg); }
}

.board-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.board-grid {
  position: absolute;
  left: 20.83%;
  top: 21.68%;
  width: 58.1%;
  height: 58.19%;
}

.cell {
  position: relative;
  position: absolute;
  width: 8.6%;
  height: 8.6%;
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  transform: scale(0.8);
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
}

.cell.empty:hover::before {
  opacity: 0.38;
  transform: scale(0.86);
  border: 2px solid rgba(28, 23, 18, 0.45);
  background: rgba(255, 255, 255, 0.16);
}

.stone {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.34);
  transition: transform 120ms ease;
}

.stone.black {
  background: radial-gradient(circle at 35% 24%, #56595b 0 10%, #171514 56%, #050403 100%);
}

.stone.white {
  background: radial-gradient(circle at 35% 24%, #ffffff 0 18%, #f2ede4 60%, #b8aea1 100%);
}

.stone.last {
  outline: 3px solid rgba(199, 149, 51, 0.78);
  outline-offset: 2px;
}

.stone.drop-in {
  animation: stoneSettle 150ms ease;
}

@keyframes stoneSettle {
  0% { transform: scale(1.12); }
  60% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

/* ── 착수 애니메이션: 옆에서 진입 → 호버 → 낙하 ── */
.fly-stone {
  position: absolute;
  width: 7.4%;
  height: 7.4%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 25;
  transition:
    left 360ms cubic-bezier(0.22, 0.61, 0.36, 1),
    top 190ms cubic-bezier(0.5, 0, 0.9, 0.55),
    opacity 200ms ease;
}

.fly-stone.black {
  background: radial-gradient(circle at 35% 24%, #56595b 0 10%, #171514 56%, #050403 100%);
}

.fly-stone.white {
  background: radial-gradient(circle at 35% 24%, #ffffff 0 18%, #f2ede4 60%, #b8aea1 100%);
}

.fly-stone.drop {
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.45);
}

.fly-stone.illusion-slide {
  box-shadow: 0 12px 20px rgba(80, 37, 118, 0.34);
  transition:
    left 260ms cubic-bezier(0.22, 0.76, 0.24, 1),
    top 260ms cubic-bezier(0.22, 0.76, 0.24, 1),
    opacity 160ms ease;
}

.fly-stone.land {
  animation: stoneImpact 130ms ease;
}

@keyframes stoneImpact {
  0% { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(-50%, -46%) scaleX(1.2) scaleY(0.78); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ── 지뢰 폭발 연출: 섬광 + 충격파 + 돌 반으로 쪼개짐 + "펑!" ── */
.mine-fx {
  position: absolute;
  width: 20%;
  height: 20%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 30;
}

.mine-fx .mine-flash {
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0 18%, #ffd24a 38%, #ff7a1a 66%, rgba(255, 120, 20, 0) 70%);
  animation: mineFlash 480ms ease-out forwards;
}

.mine-fx .mine-ring {
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  border: 3px solid rgba(255, 190, 70, 0.9);
  animation: mineRing 560ms ease-out forwards;
}

.mine-fx .shard {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  height: 30%;
  border-radius: 50%;
}

.mine-fx .shard.black {
  background: radial-gradient(circle at 35% 24%, #56595b 0 10%, #171514 56%, #050403 100%);
}

.mine-fx .shard.white {
  background: radial-gradient(circle at 35% 24%, #ffffff 0 18%, #f2ede4 60%, #b8aea1 100%);
}

.mine-fx .shard.left {
  clip-path: polygon(0 0, 52% 0, 52% 100%, 0 100%);
  animation: shardLeft 600ms cubic-bezier(0.2, 0.5, 0.4, 1) forwards;
}

.mine-fx .shard.right {
  clip-path: polygon(48% 0, 100% 0, 100% 100%, 48% 100%);
  animation: shardRight 600ms cubic-bezier(0.2, 0.5, 0.4, 1) forwards;
}

.mine-fx .pow {
  position: absolute;
  left: 50%;
  top: 2%;
  transform: translate(-50%, 0);
  font-weight: 900;
  color: #ffdf7a;
  text-shadow: 0 2px 6px rgba(120, 40, 0, 0.85);
  font-size: clamp(12px, 2.4vw, 22px);
  animation: minePow 620ms ease-out forwards;
}

@keyframes mineFlash {
  0% { opacity: 0; transform: scale(0.3); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.5); }
}

@keyframes mineRing {
  0% { opacity: 0.9; transform: scale(0.3); }
  100% { opacity: 0; transform: scale(1.9); }
}

@keyframes shardLeft {
  0% { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
  100% { transform: translate(-150%, -8%) rotate(-42deg); opacity: 0; }
}

@keyframes shardRight {
  0% { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
  100% { transform: translate(48%, -8%) rotate(42deg); opacity: 0; }
}

@keyframes minePow {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -10px) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -28px) scale(1); }
}

.cell.destroyed::after,
.cell.banned::after,
.cell.mine::after {
  position: absolute;
  inset: 16%;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 900;
  font-size: clamp(12px, 2.2vw, 20px);
}

.cell.destroyed::after {
  content: "X";
  inset: 6%;
  color: #fff3e6;
  background: rgba(185, 38, 38, 0.86);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 60, 60, 0.24);
}

.cell.banned::after {
  content: "X";
  inset: 6%;
  color: #fff8ec;
  background: rgba(210, 28, 28, 0.84);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 60, 60, 0.22);
}

.cell.mine::after {
  content: "雷";
  inset: -2%;
  border: 2px solid rgba(255, 207, 80, 0.95);
  border-radius: 50%;
  color: #2b1b0e;
  background:
    radial-gradient(circle, rgba(255, 238, 159, 0.96) 0 28%, rgba(216, 142, 35, 0.92) 29% 48%, rgba(64, 34, 13, 0.84) 49% 100%);
  box-shadow:
    0 0 0 4px rgba(255, 204, 74, 0.26),
    0 0 18px rgba(255, 194, 61, 0.72);
  text-shadow: 0 1px 0 rgba(255, 245, 190, 0.85);
}

.cell.mine::before {
  inset: -18%;
  border: 2px dashed rgba(255, 225, 113, 0.8);
  background: rgba(255, 199, 54, 0.12);
  opacity: 1;
  transform: scale(1);
  animation: minePulse 1.4s ease-in-out infinite;
}

.board-toast {
  position: absolute;
  left: 50%;
  top: 13%;
  min-width: 180px;
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff8ef;
  background: rgba(30, 20, 12, 0.82);
  text-align: center;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.board-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff8ef;
  background: rgba(30, 20, 12, 0.86);
  text-align: center;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.event-log {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  height: 132px;
  overflow: auto;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 251, 244, 0.76);
  font-size: 13px;
}

.review-panel {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 251, 244, 0.82);
}

.review-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.review-actions {
  display: flex;
  gap: 8px;
}

.rules-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.rules-card li + li {
  margin-top: 7px;
}

.asset-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.asset-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f1e9;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(25, 18, 12, 0.45);
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(420px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
}

.loadout-panel {
  width: min(620px, 100%);
}

.profile-panel {
  width: min(620px, 100%);
}

.profile-name-field {
  display: grid;
  gap: 7px;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.profile-name-field input {
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.profile-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.loadout-panel #startGameButton {
  position: sticky;
  bottom: 0;
  width: 100%;
  box-shadow: 0 -10px 18px rgba(247, 242, 234, 0.78);
}

.order-panel {
  width: min(460px, 100%);
}

.modal-panel h2 {
  margin-top: 2px;
  font-size: 32px;
}

.modal-panel p {
  margin-top: 8px;
  color: var(--muted);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.profile-option {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}

.profile-option img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
}

.profile-option span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.profile-option.selected {
  border-color: rgba(184, 92, 56, 0.62);
  box-shadow: 0 0 0 3px rgba(184, 92, 56, 0.14);
}

.loadout-slots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 18px 0 12px;
}

.loadout-slot {
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.loadout-slot.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  border-style: dashed;
}

.pregame-grid {
  grid-template-columns: repeat(3, 1fr);
  margin: 12px 0 18px;
}

.phase-timer {
  display: flex;
  justify-content: space-between;
  margin: 16px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
  font-weight: 900;
}

.phase-timer strong {
  color: var(--ink);
}

.grab-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}

.grab-stone {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.grab-stone::before {
  content: "";
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 24%, #56595b 0 10%, #171514 56%, #050403 100%);
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.28);
  opacity: 0.28;
}

.grab-stone.selected {
  border-color: rgba(184, 92, 56, 0.7);
  background: rgba(184, 92, 56, 0.14);
}

.grab-stone.selected::before {
  opacity: 1;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}

.choice-row.hidden,
.grab-row.hidden,
#orderConfirmButton.hidden {
  display: none;
}

.choice-row .selected {
  color: #fff8ef;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.reward-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.reward-row div {
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes minePulse {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(0.88);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@media (max-width: 1180px) {
  .game-layout {
    grid-template-columns: 280px minmax(480px, 1fr);
  }

  .right-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    padding-top: 10px;
  }

  .topbar,
  .match-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .access-grid,
  .login-bar,
  .social-login,
  .lobby-layout,
  .lobby-actions,
  .join-card {
    grid-template-columns: 1fr;
  }

  .access-panel,
  .match-lobby-panel {
    padding: 16px;
  }

  .quick-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .lobby-header {
    min-height: 40px;
    padding: 2px 0;
  }

  .game-icon {
    width: 32px;
    height: 32px;
  }

  .lobby-profile {
    grid-template-columns: minmax(132px, 42%) minmax(0, 1fr);
    grid-template-rows: 44px 128px auto;
    gap: 10px;
    align-items: stretch;
  }

  .lobby-profile .sheet-title {
    grid-column: 2;
    grid-row: 1;
    min-height: 44px;
    margin: 0;
    font-size: 20px;
  }

  .lobby-profile .character-card {
    grid-column: 1;
    grid-row: 1 / span 2;
    height: 182px;
  }

  .lobby-profile .profile-stats {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
  }

  .lobby-profile .profile-stats div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    padding: 6px 10px;
  }

  .lobby-profile .profile-stats span {
    font-size: 12px;
  }

  .lobby-profile .profile-stats strong {
    margin: 0;
    font-size: 18px;
  }

  .lobby-profile #profileButton {
    grid-column: 1 / -1;
    grid-row: 3;
  }

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

  .review-actions,
  .result-actions {
    justify-content: stretch;
  }

  .review-actions button,
  .result-actions button {
    flex: 1;
  }

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

  .board-stage {
    display: contents;
  }

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

  .left-panel {
    display: contents;
  }

  .left-panel .player-card {
    display: contents;
  }

  .match-strip {
    order: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
  }

  .match-strip .eyebrow {
    display: none;
  }

  .match-strip strong {
    display: block;
    font-size: 14px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .match-strip > div:first-child {
    min-width: 0;
  }

  .match-strip > div:last-child {
    min-width: 0;
    text-align: right;
  }

  .set-score {
    min-width: 76px;
    gap: 6px;
  }

  .set-dot {
    width: 18px;
    height: 18px;
  }

  .board-wrap {
    order: 2;
    width: min(100%, 460px, calc(100vh - 350px));
    min-width: 300px;
    margin-top: 6px;
  }

  .board-image {
    transform: scale(1.62);
  }

  .board-grid {
    left: 2.72%;
    top: 4.12%;
    width: 94.12%;
    height: 94.27%;
  }

  .cell {
    width: 10.4%;
    height: 10.4%;
  }

  .fly-stone {
    width: 8.9%;
    height: 8.9%;
  }

  .left-panel .meter-row {
    order: 3;
    margin-top: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 251, 244, 0.82);
    box-shadow: 0 10px 28px rgba(50, 33, 19, 0.1);
  }

  .meter-label {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .meter {
    height: 8px;
  }

  .left-panel .skill-loadout {
    order: 4;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .left-panel .skill-loadout .panel-heading {
    display: none;
  }

  .left-panel .skill-slots {
    gap: 6px;
  }

  .left-panel .skill-button {
    min-height: 46px;
    padding: 6px 8px;
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .left-panel .skill-icon {
    width: 30px;
    height: 30px;
  }

  .left-panel .skill-copy strong {
    font-size: 14px;
  }

  .left-panel .skill-copy span {
    font-size: 11px;
  }

  .left-panel .sheet-title {
    order: 8;
  }

  .left-panel .character-sheet {
    order: 9;
  }

  .review-panel {
    order: 6;
    margin-top: 8px;
  }

  .event-log {
    order: 7;
    height: 110px;
    margin-top: 8px;
  }

  .loadout-slots,
  .skill-grid {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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