* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background:
    linear-gradient(
      90deg,
      rgba(56, 118, 255, 0.5) 0%,
      rgba(56, 118, 255, 0.5) var(--pro-share, 50%),
      rgba(214, 70, 70, 0.46) var(--pro-share, 50%),
      rgba(214, 70, 70, 0.46) 100%
    );
  color: #111111;
}

body.gate-mode .rules-panel {
  display: none;
}

.app-shell {
  padding: 5.25rem 1.5rem 3rem;
}

.entry-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.entry-gate-card {
  width: min(680px, 100%);
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 45px rgba(17, 17, 17, 0.06);
  padding: 1.5rem;
}

.entry-rules-list {
  margin: 0 0 1.4rem;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  color: #222222;
  font-size: 0.92rem;
  line-height: 1.6;
}

.rules-warning {
  margin-bottom: 1.2rem;
  color: #b3261e;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.5;
}

.entry-id-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.entry-side-block {
  grid-column: 1 / -1;
  margin-bottom: 0.15rem;
}

.entry-id-label {
  font-size: 1rem;
  font-weight: 700;
}

.entry-id-input {
  width: 100%;
  border: 1px solid rgba(17, 17, 17, 0.14);
  border-radius: 16px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  padding: 0.85rem 1rem;
  outline: none;
}

.entry-id-input:focus {
  border-color: rgba(17, 17, 17, 0.3);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.05);
}

.message {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 6rem 2rem 2rem;
  color: #6d6d6d;
  font-size: 1.05rem;
  text-align: center;
}

.rules-panel {
  position: fixed;
  top: 1rem;
  left: 1.5rem;
  z-index: 200;
  width: min(360px, calc(100% - 2rem));
}

.rules-toggle {
  color: #111111;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.rules-toggle::-webkit-details-marker {
  display: none;
}

.rules-content {
  margin-top: 0.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(17, 17, 17, 0.08);
}

.rules-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  color: #2b2b2b;
  font-size: 0.83rem;
  line-height: 1.55;
}

.page-header,
.admin-panel,
.room-gate-panel,
.composer-panel,
.feed-panel {
  width: min(960px, 100%);
  margin: 0 auto;
}

.page-header {
  margin-bottom: 1.5rem;
}

.admin-panel,
.room-gate-panel {
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 45px rgba(17, 17, 17, 0.06);
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.admin-panel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
}

.room-gate-message {
  color: #303030;
  font-size: 0.95rem;
  line-height: 1.5;
}

.header-row,
.topic-bar,
.composer-panel,
.feed-panel {
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 45px rgba(17, 17, 17, 0.06);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  margin-bottom: 0.85rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.nickname {
  font-weight: 700;
  font-size: 0.92rem;
}

.side-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  color: #111111;
  font-size: 0.74rem;
  font-weight: 700;
}

.side-badge.pro {
  background: #cfe0ff;
}

.side-badge.con {
  background: #ffd2d2;
}

.topic-bar {
  padding: 1.4rem 1.5rem;
}

