@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&display=swap");

:root {
  --bg-main: #090909;
  --bg-soft: #111111;
  --bg-veil: #171717;
  --surface: #151515;
  --surface-soft: #1b1b1b;
  --surface-strong: #222222;
  --line: #2f2f2f;
  --line-strong: #4a4a4a;
  --text: #f5f5f5;
  --muted: #b6b6b6;
  --text-strong: #ffffff;
  --danger: #ff6c6c;
  --success: #45cd72;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% -6%, rgba(255, 255, 255, 0.12) 0%, transparent 44%),
    radial-gradient(circle at 84% 6%, rgba(255, 255, 255, 0.08) 0%, transparent 36%),
    linear-gradient(180deg, #121212 0%, var(--bg-main) 68%);
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  min-height: 100vh;
  padding: 18px;
}

.container {
  width: min(1460px, 100%);
  margin: 0 auto;
}

.topbar {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(28, 28, 28, 0.95), rgba(15, 15, 15, 0.96));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: #a0a0a0;
}

h1 {
  margin: 6px 0 0;
  font-size: clamp(24px, 2.7vw, 33px);
  line-height: 1.1;
  color: var(--text-strong);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

h2,
h3,
h4 {
  margin-top: 0;
}

.card {
  background: linear-gradient(180deg, rgba(28, 28, 28, 0.95), rgba(16, 16, 16, 0.98));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.hidden {
  display: none !important;
}

input {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 8, 8, 0.92);
  color: var(--text);
  font-size: 15px;
}

input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
}

input::placeholder {
  color: #7f7f7f;
}

