:root {
  color-scheme: dark;
  --bg: #070814;
  --bg-soft: #111528;
  --card: rgba(17, 21, 40, 0.82);
  --card-strong: rgba(22, 28, 52, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #a8b3cf;
  --gold: #ffd36a;
  --gold-strong: #ffb21a;
  --red: #ff4b6a;
  --green: #35d399;
  --blue: #65a9ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 75, 106, 0.2), transparent 30%),
    radial-gradient(circle at 86% 6%, rgba(101, 169, 255, 0.22), transparent 34%),
    linear-gradient(135deg, #070814 0%, #0c1020 45%, #141529 100%);
  color: var(--text);
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before,
body::after {
  position: fixed;
  z-index: -2;
  pointer-events: none;
  content: "";
}

body::before {
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 80%);
}

body::after {
  width: 420px;
  height: 420px;
  right: -120px;
  bottom: -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 211, 106, 0.18), transparent 68%);
  filter: blur(2px);
  animation: pulseGlow 7s ease-in-out infinite;
}

a {
  color: #b9d7ff;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}

a:hover {
  color: var(--gold);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 20, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 211, 106, 0.55);
  border-radius: 15px;
  background: linear-gradient(145deg, #ffefb0, #ff9d1f 48%, #ff4b6a);
  color: #1f1300;
  box-shadow: 0 10px 34px rgba(255, 178, 26, 0.28);
}

.brand-mark::after {
  position: absolute;
  inset: -50% auto auto -60%;
  width: 52px;
  height: 110px;
  background: rgba(255, 255, 255, 0.38);
  transform: rotate(25deg);
  content: "";
  animation: shine 4.8s ease-in-out infinite;
}

.brand-title {
  display: block;
  font-size: 16px;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a,
.nav-links button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbeafe;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.nav-identity {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid rgba(101, 169, 255, 0.28);
  border-radius: 999px;
  background: rgba(101, 169, 255, 0.12);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 900;
}

.nav-links a:hover,
.nav-links button:hover,
.nav-links a.is-active {
  border-color: rgba(255, 211, 106, 0.58);
  background: rgba(255, 211, 106, 0.12);
  color: var(--gold);
  transform: translateY(-1px);
}

.logout-form {
  margin: 0;
}

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: clamp(22px, 4vw, 48px);
  align-items: center;
  min-height: 330px;
  margin-bottom: 26px;
  padding: clamp(26px, 5vw, 52px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: calc(var(--radius) + 10px);
  background:
    linear-gradient(135deg, rgba(255, 211, 106, 0.16), transparent 38%),
    linear-gradient(150deg, rgba(101, 169, 255, 0.2), rgba(255, 75, 106, 0.13)),
    rgba(12, 16, 32, 0.82);
  box-shadow: var(--shadow);
}

.compact-hero {
  min-height: 260px;
}

.hero::before {
  position: absolute;
  inset: -2px;
  z-index: -1;
  background: conic-gradient(from 190deg, rgba(255, 211, 106, 0.4), transparent, rgba(101, 169, 255, 0.35), transparent, rgba(255, 75, 106, 0.36));
  content: "";
  filter: blur(24px);
  opacity: 0.55;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 14px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 211, 106, 0.35);
  border-radius: 999px;
  background: rgba(255, 211, 106, 0.1);
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero h1,
.hero h2 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(36px, 7vw, 76px);
  line-height: 0.94;
  letter-spacing: -0.07em;
}

.hero p {
  max-width: 640px;
  color: #d6def5;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.75;
}

.hero-art {
  position: relative;
  min-height: 280px;
}

.hero-art img {
  width: 100%;
  max-width: 440px;
  filter: drop-shadow(0 30px 55px rgba(0, 0, 0, 0.42));
  animation: floatCards 5.8s ease-in-out infinite;
}

.floating-chip {
  position: absolute;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 9px dashed rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: radial-gradient(circle, #2d1020 0 32%, #ff4b6a 33% 64%, #9b1832 65%);
  color: white;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 18px 36px rgba(255, 75, 106, 0.22);
  animation: spinChip 11s linear infinite;
}

.floating-chip.one {
  right: 10%;
  top: 5%;
}

.floating-chip.two {
  left: 8%;
  bottom: 8%;
  width: 58px;
  height: 58px;
  border-width: 7px;
  background: radial-gradient(circle, #13281f 0 32%, #35d399 33% 64%, #0c7a53 65%);
  animation-direction: reverse;
}

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

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)),
    var(--card);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
  padding: clamp(20px, 3vw, 30px);
}

.card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent);
  content: "";
}

.card h2,
.card h3 {
  margin: 0 0 14px;
  letter-spacing: -0.03em;
}

