:root {
  --bg: #f4efe6;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(32, 45, 58, 0.08);
  --text: #1e2732;
  --muted: #617181;
  --primary: #1a6f63;
  --primary-dark: #0f4f46;
  --accent: #e59a52;
}

body {
  font-family: "SUIT", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(229, 154, 82, 0.25), transparent 28%),
    radial-gradient(circle at top right, rgba(26, 111, 99, 0.18), transparent 32%),
    linear-gradient(180deg, #f7f1e9 0%, #eef3f3 100%);
  color: var(--text);
  min-height: 100vh;
}

.navbar {
  background: linear-gradient(135deg, #16323f 0%, #0f4f46 100%);
}

.btn-ghost-light {
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.panel,
.hero-card,
.stat-card,
.session-card,
.suggestion-box,
.attachment-link {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  backdrop-filter: blur(18px);
}

.hero-card {
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: rgba(229, 154, 82, 0.14);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--primary);
}

.text-secondary {
  color: var(--muted) !important;
}

.stat-card {
  padding: 1.5rem;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.stat-card strong {
  font-size: 2rem;
}

.session-card,
.attachment-link {
  display: block;
  padding: 1rem 1.1rem;
  color: inherit;
}

.session-card:hover,
.attachment-link:hover {
  border-color: rgba(26, 111, 99, 0.25);
  transform: translateY(-1px);
  transition: 0.2s ease;
}

.final-idea-card {
  padding: 1.25rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(26, 111, 99, 0.18);
  background: linear-gradient(135deg, rgba(26, 111, 99, 0.1), rgba(229, 154, 82, 0.08));
}

.final-badge {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.review-panel {
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(32, 45, 58, 0.08);
}

.attachment-card {
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(32, 45, 58, 0.08);
}

.idea-preview {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid rgba(32, 45, 58, 0.08);
}

.nuf-table th,
.nuf-table td {
  background: transparent;
  vertical-align: top;
}

.nuf-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid rgba(32, 45, 58, 0.08);
}

.suggestion-box pre {
  white-space: pre-wrap;
  margin: 0;
  font-family: inherit;
  color: var(--text);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: rgba(26, 111, 99, 0.25);
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.form-control,
.form-select {
  border-radius: 0.9rem;
  border-color: rgba(32, 45, 58, 0.12);
  padding: 0.8rem 1rem;
}

.list-group-item {
  background: transparent;
}

.house-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.house-dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45);
}

.sorting-stage-panel,
.sorting-stage,
.presentation-stage-wrap,
.presentation-house {
  position: relative;
  overflow: hidden;
}

.sorting-stage {
  min-height: 460px;
  border-radius: 1.3rem;
  background:
    radial-gradient(circle at top, rgba(244, 162, 97, 0.18), transparent 30%),
    linear-gradient(180deg, #0d1821 0%, #1b2631 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sorting-stage.fallback-stage {
  display: grid;
  place-items: stretch;
}

.fallback-scene {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 460px;
  overflow: hidden;
}

.fallback-sigils {
  position: absolute;
  inset: auto 0 2.2rem 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 0 2rem;
  align-items: end;
}

.fallback-sigil {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  opacity: 0.75;
  transition: 0.25s ease;
}

.fallback-sigil.is-active {
  opacity: 1;
  transform: translateY(-6px);
}

.fallback-sigil-orb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--guild-accent);
  box-shadow: 0 0 18px var(--guild-accent);
  animation: orb-pulse 1.8s ease-in-out infinite;
}

.fallback-sigil-column {
  width: 1.45rem;
  height: 8rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, var(--guild-accent), var(--guild-color));
  box-shadow: 0 0 24px color-mix(in srgb, var(--guild-color) 45%, transparent);
}

.fallback-sigil-label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 700;
}

.fallback-character {
  --active-color: #ffffff;
  position: absolute;
  left: 50%;
  top: 52%;
  width: 180px;
  height: 280px;
  transform: translate(-50%, -50%);
}

.fallback-character.idle {
  animation: character-float 2.8s ease-in-out infinite;
}

.fallback-head,
.fallback-body,
.fallback-hat,
.fallback-beam,
.fallback-halo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.fallback-head {
  top: 68px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #f2d0b6;
  z-index: 3;
}

