:root {
  color-scheme: light;
  --bg-top: #fff3f5;
  --bg-mid: #ffe4d8;
  --bg-bottom: #ffd1d9;
  --panel: rgba(255, 251, 252, 0.78);
  --panel-strong: rgba(255, 247, 249, 0.92);
  --panel-border: rgba(123, 31, 69, 0.12);
  --text: #331321;
  --muted: #7a5868;
  --accent: #ff5c8a;
  --accent-strong: #ff7b54;
  --accent-deep: #b82f5c;
  --accent-soft: rgba(255, 92, 138, 0.1);
  --shadow: 0 24px 60px rgba(141, 46, 85, 0.16);
  --shadow-strong: 0 30px 80px rgba(141, 46, 85, 0.22);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at 10% 10%,
      rgba(255, 255, 255, 0.95),
      transparent 28%
    ),
    radial-gradient(
      circle at 90% 0%,
      rgba(255, 171, 196, 0.45),
      transparent 24%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(255, 123, 84, 0.26),
      transparent 30%
    ),
    linear-gradient(
      180deg,
      var(--bg-top) 0%,
      var(--bg-mid) 50%,
      var(--bg-bottom) 100%
    );
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 18px 22px;
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  background: rgba(255, 250, 251, 0.72);
  box-shadow: 0 14px 30px rgba(141, 46, 85, 0.08);
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.brand-dot {
  width: 16px;
  height: 16px;
  margin-top: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 0 8px rgba(255, 92, 138, 0.11);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--accent-deep);
}

.brand-title {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 0.95;
}

.brand-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
  align-content: start;
}

.guest-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  max-width: 420px;
}

.guest-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 92, 138, 0.12);
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guest-copy {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: right;
}

.nav-link {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(123, 31, 69, 0.12);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  cursor: pointer;
}

.nav-link.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  border-color: transparent;
}

.nav-link-quiet {
  background: rgba(255, 240, 244, 0.85);
}

.status-message {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 92, 138, 0.11);
  color: var(--accent-deep);
}

.status-message[data-message-type="success"] {
  background: rgba(236, 253, 245, 0.95);
  color: #166534;
  border: 1px solid rgba(22, 101, 52, 0.12);
  box-shadow: 0 10px 20px rgba(22, 101, 52, 0.08);
}

.status-message[data-message-type="warning"] {
  background: rgba(255, 247, 237, 0.95);
  color: #9a3412;
  border: 1px solid rgba(154, 52, 18, 0.12);
  box-shadow: 0 10px 20px rgba(154, 52, 18, 0.08);
}

.app-page {
  position: relative;
  animation: pageFade 180ms ease;
}

@keyframes pageFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-card,
.panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.page-card {
  padding: 26px;
}

.page-card-wide {
  max-width: 920px;
  margin: 0 auto;
}

.page-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}

.panel {
  padding: 24px;
}

.page-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: var(--radius);
  background: rgba(255, 246, 248, 0.76);
  backdrop-filter: blur(3px);
}

.page-lock-card {
  width: min(100%, 360px);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(123, 31, 69, 0.12);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 36px rgba(141, 46, 85, 0.14);
  text-align: center;
}

.page-lock-card h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.5rem;
}

.page-lock-card p {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.page-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.9rem;
}

.page-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.page-heading-compact {
  margin-top: 12px;
}

.page-heading-compact h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.35rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.auth-form,
.signed-in-card {
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(123, 31, 69, 0.08);
}

