:root {
  --ink: #071a33;
  --ink-soft: #16304f;
  --blue: #1769e8;
  --blue-dark: #0f4fb8;
  --sky: #8bd3ff;
  --coral: #ff624d;
  --coral-dark: #dc3f31;
  --cream: #f4f0e8;
  --paper: #fffdfa;
  --white: #fff;
  --muted: #697586;
  --line: rgba(7, 26, 51, 0.12);
  --shadow: 0 18px 48px rgba(7, 26, 51, 0.13);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  text-rendering: optimizeLegibility;
}

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

button,
select,
input[type="range"] {
  touch-action: manipulation;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

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

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.button {
  min-height: 48px;
  padding: 0.8rem 1.15rem;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button-primary {
  background: var(--coral);
  box-shadow: 0 9px 22px rgba(255, 98, 77, 0.25);
  color: var(--white);
}

.button-primary:hover:not(:disabled) {
  background: var(--coral-dark);
}

.button-secondary {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

.button-danger {
  background: #b9292c;
  color: var(--white);
}

.button-quiet {
  min-height: 40px;
  padding: 0.45rem 0.8rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.button-wide {
  width: 100%;
}

.icon-button,
.text-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.text-button {
  width: auto;
  color: var(--blue-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.boot-view {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 1rem;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.boot-view p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.boot-mark,
.wordmark-icon {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--coral);
  color: var(--white);
  font-style: italic;
  font-weight: 950;
  transform: skew(-8deg);
}

.boot-mark {
  width: 64px;
  height: 64px;
  margin: auto;
  border-radius: 19px 8px 19px 8px;
  box-shadow: 20px -12px 0 -10px var(--blue);
  font-size: 2rem;
  animation: boot-pulse 1.2s ease-in-out infinite alternate;
}

.boot-mark span,
.wordmark-icon {
  transform: skew(8deg);
}

@keyframes boot-pulse {
  to { transform: skew(-8deg) translateY(-5px); }
}

.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: max(1.2rem, env(safe-area-inset-top)) 1rem max(1.2rem, var(--safe-bottom));
  background:
    radial-gradient(circle at 92% 7%, rgba(23, 105, 232, 0.8) 0 13%, transparent 13.4%),
    linear-gradient(145deg, var(--ink) 0 65%, #0c2e5b 65% 100%);
}

.login-view::before,
.login-view::after {
  position: absolute;
  content: "";
  pointer-events: none;
  transform: rotate(-18deg);
}

.login-view::before {
  top: -20%;
  right: -12rem;
  width: 19rem;
  height: 58rem;
  border: 1px solid rgba(139, 211, 255, 0.22);
  border-radius: 50%;
}

.login-view::after {
  bottom: -4rem;
  left: -6rem;
  width: 14rem;
  height: 14rem;
  border: 2.5rem solid rgba(255, 98, 77, 0.1);
  border-radius: 50%;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 31rem);
  padding: 1rem 0.35rem;
  color: var(--white);
}

.login-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: clamp(3.6rem, 15vh, 7rem);
}

.brand-kicker {
  color: var(--sky);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  writing-mode: vertical-rl;
}

.brand-name {
  color: rgba(255, 255, 255, 0.12);
  font-size: 2.8rem;
  font-weight: 950;
  letter-spacing: -0.08em;
  line-height: 0.75;
  text-align: right;
}

.login-copy h1 {
  max-width: 10ch;
  margin: 0.55rem 0 1rem;
  font-size: clamp(2.7rem, 12vw, 4.5rem);
  font-weight: 950;
  letter-spacing: -0.07em;
  line-height: 0.91;
}

.login-lead {
  max-width: 31rem;
  margin: 0 0 2rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  line-height: 1.6;
}

.login-form > label {
  display: block;
  margin-bottom: 0.55rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
}

.password-row {
  display: grid;
  gap: 0.65rem;
}

.password-row input {
  width: 100%;
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  padding: 0 1rem;
  color: var(--white);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.password-row input:focus {
  border-color: var(--sky);
  background: rgba(255, 255, 255, 0.12);
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.2rem 0 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.72rem;
}

.privacy-note span {
  color: #6ee7a8;
  font-size: 0.55rem;
}

.form-message {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.error-message {
  border: 1px solid rgba(255, 98, 77, 0.35);
  background: rgba(255, 98, 77, 0.11);
  color: #8a2922;
}

.login-form .error-message {
  color: #ffb6ad;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: calc(62px + env(safe-area-inset-top));
  align-items: flex-end;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 1rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 26, 51, 0.96);
  backdrop-filter: blur(16px);
  color: var(--white);
}

.wordmark {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
}

.wordmark-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px 4px 10px 4px;
}

.wordmark > span:last-child {
  display: grid;
  line-height: 1;
}

.wordmark strong {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.wordmark small {
  margin-top: 0.2rem;
  color: var(--sky);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.topbar .icon-button {
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.topbar svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-main {
  padding-bottom: calc(6.5rem + var(--safe-bottom));
}

.hero {
  position: relative;
  min-height: 20rem;
  overflow: hidden;
  padding: 2.4rem 1.2rem 1.3rem;
  background:
    linear-gradient(130deg, rgba(23, 105, 232, 0.18), transparent 45%),
    var(--ink);
  color: var(--white);
}

.hero::after {
  position: absolute;
  right: -3.6rem;
  bottom: -7.6rem;
  width: 16rem;
  height: 22rem;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--coral), #ff9b70);
  content: "";
  transform: rotate(24deg);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-eyebrow {
  color: var(--sky);
}

.hero h1 {
  margin: 0.6rem 0 0.8rem;
  font-size: clamp(3.2rem, 15vw, 5.8rem);
  font-weight: 950;
  letter-spacing: -0.075em;
  line-height: 0.84;
}

.hero-copy > p:last-child {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.hero-stats {
  position: absolute;
  z-index: 3;
  right: 1.1rem;
  bottom: 1.1rem;
  left: 1.1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(7, 26, 51, 0.84);
  backdrop-filter: blur(12px);
}

.hero-stats div {
  display: grid;
  min-height: 66px;
  place-content: center;
  text-align: center;
}

.hero-stats div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-stats strong {
  font-size: 1.45rem;
  font-weight: 950;
  line-height: 1;
}

.hero-stats span {
  margin-top: 0.3rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-orbit {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(139, 211, 255, 0.2);
  border-radius: 50%;
  pointer-events: none;
}

.hero-orbit-one {
  top: -8rem;
  right: -7rem;
  width: 21rem;
  height: 21rem;
}

.hero-orbit-two {
  top: -2rem;
  right: -1rem;
  width: 9rem;
  height: 9rem;
}

.collection-section {
  min-height: 50vh;
}

.collection-toolbar {
  position: sticky;
  z-index: 15;
  top: calc(62px + env(safe-area-inset-top));
  padding: 0.8rem 1rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 232, 0.93);
  backdrop-filter: blur(14px);
}

.search-field {
  position: relative;
  display: flex;
  height: 48px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 15px;
  background: var(--white);
  box-shadow: 0 5px 16px rgba(7, 26, 51, 0.05);
}

.search-field:focus-within {
  border-color: var(--blue);
}

.search-field svg {
  width: 20px;
  margin-left: 0.9rem;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 0.5rem 0 0.7rem;
  font-size: 0.94rem;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.4rem;
}

.filter-row {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-top: 0.55rem;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.select-wrap {
  position: relative;
  flex: 0 0 auto;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 0.7rem;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.select-wrap select {
  min-height: 38px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  padding: 0 1.9rem 0 0.8rem;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

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

.entry-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(7, 26, 51, 0.08);
  border-radius: 19px;
  background: var(--paper);
  box-shadow: 0 7px 24px rgba(7, 26, 51, 0.06);
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}

.entry-card-button {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.card-photo,
.card-no-photo {
  width: 100%;
  aspect-ratio: 4 / 4.7;
}

.card-photo {
  height: auto;
  object-fit: cover;
  background: #e4e9ef;
}

.card-no-photo {
  position: relative;
  display: grid;
  place-content: center;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(139, 211, 255, 0.3), transparent 55%),
    var(--ink);
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(2.3rem, 13vw, 4rem);
  font-weight: 950;
  font-style: italic;
  text-transform: uppercase;
}

.card-no-photo::before,
.card-no-photo::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.card-no-photo::before {
  top: -32%;
  right: -40%;
  width: 85%;
  height: 85%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-no-photo::after {
  right: -16%;
  bottom: -25%;
  width: 70%;
  height: 70%;
  background: var(--coral);
}

.card-no-photo span {
  position: relative;
  z-index: 1;
}

.rank-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: grid;
  width: 44px;
  height: 44px;
  place-content: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 5px 15px rgba(7, 26, 51, 0.2);
  color: var(--white);
  font-size: 1rem;
  font-weight: 950;
}

.rank-badge small {
  font-size: 0.55rem;
  font-weight: 800;
}

.card-copy {
  padding: 0.82rem 0.8rem 0.9rem;
}

.card-copy h2 {
  display: -webkit-box;
  min-height: 2.3em;
  overflow: hidden;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.15;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
}

.card-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-dot::before {
  content: "·";
}

.state-card {
  width: min(calc(100% - 2rem), 34rem);
  margin: 1.2rem auto;
  padding: 2.5rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.state-card h2 {
  margin: 0.5rem 0;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.state-card p:not(.eyebrow) {
  max-width: 27rem;
  margin: 0.5rem auto 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.state-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: auto;
  place-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-weight: 900;
}

.empty-state {
  padding-top: 2rem;
}

.empty-can {
  position: relative;
  width: 70px;
  height: 116px;
  margin: 0 auto 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(160deg, var(--sky), var(--blue));
  box-shadow: 13px 10px 0 var(--coral);
  transform: rotate(7deg);
}

.empty-can::before,
.empty-can::after {
  position: absolute;
  left: 5px;
  width: 56px;
  height: 7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  content: "";
}

.empty-can::before { top: -4px; background: var(--paper); }
.empty-can::after { bottom: -4px; background: var(--blue); }

.empty-can span {
  position: absolute;
  top: 34px;
  right: 20px;
  width: 17px;
  height: 42px;
  background: var(--white);
  clip-path: polygon(55% 0, 100% 0, 54% 43%, 83% 43%, 0 100%, 35% 53%, 8% 53%);
}

.skeleton-grid {
  pointer-events: none;
}

.skeleton-card {
  height: 17rem;
  border-radius: 19px;
  background: linear-gradient(100deg, #e9e4dc 20%, #f9f6f1 40%, #e9e4dc 60%);
  background-size: 200% 100%;
  animation: shimmer 1.25s linear infinite;
}

@keyframes shimmer {
  to { background-position-x: -200%; }
}

.add-button {
  position: fixed;
  z-index: 25;
  right: 1rem;
  bottom: calc(0.9rem + var(--safe-bottom));
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 0 12px 32px rgba(7, 26, 51, 0.28);
  color: var(--white);
  cursor: pointer;
  padding: 0 1.25rem 0 1rem;
  font-weight: 900;
}

.add-button span {
  font-size: 1.35rem;
  font-weight: 500;
}

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(2, 13, 28, 0.72);
  backdrop-filter: blur(5px);
}

.sheet {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: none;
  max-height: calc(100dvh - 0.6rem);
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  padding: 0;
  box-shadow: var(--shadow);
}

.sheet[open] {
  animation: sheet-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(2rem); }
}

.sheet-handle {
  position: absolute;
  z-index: 3;
  top: 0.5rem;
  left: 50%;
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(7, 26, 51, 0.2);
  transform: translateX(-50%);
}

.sheet-close {
  position: absolute;
  z-index: 5;
  top: 0.85rem;
  right: 0.75rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  font-size: 1.7rem;
}

.editor-sheet > form {
  display: grid;
  max-height: calc(100dvh - 0.6rem);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.editor-header {
  display: grid;
  min-height: 80px;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  padding: 1.2rem 0.8rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.editor-header h2 {
  margin: 0.2rem 0 0;
  font-size: 1.25rem;
  letter-spacing: -0.035em;
}

.editor-header .eyebrow {
  font-size: 0.58rem;
}

.editor-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.15rem 1rem 2rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}

.field > span,
.ranking-field legend {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.field em {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  background: var(--white);
  padding: 0.85rem 0.9rem;
  font-size: 1rem;
}

.field input {
  min-height: 50px;
}

.field textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 232, 0.11);
}

.field-prominent input {
  min-height: 58px;
  font-size: 1.1rem;
  font-weight: 750;
}

.field-error {
  min-height: 0;
  color: #a22b2f;
  font-size: 0.72rem;
}

.field-error:empty {
  display: none;
}

.ranking-field {
  min-width: 0;
  margin: 0 0 1.2rem;
  padding: 0;
  border: 0;
}

.ranking-field legend {
  width: 100%;
  margin-bottom: 0.65rem;
}

.ranking-field legend span {
  float: right;
  color: var(--muted);
  font-weight: 650;
}

.ranking-control {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  border-radius: 17px;
  background: var(--ink);
  padding: 0.8rem 0.9rem;
  color: var(--white);
}

.ranking-control output {
  font-size: 2.45rem;
  font-weight: 950;
  text-align: center;
}

.ranking-slider input {
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
}

.ranking-slider input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--sky), var(--coral));
}

.ranking-slider input::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  margin-top: -10px;
  appearance: none;
  border: 4px solid var(--white);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.28);
}

.ranking-slider input::-moz-range-track {
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--sky), var(--coral));
}

.ranking-slider input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 4px solid var(--white);
  border-radius: 50%;
  background: var(--coral);
}

.ranking-ends {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.58rem;
  font-weight: 750;
}

.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 0.7rem;
}

.photo-field {
  margin-top: 0.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.field-heading,
.suggestions-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.field-heading h3,
.suggestions-heading h4 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.025em;
}

.field-heading p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.field-heading > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.photo-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.photo-action {
  display: flex;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  text-align: left;
}

.photo-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.photo-action svg {
  width: 28px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.photo-action span {
  display: grid;
  gap: 0.15rem;
}

.photo-action strong {
  font-size: 0.85rem;
}

.photo-action small {
  color: var(--muted);
  font-size: 0.68rem;
}

.photo-preview {
  position: relative;
  overflow: hidden;
  margin-top: 0.85rem;
  border-radius: 18px;
  background: var(--ink);
}

.photo-preview img {
  width: 100%;
  max-height: 25rem;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.photo-preview-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0.75rem 0.7rem;
  background: linear-gradient(transparent, rgba(2, 13, 28, 0.8));
  color: var(--white);
}

.photo-preview-overlay p {
  margin: 0;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-source {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  max-width: calc(100% - 1.3rem);
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.38rem 0.65rem;
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-status {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  border-radius: 15px;
  background: rgba(23, 105, 232, 0.07);
  color: var(--blue-dark);
}

.inline-status p {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 750;
}

.spinner {
  display: inline-block;
  width: 19px;
  height: 19px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 650ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.suggestions-panel {
  margin-top: 0.9rem;
  padding: 0.85rem;
  border: 1px solid rgba(23, 105, 232, 0.2);
  border-radius: 17px;
  background: rgba(139, 211, 255, 0.09);
}

.provider-note {
  margin: 0.4rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

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

.suggestion {
  min-width: 0;
}

.suggestion-button {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--white);
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.suggestion-button[aria-pressed="true"] {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 232, 0.13);
}

.suggestion-button[aria-pressed="true"]::after {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  display: grid;
  width: 23px;
  height: 23px;
  place-content: center;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  content: "✓";
  font-size: 0.72rem;
  font-weight: 900;
}

.suggestion-button img,
.suggestion-skeleton {
  width: 100%;
  aspect-ratio: 1 / 1.18;
  object-fit: contain;
  background: var(--white);
}

.suggestion-button strong {
  display: -webkit-box;
  min-height: 3.2em;
  overflow: hidden;
  padding: 0.45rem;
  font-size: 0.66rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.suggestion a {
  display: block;
  margin-top: 0.25rem;
  color: var(--blue-dark);
  font-size: 0.57rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.suggestion-skeleton {
  border-radius: 12px;
  background: linear-gradient(100deg, #e6ecf4 20%, #fff 40%, #e6ecf4 60%);
  background-size: 200% 100%;
  animation: shimmer 1.25s linear infinite;
}

.photo-field > .error-message {
  margin: 0.75rem 0 0;
}

.editor-footer {
  padding: 0.75rem 1rem calc(0.75rem + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.97);
  box-shadow: 0 -8px 24px rgba(7, 26, 51, 0.05);
}

.button-spinner {
  vertical-align: middle;
}

.detail-sheet {
  overflow-y: auto;
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.detail-photo,
.detail-no-photo {
  width: 100%;
  max-height: 46vh;
  aspect-ratio: 4 / 3.4;
}

.detail-photo {
  object-fit: contain;
  background: var(--ink);
}

.detail-no-photo {
  display: grid;
  place-content: center;
  background: linear-gradient(145deg, var(--ink), #164f91);
  color: rgba(255, 255, 255, 0.18);
  font-size: 7rem;
  font-style: italic;
  font-weight: 950;
}

.detail-body {
  position: relative;
  padding: 1.15rem 1rem 0;
}

.detail-score {
  position: absolute;
  top: -2.25rem;
  right: 1rem;
  display: grid;
  width: 70px;
  height: 70px;
  place-content: center;
  border: 4px solid var(--paper);
  border-radius: 50%;
  background: var(--coral);
  color: var(--white);
  font-size: 1.65rem;
  font-weight: 950;
}

.detail-score small {
  font-size: 0.68rem;
}

.detail-body h2 {
  max-width: calc(100% - 5rem);
  margin: 0.3rem 0 0.6rem;
  font-size: 1.8rem;
  letter-spacing: -0.055em;
  line-height: 1;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.detail-meta span {
  border-radius: 999px;
  background: rgba(7, 26, 51, 0.06);
  padding: 0.45rem 0.65rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 750;
}

.detail-notes {
  margin: 0 0 1rem;
  padding: 1rem;
  border-left: 3px solid var(--blue);
  border-radius: 0 14px 14px 0;
  background: rgba(23, 105, 232, 0.06);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.detail-source {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--blue-dark);
  font-size: 0.68rem;
  font-weight: 750;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.delete-entry-button {
  width: 48px;
  padding: 0;
  border: 1px solid rgba(185, 41, 44, 0.2);
  background: rgba(185, 41, 44, 0.06);
  color: #a32428;
  font-size: 1.2rem;
}

.confirm-dialog {
  width: min(calc(100% - 2rem), 25rem);
  border: 0;
  border-radius: 22px;
  background: var(--paper);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 0.8rem;
  place-content: center;
  border-radius: 50%;
  background: rgba(185, 41, 44, 0.1);
  color: #a32428;
  font-size: 1.5rem;
  font-weight: 800;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1.35rem;
}

.confirm-dialog p {
  margin: 0.6rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.toast-region {
  position: fixed;
  z-index: 1000;
  right: 1rem;
  bottom: calc(5rem + var(--safe-bottom));
  left: 1rem;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: 28rem;
  border-radius: 13px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: var(--white);
  padding: 0.8rem 1rem;
  font-size: 0.82rem;
  font-weight: 750;
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
}

@media (min-width: 620px) {
  .password-row {
    grid-template-columns: 1fr auto;
  }

  .login-button {
    min-width: 9.5rem;
  }

  .hero {
    min-height: 22rem;
    padding-right: max(2rem, calc((100vw - 72rem) / 2));
    padding-left: max(2rem, calc((100vw - 72rem) / 2));
  }

  .hero-stats {
    right: max(2rem, calc((100vw - 72rem) / 2));
    left: auto;
    width: 22rem;
  }

  .collection-toolbar,
  .card-grid {
    padding-right: max(1.25rem, calc((100vw - 72rem) / 2));
    padding-left: max(1.25rem, calc((100vw - 72rem) / 2));
  }

  .collection-toolbar {
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
  }

  .filter-row {
    padding-top: 0;
  }

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

  .sheet {
    inset: 50% auto auto 50%;
    width: min(calc(100% - 2rem), 42rem);
    max-height: min(92dvh, 54rem);
    border-radius: 24px;
    transform: translate(-50%, -50%);
  }

  .sheet[open] {
    animation: modal-in 160ms ease-out;
  }

  @keyframes modal-in {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }
  }

  .editor-sheet > form {
    max-height: min(92dvh, 54rem);
  }

  .editor-body,
  .detail-body {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
  }

  .photo-actions {
    grid-template-columns: 1fr 1fr;
  }

  .add-button {
    right: max(1.5rem, calc((100vw - 72rem) / 2));
  }
}

@media (min-width: 960px) {
  .topbar {
    padding-right: max(2rem, calc((100vw - 72rem) / 2));
    padding-left: max(2rem, calc((100vw - 72rem) / 2));
  }

  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .entry-card {
    transition: transform 150ms ease, box-shadow 150ms ease;
  }

  .entry-card:hover {
    box-shadow: 0 16px 36px rgba(7, 26, 51, 0.12);
    transform: translateY(-3px);
  }
}

@media (min-width: 1200px) {
  .card-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