.fallback-body {
  top: 118px;
  width: 88px;
  height: 120px;
  border-radius: 50px;
  background: linear-gradient(180deg, #f7f7f7, var(--active-color));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  z-index: 2;
}

.fallback-hat {
  top: 12px;
  width: 0;
  height: 0;
  border-left: 48px solid transparent;
  border-right: 38px solid transparent;
  border-bottom: 90px solid #3a2b22;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.28));
  z-index: 4;
}

.fallback-hat::after {
  content: "";
  position: absolute;
  left: -42px;
  top: 74px;
  width: 84px;
  height: 14px;
  border-radius: 999px;
  background: #2d211b;
}

.fallback-beam {
  top: 78px;
  width: 14px;
  height: 170px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--active-color) 70%, white), transparent);
  opacity: 0;
  filter: blur(1px);
}

.fallback-halo {
  top: 210px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 4px solid color-mix(in srgb, var(--active-color) 75%, white);
  opacity: 0;
}

.fallback-character.reveal .fallback-beam {
  animation: beam-flash 1.5s ease;
}

.fallback-character.reveal .fallback-halo {
  animation: halo-expand 1.5s ease;
}

.sorting-stage canvas,
.presentation-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.guild-reveal-overlay {
  --reveal-color: #ffffff;
  --reveal-accent: #ffffff;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

.guild-reveal-overlay.is-active {
  animation: guild-reveal-fade 1.9s ease forwards;
}

.guild-reveal-panel {
  min-width: min(72%, 560px);
  padding: 1.4rem 1.8rem;
  border-radius: 1.8rem;
  text-align: center;
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--reveal-color) 48%, white);
  background:
    radial-gradient(circle at top, color-mix(in srgb, var(--reveal-accent) 26%, transparent), transparent 55%),
    linear-gradient(135deg, rgba(7, 16, 32, 0.9), rgba(16, 27, 48, 0.86));
  box-shadow:
    0 28px 90px color-mix(in srgb, var(--reveal-color) 24%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(18px);
  transform: scale(0.88) translateY(18px);
}

.guild-reveal-kicker {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--reveal-accent) 72%, white);
}

.guild-reveal-title {
  display: block;
  margin-top: 0.65rem;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-shadow: 0 0 28px color-mix(in srgb, var(--reveal-color) 28%, transparent);
}

.guild-reveal-subtitle {
  margin-top: 0.55rem;
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: rgba(255, 255, 255, 0.8);
}

.sorting-overlay {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.sorting-current {
  font-size: 1.3rem;
  font-weight: 800;
}

.sorting-queue {
  display: grid;
  gap: 0.8rem;
  max-height: 540px;
  overflow: auto;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(32, 45, 58, 0.07);
  transition: 0.2s ease;
}

.queue-item.is-active {
  transform: translateX(6px);
  border-color: rgba(26, 111, 99, 0.32);
  box-shadow: 0 14px 32px rgba(26, 111, 99, 0.12);
}

.queue-item.is-done {
  opacity: 0.55;
}

.house-panel {
  border: 1px solid color-mix(in srgb, var(--house-color) 22%, white);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: 0.25s ease;
}

.guild-profile-card {
  border: 1px solid color-mix(in srgb, var(--house-color) 22%, white);
}

.house-panel.is-active,
.presentation-house.is-active,
.guild-profile-card.is-active {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px color-mix(in srgb, var(--house-color) 22%, transparent);
}

.house-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--house-color);
  font-weight: 800;
}

.house-count,
.presentation-house-count {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--house-color), var(--house-accent));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--house-color) 28%, transparent);
}

.member-grid,
.presentation-member-list {
  display: grid;
  gap: 0.65rem;
}

.member-grid.compact,
.presentation-member-list {
  gap: 0.5rem;
}

.member-pill,
.presentation-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(32, 45, 58, 0.08);
}

.member-pill.is-pending-reveal,
.presentation-member.is-pending-reveal {
  display: none;
}

.member-pill small,
.presentation-member small {
  color: var(--muted);
}

.member-pill.is-captain,
.presentation-member.is-captain {
  border-color: color-mix(in srgb, var(--house-color) 45%, white);
  background: color-mix(in srgb, var(--house-color) 10%, white);
}

.member-pill.is-applicant,
.presentation-member.is-applicant {
  border-color: color-mix(in srgb, var(--house-accent) 45%, white);
}

.member-pill.is-reveal-target,
.presentation-member.is-reveal-target {
  border-color: color-mix(in srgb, var(--house-color) 70%, white);
  background: color-mix(in srgb, var(--house-color) 18%, white);
  box-shadow: 0 16px 36px color-mix(in srgb, var(--house-color) 26%, transparent);
  transform: translateX(4px);
}

.house-arrival-slot {
  display: grid;
  gap: 0.28rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(32, 45, 58, 0.08);
  transition: 0.24s ease;
}

