:root {
  --ink: #1f2230;
  --muted: #6c7287;
  --panel: rgba(252, 248, 242, 0.88);
  --panel-border: rgba(255, 255, 255, 0.55);
  --accent: #1f6d86;
  --good: #1f8a54;
  --warn: #b87817;
  --bad: #bb3f4f;
  --shadow: 0 18px 45px rgba(20, 24, 33, 0.23);
  --card-shadow: 0 18px 30px rgba(9, 12, 18, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Noto Sans", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(235, 217, 174, 0.35), transparent 42%),
    radial-gradient(circle at 86% 18%, rgba(127, 164, 104, 0.28), transparent 40%),
    linear-gradient(135deg, #355149 0%, #2d3f3b 46%, #4e3d2e 100%);
  padding: 1.1rem;
  overflow-x: hidden;
}

.bg {
  position: fixed;
  border-radius: 50%;
  z-index: -1;
  filter: blur(36px);
  opacity: 0.28;
  animation: drift 10s ease-in-out infinite;
}

.bg-a {
  width: 360px;
  height: 360px;
  top: -120px;
  right: -70px;
  background: #d9ad63;
}

.bg-b {
  width: 430px;
  height: 430px;
  bottom: -220px;
  left: -130px;
  background: #86b389;
  animation-delay: -3s;
}

.app {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.hero h1 {
  margin: 0;
  color: #fdf6ec;
  font-size: clamp(2rem, 4.4vw, 3rem);
  letter-spacing: 0.02em;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #ffdda4;
  font-size: 0.75rem;
  font-weight: 700;
}

.subtitle {
  margin: 0.4rem 0 0;
  color: #f0e3ce;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  animation: rise 0.26s ease;
}

.head-row,
.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

h2 {
  margin: 0.1rem 0 0.72rem;
}

.grid {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.grid.one {
  grid-template-columns: 1fr;
}

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

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

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

.grid.compact {
  margin-bottom: 0.6rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field > span,
.row-head > span {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid #d2c6b2;
  border-radius: 10px;
  padding: 0.58rem 0.68rem;
  background: #fefaf2;
  color: var(--ink);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #d2c6b2;
  border-radius: 10px;
  padding: 0.58rem 0.65rem;
  background: #fefaf2;
}

.chip-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0.4rem 0 0.7rem;
}

.chip {
  border: 1px solid #b7a88f;
  background: #f7ead4;
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  font-size: 0.8rem;
  color: #5d503b;
  cursor: pointer;
}

.chip.active {
  background: #2f6d78;
  color: #ffffff;
  border-color: #2f6d78;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.category {
  text-align: left;
  border: 1px solid #c7baa7;
  background: #f9f0e2;
  border-radius: 10px;
  padding: 0.5rem 0.58rem;
  color: #3f3220;
  cursor: pointer;
}

.category.active {
  border-color: #976d3a;
  background: #ead0a8;
}

.category small {
  display: block;
  color: #7d6a4d;
  font-size: 0.74rem;
  margin-top: 0.2rem;
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  padding: 0;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.64rem 0.86rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(130deg, #2f6d78, #4d9a77);
}

.btn-soft {
  background: #e9dfd0;
  color: #4c4134;
}

.btn-good {
  background: #d7f0e1;
  color: var(--good);
}

.btn-warn {
  background: #fbe7c6;
  color: var(--warn);
}

.btn-bad {
  background: #f7d6dc;
  color: var(--bad);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed #b4a58a;
}

.action-row {
  display: flex;
  justify-content: flex-start;
}

.team-list {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.team-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.team-item input {
  border: 1px solid #d2c6b2;
  border-radius: 10px;
  padding: 0.5rem 0.56rem;
  background: #fefaf2;
}

.hidden {
  display: none !important;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.top-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: start;
}

.pause-compact {
  white-space: nowrap;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.team-score {
  border: 1px solid #c5b59b;
  border-radius: 10px;
  background: rgba(255, 250, 242, 0.92);
  padding: 0.45rem 0.55rem;
}

.team-score.active {
  border-color: #93642f;
  background: #f2debe;
}

.team-score .name {
  margin: 0;
  font-weight: 700;
  color: #54422b;
}

.team-score .score {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.8rem;
  align-items: center;
}

.big {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.timer-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.8rem 0;
}

.timer {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  color: #fff;
  background: conic-gradient(#0f6bb1 360deg, #cfe2f4 0deg);
  animation: pulse 1.1s ease-in-out infinite;
}

.timer::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #25364c;
}

.timer span {
  position: relative;
  z-index: 2;
  font-size: 1.35rem;
  font-weight: 700;
}

.card {
  position: relative;
  border: 1px solid #d7cab8;
  border-radius: 18px;
  padding: 1rem 0.95rem;
  margin-bottom: 0.72rem;
  min-height: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(252, 245, 234, 0.94)),
    repeating-linear-gradient(
      0deg,
      rgba(137, 108, 61, 0.03) 0px,
      rgba(137, 108, 61, 0.03) 1px,
      rgba(255, 255, 255, 0) 1px,
      rgba(255, 255, 255, 0) 5px
    );
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

.pill-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  background: #ecdfc8;
  color: #5a4930;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

#cardTarget {
  margin: 0.75rem 0 0.65rem;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  text-transform: capitalize;
  letter-spacing: 0.01em;
}

.taboo {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.taboo li {
  border: 1px dashed #c8b69d;
  border-radius: 11px;
  background: #f8eedf;
  color: #5b482f;
  padding: 0.5rem 0.58rem;
  font-weight: 700;
  animation: tabooIn 130ms ease both;
  animation-delay: calc(var(--i, 0) * 24ms);
}

.card-next {
  animation: nextCard 150ms ease;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 22, 39, 0.54);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-content {
  width: min(520px, 100%);
  border-radius: 12px;
  background: #fff;
  padding: 1rem;
  box-shadow: var(--shadow);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes drift {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(14px, -16px);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes nextCard {
  from {
    opacity: 0.74;
    transform: translateX(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes tabooIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

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

  #cardTarget {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }
}

@media (max-width: 760px) {
  body {
    padding: 0.55rem;
  }

  .hero,
  .mobile-hide,
  .secondary-controls {
    display: none !important;
  }

  .panel {
    padding: 0.55rem;
  }

  .top-bar {
    position: sticky;
    top: 0;
    background: rgba(252, 246, 236, 0.9);
    border-radius: 12px;
    padding: 0.32rem;
    z-index: 4;
  }

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

  .team-score {
    padding: 0.34rem 0.42rem;
  }

  .team-score .name {
    font-size: 0.74rem;
  }

  .team-score .score {
    font-size: 1.02rem;
  }

  .pause-compact {
    align-self: stretch;
    padding: 0.58rem 0.68rem;
  }

  .card {
    min-height: calc(100vh - 215px);
    margin-top: 0.46rem;
    margin-bottom: 0.55rem;
    padding-top: 0.84rem;
  }

  .pill-row {
    justify-content: center;
  }

  #cardTarget {
    text-align: center;
    margin-top: 0.66rem;
  }

  .taboo {
    grid-template-columns: 1fr;
  }

  .grid.three.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: sticky;
    bottom: 0;
    background: rgba(251, 245, 235, 0.93);
    border-radius: 12px;
    padding: 0.38rem;
    gap: 0.42rem;
    margin-bottom: 0;
  }

  .btn {
    padding: 0.62rem 0.52rem;
    font-size: 0.82rem;
  }
}