.card p {
  color: var(--muted);
  line-height: 1.65;
}

.glass-card {
  background:
    radial-gradient(circle at top left, rgba(255, 211, 106, 0.12), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035)),
    var(--card-strong);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.stat {
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.stat strong {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 24px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

form {
  margin: 16px 0 0;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-inline input {
  flex: 1 1 220px;
}

.row-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(180px, 1.2fr) auto;
  gap: 8px;
  margin: 0;
}

.row-form input {
  min-height: 38px;
  border-radius: 12px;
  padding: 8px 10px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  min-height: 48px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input::placeholder {
  color: rgba(216, 226, 255, 0.55);
}

input:focus,
select:focus {
  border-color: rgba(255, 211, 106, 0.68);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 4px rgba(255, 211, 106, 0.12);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  color: #1f1300;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(255, 178, 26, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button:hover,
.button:hover {
  color: #1f1300;
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(255, 178, 26, 0.3);
}

.button-secondary {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
}

.button-secondary:hover {
  color: var(--gold);
  box-shadow: none;
}

.button-danger,
button.danger {
  background: linear-gradient(135deg, #ff7289, #e11d48);
  color: white;
  box-shadow: 0 14px 30px rgba(225, 29, 72, 0.24);
}

.button-danger:hover,
button.danger:hover {
  color: white;
}

.small-button {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 12px;
}

.game-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.game-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 900;
}

.game-link small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.game-link::before {
  width: 14px;
  height: 14px;
  border: 3px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 75, 106, 0.2);
  content: "";
}

.game-item form,
.actions form {
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.18);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  text-align: left;
}

th {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

td {
  color: #edf2ff;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.055);
}

.playing-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  --suit-color: #111827;
  min-width: 64px;
  min-height: 78px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.98), transparent 28%),
    linear-gradient(145deg, #ffffff, #e9eef8 72%, #dbe4f2);
  color: #101522;
  font-weight: 1000;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 14px 28px rgba(0, 0, 0, 0.26);
  transform: translateZ(0);
}

.playing-card::before,
.playing-card::after {
  position: absolute;
  color: currentColor;
  font-size: 13px;
  line-height: 1;
  opacity: 0.75;
  content: attr(data-suit);
}

.playing-card::before {
  top: 8px;
  left: 9px;
}

.playing-card::after {
  right: 9px;
  bottom: 8px;
  transform: rotate(180deg);
}

.card-rank {
  position: relative;
  z-index: 1;
  font-size: 22px;
  letter-spacing: -0.06em;
}

.card-suit {
  position: relative;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--suit-color);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.card-suit img {
  width: 18px;
  height: 18px;
  display: block;
}

.playing-card-club,
.playing-card-spade {
  --suit-color: #111827;
  color: #111827;
}

.playing-card-heart,
.playing-card-diamond {
  --suit-color: #e11d48;
  color: #e11d48;
}

.playing-card-unknown {
  min-width: 52px;
  min-height: 62px;
  color: #101522;
}

.text-muted .playing-card {
  opacity: 0.55;
  filter: grayscale(0.7);
}

.text-muted {
  color: rgba(168, 179, 207, 0.58);
}

.error,
.success,
.empty-state {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 18px;
}

.error {
  border: 1px solid rgba(255, 75, 106, 0.35);
  background: rgba(255, 75, 106, 0.1);
  color: #ff9cad;
}

.success {
  border: 1px solid rgba(53, 211, 153, 0.35);
  background: rgba(53, 211, 153, 0.1);
  color: #86efc6;
}

.empty-state {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.link-box {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.link-box code,
.code-line {
  display: block;
  overflow-x: auto;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  color: #dbeafe;
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.log-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.log-date-link {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 800;
}

.log-date-link.is-selected {
  border-color: rgba(255, 211, 106, 0.6);
  background: rgba(255, 211, 106, 0.16);
  color: var(--gold);
}

.log-pre {
  max-height: 620px;
  overflow: auto;
  margin: 18px 0 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: #050711;
  color: #dbeafe;
  font-size: 13px;
  line-height: 1.65;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 620ms ease, transform 620ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes floatCards {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-16px) rotate(1.5deg);
  }
}

@keyframes spinChip {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shine {
  0%,
  48% {
    transform: translateX(-30px) rotate(25deg);
  }
  62%,
  100% {
    transform: translateX(116px) rotate(25deg);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 220px;
  }

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

  .span-4,
  .span-5,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
  }

  .nav-links a,
  .nav-links button {
    flex: 1 1 auto;
  }

  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .hero {
    padding: 24px;
  }

  .hero h1,
  .hero h2 {
    font-size: clamp(34px, 13vw, 54px);
  }

  .form-inline > * {
    flex: 1 1 100%;
  }
}