.house-arrival-slot.is-active {
  border-color: color-mix(in srgb, var(--house-color) 58%, white);
  background: color-mix(in srgb, var(--house-color) 16%, rgba(255, 255, 255, 0.08));
  box-shadow: 0 18px 36px color-mix(in srgb, var(--house-color) 20%, transparent);
}

.arrival-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--house-accent) 70%, white);
}

.house-arrival-slot strong {
  font-size: 1.05rem;
}

.house-arrival-slot small {
  color: var(--muted);
}

.story-box {
  padding: 1rem 1.05rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(32, 45, 58, 0.08);
}

.story-box.compact {
  font-size: 0.95rem;
}

.team-stack,
.presentation-team-list {
  display: grid;
  gap: 0.85rem;
}

.team-card,
.presentation-team-card {
  padding: 0.9rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(32, 45, 58, 0.08);
}

.pulse-pop {
  animation: pulse-pop 0.65s ease;
}

@keyframes pulse-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.18); opacity: 1; }
}

@keyframes character-float {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, calc(-50% - 8px)); }
}

@keyframes beam-flash {
  0% { opacity: 0; transform: translateX(-50%) scaleY(0.6); }
  30% { opacity: 0.95; transform: translateX(-50%) scaleY(1); }
  100% { opacity: 0; transform: translateX(-50%) scaleY(1.12); }
}

@keyframes halo-expand {
  0% { opacity: 0.7; transform: translateX(-50%) scale(0.35); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.2); }
}

@keyframes guild-reveal-fade {
  0% { opacity: 0; }
  14% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes guild-reveal-panel-pop {
  0% { transform: scale(0.88) translateY(18px); }
  18% { transform: scale(1.02) translateY(0); }
  100% { transform: scale(1) translateY(-6px); }
}

.presentation-body {
  margin: 0;
  min-height: 100vh;
  color: #edf2f4;
  background:
    radial-gradient(circle at top, rgba(244, 162, 97, 0.18), transparent 22%),
    radial-gradient(circle at left, rgba(42, 157, 143, 0.16), transparent 24%),
    linear-gradient(180deg, #0b1320 0%, #14213d 100%);
}

.presentation-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.95fr);
}

.presentation-stage-wrap {
  padding: 2rem;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 1.25rem;
}

.presentation-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.presentation-topbar h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.8rem, 3vw, 3.1rem);
}

.presentation-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  font-weight: 800;
}

.presentation-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.presentation-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 1rem;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.presentation-btn.primary {
  background: linear-gradient(135deg, #e76f51, #f4a261);
  border-color: transparent;
}

.presentation-stage {
  min-height: 520px;
  border-radius: 1.8rem;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(20, 33, 61, 0.4), rgba(11, 19, 32, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.presentation-arrival-slot {
  margin: 0.85rem 0 1rem;
}

.presentation-house .house-arrival-slot {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.presentation-house .house-arrival-slot small {
  color: rgba(255, 255, 255, 0.72);
}

.presentation-guild-openings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.presentation-opening {
  padding: 1rem 1.05rem;
  border-radius: 1.2rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid color-mix(in srgb, var(--house-color) 34%, rgba(255, 255, 255, 0.18));
}

.presentation-opening p {
  margin: 0.7rem 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.presentation-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

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

.presentation-status div {
  padding: 1rem 1.1rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.presentation-status span {
  display: block;
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.66);
  margin-bottom: 0.45rem;
}

.presentation-status strong {
  font-size: 1.2rem;
}

.presentation-houses {
  padding: 2rem 2rem 2rem 0;
  display: grid;
  gap: 1rem;
  align-content: stretch;
}

.presentation-house {
  padding: 1.2rem;
  border-radius: 1.6rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  border: 1px solid color-mix(in srgb, var(--house-color) 38%, rgba(255, 255, 255, 0.1));
}

.presentation-house-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.presentation-house h2 {
  margin: 0.25rem 0 0;
}

.presentation-house p,
.small-line {
  color: rgba(255, 255, 255, 0.72);
}

.guild-reveal-overlay.is-active .guild-reveal-panel {
  animation: guild-reveal-panel-pop 1.9s cubic-bezier(0.2, 0.82, 0.22, 1) forwards;
}

@media (max-width: 1100px) {
  .presentation-shell {
    grid-template-columns: 1fr;
  }

  .presentation-houses {
    padding: 0 2rem 2rem;
  }

  .presentation-guild-openings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sorting-overlay,
  .presentation-status {
    grid-template-columns: 1fr;
  }

  .sorting-stage {
    min-height: 360px;
  }

  .presentation-stage {
    min-height: 360px;
  }

  .presentation-topbar {
    flex-direction: column;
  }
}