button {
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  padding: 11px 16px;
  background: linear-gradient(180deg, #f3f3f3, #d8d8d8);
  color: #0f0f0f;
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
  filter: brightness(1.03);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.ghost-btn {
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid #666666;
  color: #ececec;
}

.ghost-btn:hover {
  filter: none;
  background: rgba(32, 32, 32, 0.95);
}

.error {
  min-height: 20px;
  margin-top: 4px;
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.home-block {
  padding: 4px;
}

.join-card {
  width: min(560px, 100%);
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 395px);
  gap: 16px;
  align-items: start;
}

.room-main {
  min-height: calc(100vh - 136px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% -22%, rgba(255, 255, 255, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(24, 24, 24, 0.97), rgba(10, 10, 10, 0.99));
  border: 1px solid var(--line);
}

.room-sidebar {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(180deg, rgba(26, 26, 26, 0.97), rgba(12, 12, 12, 0.99));
}

.room-title-wrap {
  text-align: center;
}

.room-name {
  margin: 6px 0 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--text-strong);
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}

.room-meta {
  margin: 10px 0 4px;
  color: var(--muted);
}

.room-error-inline {
  text-align: center;
}

.share-link-inline {
  margin-top: 10px;
}

.share-btn {
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.feature-banner {
  margin: 18px auto 0;
  width: min(100%, 560px);
}

.feature-banner-main {
  border-radius: 28px;
  padding: 18px;
  border: 1px solid #505050;
  background: linear-gradient(160deg, #2d2d2d 0%, #1f1f1f 64%, #141414 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 28px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.feature-banner-label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #b8b8b8;
}

.feature-banner-title {
  margin: 0;
  font-size: clamp(20px, 2.3vw, 28px);
  font-weight: 800;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.feature-banner-status {
  margin: 8px 0 0;
  font-size: 14px;
  color: #dddddd;
  overflow-wrap: anywhere;
}

.table-vote-timer,
.table-reveal-countdown {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid #cfcfcf;
  background: rgba(255, 255, 255, 0.08);
  color: #f7f7f7;
  font-size: clamp(18px, 3.4vw, 24px);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.table-vote-timer-expired {
  border-color: var(--success);
  background: rgba(69, 205, 114, 0.2);
  color: #e8ffef;
}

.table-vote-timer-shake {
  animation: timer-shake 0.58s ease-in-out 1;
}

@keyframes timer-shake {
  0% {
    transform: translateX(0);
  }
  16% {
    transform: translateX(-6px);
  }
  32% {
    transform: translateX(6px);
  }
  48% {
    transform: translateX(-4px);
  }
  64% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}

.feature-banner-metrics {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.feature-metric-card {
  min-width: 0;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid #4a4a4a;
  background: rgba(7, 7, 7, 0.42);
  text-align: left;
}

.feature-metric-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b9b9b9;
}

.feature-metric-value {
  margin-top: 2px;
  display: block;
  font-size: 15px;
  color: #f8f8f8;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.table-controls {
  margin: 12px auto 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.table-controls button {
  min-width: 180px;
}

.participants-block {
  margin-top: 16px;
  border-radius: 18px;
  padding: 14px;
  border: 1px solid #3d3d3d;
  background: rgba(0, 0, 0, 0.34);
}

.participants-block-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.participants-title {
  margin: 0;
  font-size: 15px;
  color: #ececec;
}

.participants-counter {
  font-size: 13px;
  color: var(--muted);
}

.participant-ring {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.seat {
  width: 100%;
}

.seat-card {
  width: 100%;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid #454545;
  background: linear-gradient(180deg, rgba(33, 33, 33, 0.95), rgba(18, 18, 18, 0.95));
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.seat-card-reactable {
  cursor: pointer;
}

.seat-card-reactable:hover {
  transform: translateY(-2px);
  border-color: #797979;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.24);
}

.seat-card-hit {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.24), 0 11px 18px rgba(0, 0, 0, 0.32);
}

.seat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #0d0d0d;
  background: linear-gradient(180deg, #ffffff, #cfcfcf);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.36);
}

.seat-main {
  min-width: 0;
  flex: 1;
}

.seat-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-badges {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.12);
  color: #f0f0f0;
}

.badge-green {
  background: rgba(69, 205, 114, 0.18);
  color: #b5f4c8;
}

.badge-gray {
  background: rgba(164, 164, 164, 0.22);
  color: #ececec;
}

.seat-vote-chip {
  min-width: 36px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid #5f5f5f;
  background: rgba(7, 7, 7, 0.82);
  color: #ededed;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  justify-content: center;
}

.seat-vote-chip-filled {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(153, 153, 153, 0.22));
  color: #ffffff;
}

.seat-vote-chip-voted {
  background: rgba(69, 205, 114, 0.22);
  color: #e8ffef;
}

.seat-vote-chip-pending {
  background: rgba(255, 255, 255, 0.13);
  color: #e2e2e2;
}

.table-vote-strip {
  margin-top: auto;
  padding-top: 20px;
}

.table-vote-strip-inner {
  width: 100%;
  margin: 0 auto;
  border-radius: 20px;
  border: 1px solid #444444;
  background: rgba(6, 6, 6, 0.64);
  padding: 14px 12px 16px;
  overflow-x: auto;
}

.table-vote-strip-inner::-webkit-scrollbar {
  height: 7px;
}

.table-vote-strip-inner::-webkit-scrollbar-thumb {
  background: rgba(210, 210, 210, 0.46);
  border-radius: 999px;
}

.cards-row {
  display: inline-flex;
  gap: 10px;
  align-items: flex-end;
}

.vote-card {
  position: relative;
  width: 74px;
  min-height: 102px;
  border-radius: 14px;
  border: 2px solid #8d8d8d;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.11), rgba(20, 20, 20, 0.82)),
    linear-gradient(180deg, rgba(18, 18, 18, 0.95), rgba(7, 7, 7, 0.98));
  color: #f2f2f2;
  font-size: 31px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 7px rgba(0, 0, 0, 0.72);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.vote-card::before,
.vote-card::after {
  content: attr(data-value);
  position: absolute;
  font-size: 11px;
  font-weight: 800;
  color: rgba(240, 240, 240, 0.85);
}

.vote-card::before {
  top: 8px;
  left: 10px;
}

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

.vote-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.38);
  border-color: #cecece;
}

.vote-card.selected {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(206, 206, 206, 0.94));
  border-color: #ffffff;
  color: #0f0f0f;
  text-shadow: none;
  box-shadow: 0 12px 26px rgba(240, 240, 240, 0.21);
}

.vote-card.selected::before,
.vote-card.selected::after {
  color: #2b2b2b;
}

.sidebar-section {
  border-bottom: 1px solid #343434;
  padding-bottom: 12px;
}

.sidebar-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.compact-stats {
  border-bottom: 0;
  display: flex;
  gap: 10px;
  padding-bottom: 0;
}

.stat-pill {
  flex: 1;
  border-radius: 14px;
  border: 1px solid #444444;
  background: rgba(7, 7, 7, 0.7);
  padding: 10px;
}

.stat-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--muted);
}

.feature-form-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-form-column input {
  margin: 0;
}

.features-list,
.votes-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.feature-item,
.vote-item {
  border-radius: 12px;
  border: 1px solid #454545;
  background: rgba(7, 7, 7, 0.56);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-left {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.item-left strong,
.small-text,
.feature-title-line,
.vote-item span {
  overflow-wrap: anywhere;
}

.item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-box,
.active-feature-box {
  border-radius: 14px;
  border: 1px solid #454545;
  background: rgba(8, 8, 8, 0.64);
  padding: 14px;
}

.feature-title-line {
  margin: 0 0 8px;
  font-size: 17px;
}

.vote-value {
  font-weight: 700;
  color: #f0f0f0;
}

.small-text {
  font-size: 12px;
}

.emoji-picker {
  position: fixed;
  z-index: 85;
  width: min(340px, calc(100vw - 18px));
  border-radius: 14px;
  border: 1px solid #666666;
  background: linear-gradient(180deg, rgba(28, 28, 28, 0.98), rgba(10, 10, 10, 0.98));
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  padding: 10px;
}

.emoji-picker-title {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c7c7c7;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.emoji-picker-grid-extended {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.emoji-picker-toggle-btn {
  margin-top: 8px;
  width: 100%;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.03em;
  border-color: #707070;
  background: linear-gradient(180deg, #272727, #1d1d1d);
  color: #f3f3f3;
}

.emoji-picker-toggle-btn:hover {
  filter: none;
  background: linear-gradient(180deg, #333333, #232323);
}

.emoji-picker-extended {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #444444;
}

.emoji-picker-caption {
  margin: 0 0 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #aaaaaa;
}

.emoji-picker-grid-extended {
  max-height: 235px;
  overflow-y: auto;
  padding-right: 3px;
}

.emoji-picker-grid-extended::-webkit-scrollbar {
  width: 7px;
}

.emoji-picker-grid-extended::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(191, 191, 191, 0.42);
}

.emoji-reaction-btn {
  border-radius: 10px;
  border: 1px solid #555555;
  background: rgba(8, 8, 8, 0.9);
  color: #f5f5f5;
  font-size: 21px;
  line-height: 1;
  padding: 7px 0;
}

.emoji-reaction-btn:hover {
  background: rgba(34, 34, 34, 0.98);
  transform: translateY(-1px);
}

.flying-emoji {
  position: fixed;
  z-index: 90;
  font-size: 34px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.45));
  user-select: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 2, 2, 0.74);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  border-radius: 18px;
  border: 1px solid #5a5a5a;
  background: linear-gradient(180deg, rgba(28, 28, 28, 0.98), rgba(12, 12, 12, 0.98));
}

.modal-header {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.modal-header h3 {
  margin: 0;
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 10px;
  padding: 0;
  font-size: 23px;
  line-height: 1;
}

.modal-panel input {
  margin: 8px 0 0;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .room-layout {
    grid-template-columns: 1fr;
  }

  .room-main {
    min-height: 620px;
  }

  .room-sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .page-shell {
    padding: 12px;
  }

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

  .card {
    padding: 18px;
    border-radius: 20px;
  }

  .join-card {
    width: 100%;
  }

  .table-controls {
    flex-direction: column;
    align-items: stretch;
    width: min(100%, 420px);
  }

  .table-controls button {
    width: 100%;
    min-width: 0;
  }

  .compact-stats {
    flex-direction: column;
  }

  .participant-ring {
    grid-template-columns: 1fr;
  }

  .feature-banner {
    width: 100%;
  }

  .feature-banner-main {
    border-radius: 22px;
    padding: 15px;
  }

  .feature-banner-metrics {
    grid-template-columns: 1fr;
  }

  .table-vote-strip-inner {
    padding: 12px 10px 14px;
  }

  .vote-card {
    width: 64px;
    min-height: 90px;
    font-size: 26px;
  }

  .feature-item,
  .vote-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .feature-item .item-right,
  .vote-item .item-right,
  .feature-item .item-right button {
    width: 100%;
  }

  .modal-panel {
    border-radius: 14px;
    padding: 16px;
  }

  .modal-actions button {
    width: 100%;
  }

  .emoji-picker-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .emoji-picker-grid-extended {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .page-shell {
    padding: 10px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .card {
    padding: 14px;
    border-radius: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .room-name {
    font-size: 28px;
  }

  .feature-banner-title {
    font-size: 20px;
  }

  .table-vote-timer,
  .table-reveal-countdown {
    font-size: 18px;
  }

  .cards-row {
    gap: 8px;
  }

  .vote-card {
    width: 56px;
    min-height: 82px;
    border-radius: 12px;
    font-size: 22px;
  }

  .vote-card::before,
  .vote-card::after {
    font-size: 10px;
  }

  .emoji-picker {
    width: min(94vw, 340px);
  }

  .emoji-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .emoji-picker-grid-extended {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .emoji-reaction-btn {
    font-size: 20px;
    padding: 6px 0;
  }

  .flying-emoji {
    font-size: 28px;
  }
}