.auth-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.auth-form h3,
.signed-in-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.auth-helper {
  margin: -4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-captcha {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(123, 31, 69, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

.auth-captcha .auth-helper {
  margin: 0;
}

.stack-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.signed-in-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 20px;
}

.signed-in-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.95rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(123, 31, 69, 0.13);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.field input[type="file"] {
  padding: 10px 12px;
  font-size: 0.92rem;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.helper-text {
  margin: -4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.field input[readonly] {
  background: rgba(245, 232, 236, 0.9);
  color: var(--muted);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(255, 92, 138, 0.18);
  border-color: rgba(255, 92, 138, 0.45);
}

.primary-button,
.secondary-button {
  padding: 14px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 16px 28px rgba(255, 92, 138, 0.28);
}

.secondary-button {
  border: 1px solid rgba(123, 31, 69, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.stack-form .primary-button,
.stack-form .secondary-button {
  width: 100%;
}

.primary-button:hover,
.secondary-button:hover,
.nav-link:hover,
.vote-button:hover {
  transform: translateY(-1px);
}

.preview-card {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(123, 31, 69, 0.12);
  background: rgba(255, 255, 255, 0.84);
}

.preview-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.empty-state {
  margin-top: 20px;
  padding: 18px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.matchup-board {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
}

.spark-instruction {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.spark-filter-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(123, 31, 69, 0.09);
  background: rgba(255, 250, 251, 0.72);
}

.filter-dropdown {
  margin: 0;
}

.filter-dropdown-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 31, 69, 0.12);
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-dropdown-summary::-webkit-details-marker {
  display: none;
}

.filter-dropdown-caret {
  font-size: 0.85rem;
  color: var(--accent-deep);
  transition: transform 180ms ease;
}

.filter-dropdown[open] .filter-dropdown-caret {
  transform: rotate(180deg);
}

.spark-filter-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.spark-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.spark-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(123, 31, 69, 0.12);
  cursor: pointer;
}

.spark-filter-option input {
  margin: 0;
}

.photo-card {
  display: grid;
  gap: 16px;
  position: relative;
  padding: 18px;
  border-radius: 34px;
  border: 1px solid rgba(123, 31, 69, 0.11);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.92),
    rgba(255, 242, 245, 0.9)
  );
  box-shadow: 0 20px 44px rgba(141, 46, 85, 0.12);
  overflow: hidden;
}

.spark-card-shell {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.spark-card-glow {
  position: absolute;
  inset: auto -30px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 123, 84, 0.2), transparent 68%);
}

.vote-button {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 28px;
  overflow: hidden;
  cursor: pointer;
  background: #f6dce2;
  box-shadow: 0 20px 42px rgba(141, 46, 85, 0.18);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.vote-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(43, 16, 29, 0.05) 0%,
      rgba(43, 16, 29, 0.05) 45%,
      rgba(43, 16, 29, 0.72) 100%
    ),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 42%);
}

.vote-button img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transform: scale(1.01);
}

.vote-button:hover,
.vote-button:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 28px 48px rgba(141, 46, 85, 0.24);
  filter: saturate(1.04);
}

.vote-button:focus-visible {
  outline: 3px solid rgba(255, 92, 138, 0.22);
  outline-offset: 4px;
}

.photo-meta {
  display: grid;
  gap: 8px;
  padding: 2px 4px 2px;
}

.photo-meta-row {
  position: relative;
  min-height: 2rem;
  padding-right: 150px;
}

.photo-meta-copy {
  min-width: 0;
}

.photo-meta h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  line-height: 1.05;
}

.photo-meta p {
  margin: 8px 0 0;
  color: var(--accent-deep);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
}

.photo-meta p:empty {
  display: none;
}

.rating-feedback {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 132px;
  min-width: 132px;
  min-height: 2rem;
  margin: 0;
  text-align: right;
  font-size: clamp(1.35rem, 2vw, 1.7rem) !important;
  font-weight: 800 !important;
  line-height: 1.05;
  letter-spacing: -0.04em;
  display: block;
}

.rating-feedback:empty {
  display: block;
  visibility: hidden;
}

.rating-feedback[data-result="winner"] {
  color: #15803d;
}

.rating-feedback[data-result="loser"] {
  color: #b91c1c;
}

.versus-badge {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.94),
    rgba(255, 237, 242, 0.95)
  );
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.16em;
  box-shadow: 0 16px 36px rgba(141, 46, 85, 0.14);
  border: 1px solid rgba(123, 31, 69, 0.09);
}