.debate-title {
  font-size: clamp(1.5rem, 2.6vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.page-main {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(280px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  width: min(1280px, 100%);
  margin: 0 auto;
}

.composer-panel,
.feed-panel {
  padding: 1.2rem;
}

.composer-panel {
  position: sticky;
  top: 5.2rem;
}

.final-panel-shell {
  position: sticky;
  top: 5.2rem;
}

.composer-panel.is-collapsed {
  padding: 0.7rem;
}

.composer-body[hidden] {
  display: none;
}

.composer-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1px dashed rgba(17, 17, 17, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111111;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.72rem 0.95rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h2 {
  font-size: 1rem;
  margin-bottom: 0.28rem;
}

.section-heading p {
  color: #626262;
  font-size: 0.84rem;
  line-height: 1.45;
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field-count {
  margin-top: -0.35rem;
  color: #666666;
  font-size: 0.75rem;
  text-align: right;
}

.field-count.is-limit {
  color: #b43737;
}

.form-lock-note {
  margin-top: 0.6rem;
  color: #4d4d4d;
  font-size: 0.78rem;
  line-height: 1.45;
}

.final-card {
  margin-top: 0.95rem;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.95rem;
}

.final-card-title {
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.final-card-persuasion {
  margin-top: 0.75rem;
  color: #111111;
  font-size: 0.84rem;
  font-weight: 700;
}

.side-picker-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.side-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.side-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.side-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.side-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.8rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111111;
  font-size: 0.82rem;
  font-weight: 700;
}

.side-option input:checked + span {
  background: #eceff4;
  border-color: rgba(17, 17, 17, 0.24);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

.side-option input[value="pro"]:checked + span {
  background: #cfe0ff;
  border-color: rgba(101, 163, 255, 0.45);
}

.side-option input[value="con"]:checked + span {
  background: #ffd2d2;
  border-color: rgba(255, 122, 122, 0.45);
}

.side-picker.is-locked {
  opacity: 0.72;
}

.side-picker.is-locked .side-option {
  cursor: default;
}

.field-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.field-textarea,
.field-input,
.reason-input {
  width: 100%;
  border: 1px solid rgba(17, 17, 17, 0.14);
  border-radius: 16px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input {
  padding: 0.82rem 1rem;
}

.field-textarea {
  min-height: 110px;
  padding: 0.9rem 1rem;
}

.reason-input {
  min-height: 74px;
  padding: 0.8rem 0.95rem;
}

.field-textarea:focus,
.field-input:focus,
.reason-input:focus {
  border-color: rgba(17, 17, 17, 0.3);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.05);
}

.reason-block {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.reason-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.reason-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.reason-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.reason-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.reason-index {
  color: #555555;
  font-size: 0.77rem;
  font-weight: 700;
}

.text-action {
  border: none;
  background: transparent;
  color: #111111;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  border: none;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.72rem 1.15rem;
}

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

.threads-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-text {
  padding: 2rem 1rem;
  color: #717171;
  text-align: center;
  font-size: 0.88rem;
}

.thread-card {
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
}

.thread-card.is-pro {
  background: #d9e8ff;
}

.thread-card.is-con {
  background: #ffd9d9;
}

.thread-main {
  padding: 1rem 1rem 0.95rem;
}

.thread-action-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.1rem 1rem 0.95rem;
}

.thread-action-button {
  border: none;
  background: transparent;
  color: #111111;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.thread-meta,
.reply-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: rgba(17, 17, 17, 0.7);
  margin-bottom: 0.6rem;
}

.thread-side,
.reply-side {
  font-weight: 700;
}

.thread-claim,
.reply-claim {
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 700;
  color: #111111;
}

.thread-reasons,
.reply-reasons {
  margin-top: 0.85rem;
  padding-left: 1.05rem;
  color: #111111;
}

.thread-source {
  margin-top: 0.8rem;
  color: rgba(17, 17, 17, 0.72);
  font-size: 0.8rem;
  line-height: 1.45;
  word-break: break-word;
}

.thread-reasons li,
.reply-reasons li {
  margin-top: 0.35rem;
  line-height: 1.52;
  font-size: 0.88rem;
}

.thread-panel[hidden] {
  display: none;
}

.reply-stack {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.reply-card {
  margin-left: 1rem;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.9rem;
}

.reply-card.is-pro {
  background: rgba(217, 232, 255, 0.92);
}

.reply-card.is-con {
  background: rgba(255, 217, 217, 0.92);
}

.reply-form {
  margin-left: 1rem;
  border-top: 1px dashed rgba(17, 17, 17, 0.14);
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.reply-form[hidden] {
  display: none;
}

.reply-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.reply-guide {
  color: #666666;
  font-size: 0.76rem;
}

.reply-empty {
  margin-left: 1rem;
  color: #666666;
  font-size: 0.8rem;
}

.thread-chat-panel {
  border-top: 1px solid rgba(17, 17, 17, 0.08);
  padding: 0 1rem 1rem;
}

.free-talk-status {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  font-size: 0.92rem;
  line-height: 1;
}

.free-talk-status.is-active {
  animation: free-talk-blink 0.9s steps(1, end) infinite;
}

@keyframes free-talk-blink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }

  100% {
    opacity: 1;
  }
}

.free-talk-window {
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.95);
  overflow: hidden;
}

.free-talk-messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 320px;
  overflow-y: auto;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(242, 241, 237, 0.9), rgba(255, 255, 255, 0.98));
}

.free-talk-empty {
  color: #6b6b6b;
  font-size: 0.82rem;
}

.chat-message {
  display: flex;
}

.chat-message.is-mine {
  justify-content: flex-end;
}

.chat-message.is-other {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 78%;
  padding: 0.75rem 0.9rem;
  border-radius: 18px;
  color: #111111;
  font-size: 0.86rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-message.is-mine .chat-bubble {
  background: #fee500;
  border-bottom-right-radius: 6px;
}

.chat-message.is-other .chat-bubble {
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-bottom-left-radius: 6px;
}

.chat-message.is-pro .chat-bubble {
  background: #cfe0ff;
  border-color: rgba(101, 163, 255, 0.32);
}

.chat-message.is-con .chat-bubble {
  background: #ffd2d2;
  border-color: rgba(255, 122, 122, 0.32);
}

.chat-message.is-neutral .chat-bubble {
  background: #ffffff;
}

.free-talk-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.94);
}

.free-talk-input {
  width: 100%;
  border: 1px solid rgba(17, 17, 17, 0.14);
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  padding: 0.82rem 1rem;
  outline: none;
}

.free-talk-input:focus {
  border-color: rgba(17, 17, 17, 0.3);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.05);
}

@media (max-width: 900px) {
  .page-main {
    grid-template-columns: 1fr;
  }

  .composer-panel,
  .final-panel-shell {
    position: static;
  }
}

@media (max-width: 720px) {
  .admin-panel-row {
    grid-template-columns: 1fr;
  }

  .entry-id-form {
    grid-template-columns: 1fr;
  }

  .entry-id-label {
    margin-bottom: -0.25rem;
  }

  .rules-panel {
    left: 1rem;
    width: calc(100% - 2rem);
  }

  .app-shell {
    padding: 5.1rem 1rem 2rem;
  }

  .message {
    padding: 5.1rem 1rem 2rem;
  }

  .composer-panel,
  .feed-panel,
  .header-row,
  .topic-bar {
    border-radius: 20px;
  }

  .reply-card,
  .reply-form,
  .reply-empty {
    margin-left: 0;
  }

  .free-talk-form {
    grid-template-columns: 1fr;
  }
}
