:root {
  --ink: #2a1a10;
  --cream: rgba(255, 246, 232, 0.82);
  --line: rgba(74, 42, 24, 0.18);
  --left: #b4332a;
  --right: #1d4e86;
  --shadow: 0 18px 50px rgba(48, 24, 8, 0.28);
}

* { box-sizing: border-box; }

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

body {
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
  background:
    linear-gradient(180deg, rgba(32, 18, 8, 0.18), rgba(32, 18, 8, 0.38)),
    url("/assets/bg.jpg") center / cover no-repeat fixed;
}

button, input { font: inherit; }

button {
  cursor: pointer;
  border: 0;
}

h1, h2, .eyebrow, .team-label, .pull, #clock, #resultTitle {
  font-family: "Gowun Batang", serif;
}

#app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px 40px;
}

.panel {
  width: min(440px, 100%);
  padding: 28px 26px 24px;
  border-radius: 28px;
  background: var(--cream);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 250, 242, 0.7);
}

.panel.wide { width: min(720px, 100%); }

.hidden { display: none !important; }

.mark {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 22px;
  display: block;
  margin-bottom: 8px;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  color: #8a4b32;
}

h1, h2 { margin: 4px 0 8px; }

h1 { font-size: 2.6rem; }

.lead, .empty, #pullHint, #resultDetail {
  color: #5c4030;
  line-height: 1.55;
}

label { display: grid; gap: 8px; margin: 18px 0; font-weight: 700; }

input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.9);
  padding: 12px 14px;
  color: var(--ink);
}

.primary, .ghost, .rooms button {
  border-radius: 999px;
  padding: 12px 18px;
}

.primary {
  background: #9c3b28;
  color: #fffaf4;
}

.primary:disabled { opacity: 0.45; cursor: default; }

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

.row, .create-row, .actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.create-row { margin: 8px 0 16px; }
.create-row input { flex: 1; }

.me { margin: 0; }

.rooms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.rooms li, .person {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.62);
  border: 1px solid var(--line);
}

.rooms strong, .person span:first-child { font-weight: 700; }

.rooms button { background: #234e78; color: #f7fbff; }
.rooms button:disabled { background: rgba(80, 60, 46, 0.25); color: #5c4030; }

.person.left { box-shadow: inset 4px 0 0 var(--left); }
.person.right { box-shadow: inset 4px 0 0 var(--right); }

.wait-players { display: grid; gap: 8px; margin: 16px 0; }

.rules { margin: 8px 0 16px; }
.rules li { margin: 6px 0; }

.field {
  width: min(980px, 100%);
  min-height: calc(100vh - 64px);
  display: grid;
  align-content: space-between;
  gap: 18px;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}

.team, .timer-block, .result {
  border-radius: 22px;
  background: rgba(255, 246, 232, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 250, 242, 0.65);
}

.team { padding: 14px 16px; }
.left-team { box-shadow: inset 0 -4px 0 var(--left); }
.right-team { box-shadow: inset 0 -4px 0 var(--right); text-align: right; }

.team-label { margin: 0 0 8px; font-size: 1.35rem; }

.team ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.team .mine { font-weight: 700; }

.timer-block {
  min-width: 148px;
  padding: 12px 18px;
  text-align: center;
}

#clock {
  margin: 0;
  font-size: 3rem;
  line-height: 1;
}

#clock.urgent { color: var(--left); }

#lean { margin: 6px 0 0; font-weight: 700; }

.rope-stage {
  height: 120px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.rope {
  width: 150%;
  height: 34px;
  border-radius: 999px;
  position: relative;
  background:
    repeating-linear-gradient(
      90deg,
      #f3e2c4 0 10px,
      #c98452 10px 16px,
      #8d3d2c 16px 24px,
      #e7d3ae 24px 34px
    );
  box-shadow:
    0 10px 0 rgba(70, 32, 16, 0.18),
    inset 0 6px 0 rgba(255, 248, 236, 0.35);
  transition: transform 80ms linear;
}

.knot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 46px;
  transform: translate(-50%, -58%);
  border-radius: 8px 14px 10px 12px;
  background:
    radial-gradient(circle at 30% 30%, #fff 0 8%, transparent 9%),
    linear-gradient(135deg, #f4f7fb, #d5dbe4 42%, #8ea0b5);
  box-shadow: 0 8px 0 rgba(40, 24, 12, 0.2);
}

.pull-wrap { text-align: center; }

.pull {
  width: min(92vw, 460px);
  height: 132px;
  border-radius: 999px;
  font-size: 2.7rem;
  color: #fffaf3;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 244, 220, 0.45), transparent 42%),
    linear-gradient(180deg, #d4533e, #8d2b22);
  box-shadow: 0 16px 0 #641910, 0 24px 30px rgba(60, 18, 8, 0.28);
}

.pull.side-right {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.35), transparent 42%),
    linear-gradient(180deg, #3d78b8, #1a446f);
  box-shadow: 0 16px 0 #102c4c, 0 24px 30px rgba(12, 28, 48, 0.28);
}

.pull:active:not(:disabled) { transform: translateY(8px); box-shadow: 0 8px 0 #641910; }
.pull.side-right:active:not(:disabled) { box-shadow: 0 8px 0 #102c4c; }
.pull:disabled { opacity: 0.55; cursor: default; }

.result {
  padding: 18px;
  text-align: center;
}

#resultTitle { font-size: 2.2rem; margin-bottom: 0; }

.result .actions { justify-content: center; margin-top: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  margin: 0;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(42, 26, 16, 0.88);
  color: #fff8ee;
}

@media (max-width: 720px) {
  .scoreboard { grid-template-columns: 1fr; }
  .right-team { text-align: left; }
  .pull { height: 112px; font-size: 2.2rem; }
  h1 { font-size: 2.2rem; }
}