.rankings-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(64px, 100%), 1fr));
  gap: 18px;
  margin-top: 24px;
  padding: 24px 18px 16px;
  border: 1px solid rgba(123, 31, 69, 0.09);
  border-radius: 24px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.72),
      rgba(255, 245, 248, 0.82)
    ),
    repeating-linear-gradient(
      to top,
      rgba(123, 31, 69, 0.05) 0,
      rgba(123, 31, 69, 0.05) 1px,
      transparent 1px,
      transparent 44px
    );
  box-shadow: inset 0 -1px 0 rgba(123, 31, 69, 0.08);
  min-height: 340px;
  overflow: hidden;
}

.rankings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: stretch;
  margin-top: 24px;
}

.rankings-chart-panel {
  min-width: 0;
  display: grid;
  align-content: start;
}

.rankings-calculator {
  display: grid;
  gap: 12px;
  padding: 18px;
  align-content: start;
}

.rankings-row {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  justify-items: center;
  align-items: end;
  min-height: 300px;
  min-width: 0;
}

.rankings-label {
  color: var(--accent-deep);
  font-size: clamp(0.72rem, 1vw, 0.88rem);
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  min-height: 1.2em;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  white-space: nowrap;
}

.rankings-column {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 0;
}

.rankings-bar {
  width: min(100%, 52px);
  border-radius: 18px 18px 10px 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow:
    0 14px 24px rgba(141, 46, 85, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.rankings-count {
  min-width: 36px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(123, 31, 69, 0.08);
  color: var(--text);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 14px rgba(141, 46, 85, 0.08);
}

.rankings-result {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(123, 31, 69, 0.1);
  color: var(--muted);
  line-height: 1.5;
}

.rankings-result[data-tone="success"] {
  color: #17603c;
  background: rgba(236, 253, 245, 0.92);
  border-color: rgba(21, 128, 61, 0.16);
}

.rankings-result[data-tone="warning"] {
  color: #8a4b11;
  background: rgba(255, 247, 237, 0.92);
  border-color: rgba(194, 120, 3, 0.16);
}

.rankings-hot-panel {
  margin-top: 18px;
}

.hot-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hot-filter-button {
  padding: 10px 14px;
  border: 1px solid rgba(123, 31, 69, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  cursor: pointer;
}

.hot-filter-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(141, 46, 85, 0.16);
}

.hot-photos-table th:nth-child(1),
.hot-photos-table td:nth-child(1) {
  width: 112px;
}

.hot-photo-thumbnail {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 10px 20px rgba(141, 46, 85, 0.14);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

.hot-photos-table {
  width: 100%;
  table-layout: fixed;
}

.hot-photos-table td:nth-child(2),
.hot-photos-table th:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-grid {
  grid-template-columns: 340px 1fr;
}

.messages-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.messages-heading-copy {
  min-width: 0;
}

.messages-avatar-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.messages-avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid rgba(123, 31, 69, 0.14);
  box-shadow: 0 12px 20px rgba(141, 46, 85, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.match-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.match-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(123, 31, 69, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(141, 46, 85, 0.08);
}

.match-card.active {
  border-color: rgba(255, 92, 138, 0.35);
  background: linear-gradient(
    135deg,
    rgba(255, 244, 247, 0.96),
    rgba(255, 237, 228, 0.94)
  );
  box-shadow: 0 18px 28px rgba(141, 46, 85, 0.12);
}

.match-card-thumbnail-wrap {
  position: relative;
  flex: 0 0 56px;
}

.match-card-thumbnail {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(123, 31, 69, 0.1);
  background: rgba(255, 255, 255, 0.88);
}

.match-card-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 8px 14px rgba(141, 46, 85, 0.18);
}

.match-card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.match-card-name {
  font-size: 1rem;
}

.match-card-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.match-card-preview {
  color: var(--accent-deep);
  font-size: 0.92rem;
  line-height: 1.4;
}

.message-thread {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 6px;
}

.message-bubble {
  width: min(100%, 460px);
  padding: 14px 16px;
  border-radius: 22px 22px 22px 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(123, 31, 69, 0.09);
  box-shadow: 0 10px 20px rgba(141, 46, 85, 0.08);
}

.message-bubble.mine {
  justify-self: end;
  border-radius: 22px 22px 8px 22px;
  background: linear-gradient(
    135deg,
    rgba(255, 232, 239, 0.98),
    rgba(255, 241, 231, 0.96)
  );
}

.message-bubble-author,
.message-bubble-body,
.message-bubble-time {
  margin: 0;
}

.message-bubble-author {
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.message-bubble-body {
  margin-top: 8px;
  line-height: 1.5;
}

.message-bubble-time {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.message-form {
  margin-top: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(123, 31, 69, 0.09);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.photo-meta-form {
  display: block;
}

.photo-meta-input,
.photo-subject-type-select {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid rgba(123, 31, 69, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.photo-meta-input[readonly] {
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  cursor: text;
}

.photo-meta-input:focus,
.photo-subject-type-select:focus {
  outline: 2px solid rgba(255, 92, 138, 0.18);
  border-color: rgba(255, 92, 138, 0.45);
}

.table-thumbnail {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(141, 46, 85, 0.14);
}

.thumbnail-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.table-wrap th:nth-child(1),
.table-wrap td:nth-child(1) {
  width: 88px;
}

.table-wrap th:nth-child(2),
.table-wrap td:nth-child(2) {
  width: 128px;
}

.table-wrap th:nth-child(3),
.table-wrap td:nth-child(3) {
  width: 180px;
}

.table-wrap th:nth-child(4),
.table-wrap td:nth-child(4) {
  width: 90px;
}

.table-wrap th:nth-child(5),
.table-wrap td:nth-child(5) {
  width: 110px;
}

.table-wrap th:nth-child(6),
.table-wrap td:nth-child(6) {
  width: 82px;
}

.table-wrap th:nth-child(7),
.table-wrap td:nth-child(7) {
  width: 100px;
}

.rating-cell {
  white-space: nowrap;
  font-weight: 700;
}

.action-cell {
  white-space: nowrap;
}

.delete-photo-button {
  padding: 10px 14px;
  color: #8d1f44;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 12, 24, 0.72);
  backdrop-filter: blur(6px);
}

.image-viewer-dialog {
  position: relative;
  z-index: 1;
  width: min(90vw, 760px);
  max-height: 90vh;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 248, 250, 0.96);
  box-shadow: var(--shadow-strong);
}

.image-viewer-dialog img {
  width: 100%;
  max-height: calc(90vh - 80px);
  border-radius: 20px;
  object-fit: contain;
}

.image-viewer-close {
  display: inline-flex;
  margin: 0 0 12px auto;
  padding: 10px 14px;
  border: 1px solid rgba(123, 31, 69, 0.12);
  border-radius: 999px;
  background: white;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .topbar,
  .signed-in-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar {
    gap: 10px;
    padding: 14px 16px;
  }

  .brand-mark {
    gap: 12px;
  }

  .brand-dot {
    width: 14px;
    height: 14px;
    margin-top: 8px;
    box-shadow: 0 0 0 6px rgba(255, 92, 138, 0.1);
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
  }

  .brand-title {
    font-size: 2rem;
  }

  .brand-subtitle {
    margin-top: 6px;
    font-size: 0.92rem;
  }

  .page-grid,
  .matchup-board,
  .rankings-layout {
    grid-template-columns: 1fr;
  }

  .matchup-board {
    margin-top: 12px;
    gap: 10px;
  }

  .spark-filter-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .spark-filter-option {
    justify-content: center;
    padding: 9px 12px;
  }

  .photo-card {
    gap: 10px;
    padding: 12px;
    border-radius: 24px;
  }

  .vote-button {
    border-radius: 22px;
  }

  .vote-button img {
    aspect-ratio: 16 / 6;
  }

  .photo-meta {
    padding: 0 2px;
  }

  .photo-meta-row {
    min-height: 1.6rem;
    padding-right: 112px;
  }

  .photo-meta h3 {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rating-feedback {
    width: 98px;
    min-width: 98px;
    min-height: 1.6rem;
    font-size: 1.2rem !important;
  }

  .versus-badge {
    justify-self: center;
    width: 48px;
    height: 48px;
    font-size: 0.7rem;
  }

  .app-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .app-nav::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions {
    display: grid;
    gap: 6px;
    width: 100%;
  }

  .guest-banner {
    justify-content: flex-start;
    max-width: none;
    gap: 6px;
  }

  .guest-copy {
    text-align: left;
    font-size: 0.85rem;
  }

  .guest-badge {
    padding: 7px 10px;
    font-size: 0.74rem;
  }

  .nav-link {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 0.84rem;
    text-align: center;
  }
}

@media (max-width: 640px) {
  [data-page="rankings"] .page-card {
    padding: 12px;
  }

  [data-page="spark"] .page-card {
    padding: 12px;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
    padding: 16px 0 24px;
  }

  .topbar,
  .page-card,
  .panel {
    padding: 16px;
  }

  .brand-title {
    font-size: 1.36rem;
  }

  .brand-subtitle {
    margin-top: 4px;
    font-size: 0.76rem;
  }

  .page-heading h2 {
    font-size: 1.34rem;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 0.58rem;
  }

  .topbar {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 22px;
  }

  .topbar-actions {
    gap: 4px;
  }

  [data-page="profile"] .page-heading p {
    margin-top: 6px;
  }

  [data-page="profile"] .signed-in-card {
    margin-top: 14px;
    padding: 14px;
    gap: 8px;
    border-radius: 18px;
  }

  [data-page="profile"] .signed-in-label {
    margin-bottom: 4px;
    font-size: 0.7rem;
  }

  [data-page="profile"] #session-email {
    font-size: 1rem;
    line-height: 1.3;
  }

  [data-page="profile"] .stack-form {
    gap: 12px;
    margin-top: 14px;
  }

  [data-page="profile"] .field {
    gap: 6px;
  }

  [data-page="profile"] .field span {
    font-size: 0.86rem;
  }

  [data-page="profile"] .field input,
  [data-page="profile"] .field select {
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.94rem;
  }

  [data-page="profile"] .field-inline-mobile {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  [data-page="profile"] .field-inline-mobile span {
    margin: 0;
  }

  [data-page="profile"] .field-inline-mobile input {
    width: 100%;
  }

  [data-page="profile"] .primary-button {
    padding: 12px 16px;
    font-size: 0.94rem;
  }

  .nav-link {
    padding: 6px 9px;
    font-size: 0.76rem;
  }

  .app-nav {
    gap: 4px;
  }

  .spark-filter-panel {
    margin-top: 8px;
    padding: 7px 8px;
  }

  .filter-dropdown-summary {
    padding: 7px 9px;
    border-radius: 14px;
    font-size: 0.78rem;
  }

  .spark-filter-label {
    margin-bottom: 5px;
    font-size: 0.74rem;
  }

  .spark-filter-options {
    gap: 6px;
    margin-top: 8px;
  }

  .spark-filter-option {
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .matchup-board {
    margin-top: 8px;
    gap: 6px;
  }

  .photo-card {
    gap: 6px;
    padding: 8px 8px 5px;
    border-radius: 18px;
  }

  .vote-button {
    border-radius: 16px;
  }

  .vote-button img {
    aspect-ratio: 16 / 16;
    object-position: center 22%;
  }

  .photo-meta h3 {
    font-size: 0.9rem;
  }

  .photo-meta-row {
    min-height: 1.25rem;
    padding-right: 76px;
  }

  .rating-feedback {
    width: 68px;
    min-width: 68px;
    min-height: 1.25rem;
    font-size: 0.96rem !important;
  }

  .versus-badge {
    width: 34px;
    height: 34px;
    font-size: 0.56rem;
    letter-spacing: 0.1em;
  }

  .table-wrap table {
    min-width: 0;
  }

  [data-page="photos"] .page-grid {
    gap: 12px;
  }

  [data-page="photos"] .stack-form {
    gap: 12px;
    margin-top: 16px;
  }

  [data-page="photos"] .field {
    gap: 6px;
  }

  [data-page="photos"] .field span,
  [data-page="photos"] .helper-text {
    font-size: 0.86rem;
  }

  [data-page="photos"] .field input,
  [data-page="photos"] .field select {
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.92rem;
  }

  [data-page="photos"] .field input[type="file"] {
    padding: 9px 10px;
    font-size: 0.82rem;
  }

  [data-page="photos"] .primary-button {
    padding: 12px 16px;
    font-size: 0.94rem;
  }

  [data-page="photos"] .table-wrap {
    overflow-x: visible;
    margin-top: 14px;
  }

  [data-page="photos"] .table-wrap thead {
    display: none;
  }

  [data-page="photos"] .table-wrap table,
  [data-page="photos"] .table-wrap tbody,
  [data-page="photos"] .table-wrap tr,
  [data-page="photos"] .table-wrap td {
    display: block;
    width: 100%;
  }

  [data-page="photos"] .table-wrap tr {
    padding: 12px;
    border: 1px solid rgba(123, 31, 69, 0.09);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 22px rgba(141, 46, 85, 0.08);
  }

  [data-page="photos"] .table-wrap tr + tr {
    margin-top: 10px;
  }

  [data-page="photos"] .table-wrap td {
    padding: 0;
    border: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }

  [data-page="photos"] .table-wrap td + td {
    margin-top: 10px;
  }

  [data-page="photos"] .table-wrap td::before {
    content: attr(data-label);
    display: inline;
    margin-right: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
  }

  [data-page="photos"] .table-wrap td:first-child::before {
    display: none;
  }

  [data-page="photos"] .photo-meta-form {
    display: inline;
  }

  [data-page="photos"] .thumbnail-button {
    display: block;
    width: fit-content;
  }

  [data-page="photos"] .table-thumbnail {
    width: 68px;
    height: 68px;
    border-radius: 16px;
  }

  [data-page="photos"] .photo-subject-type-select,
  [data-page="photos"] .photo-meta-input {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  [data-page="photos"] .photo-meta-input[readonly] {
    width: auto;
    min-width: 0;
    border: 0;
    background: transparent;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.94rem;
    display: inline;
    vertical-align: baseline;
  }

  [data-page="photos"] .rating-cell {
    font-size: 1rem;
  }

  [data-page="photos"] .action-cell .secondary-button {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .rankings-layout {
    gap: 10px;
    margin-top: 12px;
  }

  .rankings-chart {
    grid-template-columns: repeat(auto-fit, minmax(26px, 1fr));
    gap: 8px;
    margin-top: 12px;
    padding: 14px 8px 10px;
    border-radius: 18px;
  }

  .rankings-chart-panel,
  .rankings-calculator {
    padding: 14px;
  }

  .rankings-calculator {
    gap: 10px;
  }

  .rankings-row {
    min-height: 170px;
    gap: 5px;
  }

  .rankings-column {
    gap: 6px;
  }

  .rankings-bar {
    width: min(100%, 24px);
    border-radius: 12px 12px 8px 8px;
  }

  .rankings-count {
    min-width: 0;
    padding: 4px 5px;
    font-size: 0.66rem;
  }

  .rankings-label {
    font-size: 0.54rem;
    letter-spacing: -0.01em;
  }

  .rankings-result {
    padding: 12px;
    border-radius: 16px;
    font-size: 0.9rem;
  }

  .hot-filter-buttons {
    gap: 6px;
    margin-top: 12px;
  }

  .hot-filter-button {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .hot-photos-table {
    width: 100%;
    table-layout: fixed;
  }

  .hot-photos-table th,
  .hot-photos-table td {
    padding: 8px 6px;
    font-size: 0.74rem;
  }

  .hot-photos-table th:nth-child(1),
  .hot-photos-table td:nth-child(1) {
    width: 56px;
  }

  .hot-photos-table th:nth-child(2),
  .hot-photos-table td:nth-child(2) {
    width: 110px;
  }

  .hot-photos-table th:nth-child(3),
  .hot-photos-table td:nth-child(3) {
    width: 34px;
  }

  .hot-photos-table th:nth-child(4),
  .hot-photos-table td:nth-child(4) {
    width: 48px;
  }

  .hot-photos-table th:nth-child(5),
  .hot-photos-table td:nth-child(5) {
    width: 52px;
  }

  .hot-photo-thumbnail {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }
}
