/* Design tokens */
:root {
  --bg: #f3f3f1;
  --card: #ffffff;
  --line: rgba(0, 0, 0, 0.18);
  --line-strong: rgba(0, 0, 0, 0.55);
  --text: #090909;
  --muted: #4e4e4e;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.05);
}

/* Base */
* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background: #fff;
}

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

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

button,
.upload-button {
  border: 2px solid #111;
  border-radius: 6px;
  padding: 0.55rem 1rem;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.18s ease,
    background 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease,
    box-shadow 0.22s ease;
}

button:hover,
.upload-button:hover {
  transform: translateY(-1px);
  background: #222;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:disabled,
.upload-button.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  background: #fff;
  color: var(--text);
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease,
    color 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #111;
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
  background: #fcfcfc;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 3.2rem;
  transition:
    border-color 0.28s ease,
    box-shadow 0.32s ease,
    background-color 0.28s ease,
    transform 0.24s ease;
}

select:focus {
  outline: none;
}

.select-shell {
  position: relative;
  display: block;
  transform: translateY(0);
  transition:
    transform 0.24s ease,
    filter 0.28s ease,
    box-shadow 0.32s ease;
}

.select-shell::before,
.select-shell::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 11px;
  height: 2px;
  background: #111;
  transform-origin: center;
  transition: transform 0.3s ease, background-color 0.28s ease;
  pointer-events: none;
}

.select-shell::before {
  transform: translateY(-2px) rotate(45deg);
}

.select-shell::after {
  right: 9px;
  transform: translateY(-2px) rotate(-45deg);
}

.select-shell:focus-within,
.select-shell.is-opening {
  transform: translateY(-1px);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.08));
}

.select-shell:focus-within::before,
.select-shell.is-opening::before {
  background: #000;
  transform: translateY(2px) rotate(-45deg);
}

.select-shell:focus-within::after,
.select-shell.is-opening::after {
  background: #000;
  transform: translateY(2px) rotate(45deg);
}

.select-shell select:focus {
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
  background: #fcfcfc;
}

input::placeholder,
textarea::placeholder {
  color: #707070;
  opacity: 1;
  transition: opacity 0.16s ease, color 0.16s ease;
}

input:focus::placeholder,
textarea:focus::placeholder {
  opacity: 0;
}

textarea {
  resize: vertical;
}

/* Shell and header */
.shell {
  width: min(1188px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 30px;
}

.site-header {
  display: grid;
  gap: 0;
  justify-items: center;
  margin-bottom: 30px;
  position: relative;
  padding-top: 0;
}

.masthead {
  display: grid;
  justify-items: center;
  width: 100%;
  margin-bottom: 0;
}

.brand-block {
  width: min(100%, 486px);
  padding: 30px 18px 32px;
  background: #000;
  color: #fff;
  border: 2px solid #000;
  text-align: center;
}

.brand-mark {
  font-size: clamp(3.8rem, 7vw, 4.9rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
}

.motto-bar {
  width: min(100%, 680px);
  margin-top: -2px;
  margin-bottom: -2px;
  padding: 9px 18px;
  border: 2px solid #000;
  background: #000;
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.3;
}

.header-side {
  display: grid;
  gap: 0;
  width: 100%;
  justify-items: center;
  margin-top: -2px;
}

.language-switch {
  position: absolute;
  top: -4px;
  right: 0;
  width: min(238px, calc(100% - 24px));
  justify-self: end;
  z-index: 2;
}

.home-corner-button {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  background: #111;
  color: #fff;
  border: 2px solid #111;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.18s ease;
}

.home-corner-button:hover {
  background: #333;
  transform: translateY(-1px);
}

.home-corner-button svg {
  width: 32px;
  height: 32px;
  display: block;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.voice-inline {
  margin-top: 10px;
  align-self: start;
}
.voice-mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  padding: 5px 10px;
  margin-top: 6px;
}
.voice-mic-btn svg {
  flex-shrink: 0;
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(100%, 1020px);
  gap: 0;
  background: #000;
  border: 2px solid #000;
}

.brand-home-button,
.brand-home-button:hover,
.brand-home-button:focus-visible,
.nav-button:hover,
.nav-button:focus-visible {
  transform: none;
}

.brand-home-button:hover,
.brand-home-button:focus-visible,
.nav-button:hover,
.nav-button:focus-visible {
  background: #000;
  color: #fff;
}

.nav-button,
.nav-static-button {
  border-width: 0;
  border-right: 1px solid #fff;
  border-radius: 0;
  padding: 0.66rem 0.4rem;
  min-height: 34px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.secondary-button {
  background: #111;
  color: #fff;
  border: 2px solid #111;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.secondary-button:hover {
  background: #222;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.tab-button {
  border-width: 0;
  border-right: 1px solid #fff;
  border-radius: 0;
  padding: 0.66rem 0.4rem;
  min-height: 34px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.main-nav > *:last-child,
.main-nav > *:nth-child(5n) {
  border-right: 0;
}

.main-nav > *:nth-child(-n+5) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
}

.nav-button.is-active,
.tab-button.is-active {
  background: #000;
  color: #fff;
}

/* Typography */
h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.02em;
}

h2 {
  font-size: clamp(1.5rem, 2vw, 2.25rem);
}

h3 {
  font-size: 1.45rem;
}

.helper-text,
.section-heading p,
.database-tile p,
.manifest-item,
.result-signals {
  color: var(--muted);
}

main {
  position: relative;
}

.view {
  display: none;
  width: 100%;
}

.view.is-active {
  display: block;
  position: relative;
  z-index: 1;
  animation: view-enter 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.view.is-leaving {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 0;
  pointer-events: none;
  animation: view-leave 0.26s ease forwards;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes view-leave {
  from {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
    filter: blur(2px);
  }
}

@keyframes search-result-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shared layout and cards */
.card,
.hero-card,
.results-card,
.database-card,
.manifest-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.card,
.hero-card,
.results-card,
.database-card,
.manifest-card {
  padding: 26px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.home-search-stage {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.search-hero {
  width: min(100%, 512px);
  padding: 0;
}

.section-heading,
.profile-meta,
.profile-header,
.header-actions,
.tabs,
.signals-summary {
  display: flex;
  gap: 16px;
}

.section-heading {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

/* Home */
.search-stack {
  display: grid;
  gap: 0;
}

.search-hero .field > span,
.home-search-support,
#access-code-result {
  display: none;
}

.signal-search-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.68fr) 178px;
  gap: 14px;
  align-items: end;
}

.search-hero .search-row {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 14px 0 16px;
  gap: 0;
  border: 3px solid #111;
  background: #fff;
}

.search-hero .search-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  font-size: 0.98rem;
  background: transparent;
  box-shadow: none;
  outline: none;
  appearance: none;
  border-radius: 0;
}

.search-hero .search-row input:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

.search-hero .search-row input::placeholder {
  color: #565656;
  opacity: 1;
  transition: opacity 0.16s ease;
}

.search-hero .search-row input:focus::placeholder {
  opacity: 0;
}

.search-row input,
.signal-search-grid .select-shell,
.signal-search-grid .select-shell select,
.search-row button,
#signal-search-button {
  min-height: 56px;
  font-size: 1.05rem;
}

.signal-search-grid .select-shell {
  width: 100%;
}

.search-hero .search-row button {
  width: 64px;
  min-height: auto;
  flex: 0 0 64px;
  border: 0;
  padding: 0;
  background: transparent;
  color: #111;
  font-size: 2rem;
  font-weight: 400;
}

.search-hero .search-row button svg {
  display: block;
  width: 34px;
  height: 18px;
  margin: 0 auto;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: square;
  stroke-linejoin: miter;
  fill: none;
}

.search-hero .search-row button:hover,
.search-hero .search-row button:focus-visible {
  background: transparent;
  color: #111;
}

.search-row button,
#access-code-button {
  width: 108px;
  flex: 0 0 108px;
}

#signal-search-button {
  width: 178px;
  padding-inline: 16px;
}

#access-code-result {
  margin-top: -8px;
}

.home-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: start;
  justify-items: center;
  margin-top: 12px;
}

.manifest-card {
  width: min(100%, 512px);
  padding: 22px 26px;
  border: 3px solid #111;
}

.manifest-list {
  display: grid;
  gap: 12px;
}

.manifest-item {
  position: relative;
  padding-left: 24px;
  line-height: 1.5;
  font-size: 0.95rem;
  color: #111;
}

.manifest-item::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: #000;
  font-size: 1.35rem;
  line-height: 1;
}

.database-list {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.database-tile,
.panel-card,
.result-card,
.signal-card {
  background: #fff;
  border: 2px solid #111;
  border-radius: 10px;
  padding: 22px;
  transition:
    transform 0.2s ease,
    box-shadow 0.22s ease,
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.database-tile:hover,
.panel-card:hover,
.result-card:hover,
.signal-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.05);
}

.db-label {
  color: #111;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.db-value {
  margin: 10px 0 8px;
  font-size: 2.3rem;
  font-weight: 800;
}

.results-card {
  width: min(100%, 820px);
  margin: 26px auto 0;
  border: 2px solid #111;
}

.content-page {
  background: #fff;
}

.rules-block {
  margin-top: 8px;
}

.rules-intro {
  max-width: 900px;
  margin-bottom: 18px;
  line-height: 1.7;
}

.rules-list {
  max-width: 930px;
  margin: 0;
  padding-left: 1.5rem;
  display: grid;
  gap: 14px;
}

.rules-list li {
  line-height: 1.72;
  color: #111;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 0;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font-weight: 700;
  white-space: nowrap;
}

.narrow {
  max-width: 560px;
}

#view-register .card.narrow {
  margin: 0 auto;
}

#view-register .section-heading {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

#view-register .section-heading > div {
  width: 100%;
}

/* Authentication */
.auth-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 420px);
  margin: 0 auto 22px;
  padding: 6px;
  border: 2px solid #111;
  background: linear-gradient(180deg, #f7f7f7 0%, #ececec 100%);
}

.auth-switch-button {
  min-height: 52px;
  border: 0;
  background: transparent;
  color: #111;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-switch-button:hover {
  background: #111;
  color: #fff;
}

.auth-switch-button.is-active {
  background: #000;
  color: #fff;
}

.auth-switch-button.is-active:hover {
  background: #000;
}

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

.profile-card {
  margin-top: 20px;
}

/* Profile section blocks */
.profile-section-block {
  margin-top: 32px;
}
.section-block-header {
  text-align: center;
  margin-bottom: 18px;
  padding: 12px 0;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}
.section-block-header h2 {
  font-size: 1.4rem;
  letter-spacing: 2px;
  margin: 0;
}
.history-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-field .field-title {
  font-weight: 700;
  font-size: 1rem;
  display: block;
  margin-bottom: 2px;
}
.history-field .helper-text {
  margin-bottom: 6px;
}

/* Signals */
.signals-intro {
  margin-bottom: 16px;
}
.signals-quote {
  border-left: 3px solid rgba(255,255,255,0.3);
  padding: 8px 16px;
  margin: 0 0 12px;
  font-style: italic;
  opacity: 0.9;
}
.signals-quote cite {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-weight: 700;
}
.signals-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.signal-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
}
.signal-item .signal-number {
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: 6px;
}
.signal-item .signal-text {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 12px;
}
.signal-scale {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
  background: none;
}
.signal-scale-btn {
  all: unset;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  max-width: 38px;
  max-height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  flex-shrink: 0;
  flex-grow: 0;
}
.signal-scale-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
}
.signal-scale-btn.is-selected {
  transform: scale(1.45) !important;
  z-index: 2;
  position: relative;
}
/* Red 1-3 */
.signal-scale-btn[data-value="1"] { background: #e53935; }
.signal-scale-btn[data-value="2"] { background: #c62828; }
.signal-scale-btn[data-value="3"] { background: #b71c1c; }
/* Yellow 4-7 */
.signal-scale-btn[data-value="4"] { background: #fdd835; color: #333; }
.signal-scale-btn[data-value="5"] { background: #f9c811; color: #333; }
.signal-scale-btn[data-value="6"] { background: #f0b400; color: #333; }
.signal-scale-btn[data-value="7"] { background: #e6a100; color: #333; }
/* Green 8-10 */
.signal-scale-btn[data-value="8"] { background: #43a047; }
.signal-scale-btn[data-value="9"] { background: #2e7d32; }
.signal-scale-btn[data-value="10"] { background: #1b5e20; }

.signal-comment textarea {
  width: 100%;
  resize: vertical;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
}

.section-dev-note {
  margin-top: 20px;
  padding: 12px 16px;
  border-left: 3px solid rgba(255,255,255,0.2);
  opacity: 0.65;
  font-style: italic;
}

/* Profile and memorial */
.profile-header {
  align-items: flex-start;
}

.header-actions {
  position: sticky;
  top: 12px;
  z-index: 3;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  padding-block: 4px;
  background: #fff;
}

.sound-range {
  min-width: 170px;
}

.sound-range span {
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.sound-range input {
  min-height: auto;
  padding: 0;
}

.profile-meta {
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.autosave-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border: 2px solid #111;
  background: #fff;
  font-weight: 700;
}

.payment-banner,
.readonly-banner {
  border-radius: 0;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.payment-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border: 2px solid #111;
  background: #fff;
}

.readonly-banner {
  border: 2px dashed #111;
  background: #fff;
  color: #444;
}

.settings-panel {
  padding: 20px;
  margin-bottom: 18px;
  border-radius: 0;
  border: 2px solid #111;
  background: #fff;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-note-card {
  padding-block: 18px;
}

.profile-note-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.text-link-button {
  padding: 0;
  min-height: auto;
  border: 0;
  background: transparent;
  color: #111;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-link-button:hover,
.text-link-button:focus-visible {
  background: transparent;
  color: #111;
  transform: none;
}

.text-link-button.inline-link {
  display: inline;
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
  cursor: pointer;
}

.autosave-inline {
  margin-top: 12px;
}

.history-voice-inline {
  margin-top: 10px;
  align-self: start;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.toggle input {
  width: auto;
}

.tabs {
  display: none;
}

.tab-panel {
  display: block;
  margin-bottom: 20px;
}

.tab-panel.is-active {
  display: block;
}

.memorial-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(360px, 1fr);
  column-gap: 14px;
  row-gap: 8px;
  align-items: start;
}

.memorial-content,
.memorial-aside,
.dual-grid,
.history-grid,
.links-list,
.signals-list {
  display: grid;
  gap: 18px;
}

.dual-grid,
.history-grid {
  grid-template-columns: 1fr 1fr;
}

.memorial-aside {
  order: -1;
}

.memorial-content,
.memorial-aside {
  display: contents;
}

.dual-grid {
  grid-column: 1 / -1;
  grid-row: 7;
  gap: 8px;
}

.history-stack {
  display: grid;
  gap: 18px;
}

.profile-note-card {
  grid-column: 1 / -1;
  grid-row: 1;
}

.display-name-card {
  grid-column: 1;
  grid-row: 2;
  text-align: center;
}

.display-name-card input {
  text-align: center;
  font-size: 1.2em;
  font-weight: 700;
  font-family: "Cormorant Garamond", serif;
  border: none;
  background: transparent;
}

.portrait-card {
  padding-bottom: 28px;
  grid-column: 1;
  grid-row: 3 / span 3;
}

.memorial-top-stack {
  grid-column: 2;
  grid-row: 2 / 7;
  display: grid;
  gap: 8px;
  align-content: start;
}

.memorial-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-self: start;
  margin-bottom: 0;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 0.85rem;
}
.social-btn svg { flex-shrink: 0; }

.profile-display-nick {
  text-align: right;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 4px 0;
  color: #fff;
  min-height: 1.5em;
}

.comments-panel h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.comments-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.comment-form textarea {
  width: 100%;
  resize: vertical;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  font-family: inherit;
}

.memorial-qr-card {
  min-height: 300px;
  display: grid;
  align-content: start;
  margin-top: 0;
}

.photo-panel {
  padding: 22px;
}

.photo-panel-heading {
  align-items: end;
}

.offering-choices-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 4px;
}

.offering-choices-panel > .helper-text {
  display: none;
}

.offering-choices-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offering-choices-summary {
  margin: 0;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.offering-choices-toggle {
  flex: 0 0 auto;
  padding: 7px 14px;
}

.offering-choices-list-wrap {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 2px solid #111;
}

.offering-choices-lead {
  margin: 0;
}

.offering-choices-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 8px;
}

.offering-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 14px 8px 12px;
  border: 2px solid rgba(17, 17, 17, 0.14);
  border-radius: 8px;
  background: #fafafa;
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition:
    transform 0.18s ease,
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.22s ease;
}

.offering-choice:hover {
  transform: translateY(-1px);
  border-color: rgba(17, 17, 17, 0.35);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.offering-choice:has(input:checked) {
  border-color: #111;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.offering-choice:has(input:not(:checked)) {
  opacity: 0.55;
}

.offering-choice:has(input:not(:checked)):hover {
  opacity: 0.85;
}

.offering-choice input {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: #111;
  cursor: pointer;
}

.offering-choice-emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.offering-choice-label {
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.memorial-top-stack > #display-name-card,
.memorial-top-stack > #memorial-text-card,
.memorial-top-stack > #offerings-card,
.memorial-top-stack > .photo-panel,
.memorial-top-stack > .memorial-qr-card,
.memorial-top-stack > .memorial-hero-actions {
  grid-column: auto;
  grid-row: auto;
}

#links-card {
  grid-column: 1 / -1;
}

#ai-card {
  grid-column: 1 / -1;
}


.portrait-label {
  margin-bottom: 14px;
  color: #111;
  font-weight: 700;
}

.memorial-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  padding: 18px;
  overflow: visible;
  background:
    linear-gradient(180deg, #f8f8f8 0%, #ededed 100%) padding-box,
    linear-gradient(180deg, #222 0%, #8f8f8f 52%, #2a2a2a 100%) border-box;
  border: 8px solid transparent;
  box-shadow:
    inset 0 0 0 18px rgba(255, 255, 255, 0.9),
    0 14px 28px rgba(0, 0, 0, 0.08);
  isolation: isolate;
}

.memorial-frame img {
  position: absolute;
  inset: 28px;
  z-index: 1;
  width: calc(100% - 56px);
  height: calc(100% - 56px);
  object-fit: cover;
  object-position: center center;
  border-radius: 6px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.35), transparent 35%),
    linear-gradient(180deg, #ececec, #d7d7d7);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.75),
    0 14px 24px rgba(0, 0, 0, 0.12);
  transform: scale(1.015);
  transition: transform 0.28s ease;
}

.memorial-frame:hover img {
  transform: scale(1.03);
}

.memorial-frame-decor {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: none;
}

.memorial-flag-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  --flag-color-1: #111;
  --flag-color-2: #555;
  --flag-color-3: #999;
}

.memorial-flag-overlay::after {
  content: attr(data-flag-label);
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.memorial-flag-pole,
.memorial-flag-cloth {
  position: absolute;
}

.memorial-flag-overlay.is-vertical .memorial-flag-pole {
  top: 22px;
  right: 42px;
  width: 4px;
  height: 112px;
  background: #171717;
}

.memorial-flag-overlay.is-vertical .memorial-flag-cloth {
  top: 24px;
  right: 46px;
  width: 154px;
  height: 62px;
  background: linear-gradient(180deg, var(--flag-color-1) 0 33%, var(--flag-color-2) 33% 66%, var(--flag-color-3) 66% 100%);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
  clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%);
}

.memorial-flag-overlay.is-diagonal .memorial-flag-pole {
  top: 34px;
  left: 26px;
  width: 154px;
  height: 4px;
  background: #171717;
  transform: rotate(-36deg);
  transform-origin: left center;
}

.memorial-flag-overlay.is-diagonal .memorial-flag-cloth {
  top: 46px;
  left: 36px;
  width: 114px;
  height: 146px;
  background: linear-gradient(180deg, var(--flag-color-1) 0 33%, var(--flag-color-2) 33% 66%, var(--flag-color-3) 66% 100%);
  transform: skewY(-18deg);
  clip-path: polygon(0 0, 100% 0, 100% 88%, 30% 100%, 0 88%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.memorial-frame::before {
  content: "";
  position: absolute;
  inset: 24px;
  z-index: 3;
  border: 2px solid rgba(0, 0, 0, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.75),
    0 0 0 1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

.memorial-frame::after {
  content: "";
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.memorial-frame.frame-style-classic {
  border-radius: 10px 10px 6px 6px;
}

.memorial-frame.frame-style-arch {
  border-radius: 42% 42% 10px 10px / 18% 18% 10px 10px;
}

.memorial-frame.frame-style-arch::before {
  border-radius: 34% 34% 8px 8px / 16% 16% 8px 8px;
}

.memorial-frame.frame-style-stela {
  border-radius: 26px 26px 10px 10px / 40px 40px 10px 10px;
}

.memorial-frame.frame-style-stela::before {
  inset: 22px 26px 24px;
  border-width: 3px;
}

.memorial-frame.frame-style-monolith {
  border-radius: 110px 110px 8px 8px / 62px 62px 8px 8px;
  background:
    linear-gradient(180deg, #f2f2f2 0%, #e4e4e4 100%) padding-box,
    linear-gradient(180deg, #111 0%, #555 50%, #111 100%) border-box;
}

.memorial-frame.frame-style-monolith::before {
  inset: 20px;
  border-color: rgba(0, 0, 0, 0.28);
  border-radius: 92px 92px 6px 6px / 52px 52px 6px 6px;
}

.memorial-frame.frame-style-chapel {
  border-radius: 24px 24px 12px 12px;
  box-shadow:
    inset 0 0 0 14px rgba(255, 255, 255, 0.92),
    inset 0 0 0 28px rgba(210, 210, 210, 0.55),
    0 14px 28px rgba(0, 0, 0, 0.08);
}

.memorial-frame.frame-style-chapel::before {
  inset: 30px;
}

.memorial-frame.frame-style-black-thick {
  border-width: 12px;
  background:
    linear-gradient(180deg, #fafafa 0%, #efefef 100%) padding-box,
    linear-gradient(180deg, #050505 0%, #3b3b3b 52%, #050505 100%) border-box;
  box-shadow:
    inset 0 0 0 16px rgba(255, 255, 255, 0.94),
    inset 0 0 0 34px rgba(10, 10, 10, 0.97),
    0 14px 28px rgba(0, 0, 0, 0.08);
}

.memorial-frame.frame-style-black-thick::after {
  content: none;
}

.memorial-frame.frame-style-black-ribbon {
  background:
    linear-gradient(180deg, #fafafa 0%, #efefef 100%) padding-box,
    linear-gradient(180deg, #050505 0%, #3b3b3b 52%, #050505 100%) border-box;
  box-shadow:
    inset 0 0 0 16px rgba(255, 255, 255, 0.94),
    inset 0 0 0 32px rgba(10, 10, 10, 0.97),
    0 14px 28px rgba(0, 0, 0, 0.08);
}

.memorial-frame.frame-style-black-ribbon::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, transparent 50%, #111 50%);
  z-index: 4;
  pointer-events: none;
}

.memorial-frame.frame-style-black-ribbon-roses {
  background:
    linear-gradient(180deg, #faf5f6 0%, #f0e8ea 100%) padding-box,
    linear-gradient(180deg, #1a0a0e 0%, #4a2030 52%, #1a0a0e 100%) border-box;
  box-shadow:
    inset 0 0 0 16px rgba(255, 240, 244, 0.94),
    inset 0 0 0 32px rgba(60, 15, 30, 0.95),
    0 14px 28px rgba(0, 0, 0, 0.08);
}

.memorial-frame.frame-style-black-ribbon-roses::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, transparent 50%, #3a1020 50%);
  z-index: 4;
  pointer-events: none;
}

.memorial-frame.frame-style-black-ribbon-roses::before {
  content: none;
}

.memorial-frame.frame-style-black-ribbon .memorial-frame-decor {
  display: none;
  overflow: visible;
}

.memorial-frame.frame-style-black-ribbon-roses .memorial-frame-decor {
  display: none;
}

.memorial-frame.frame-style-gold-rich {
  border-width: 20px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, #fbf7ef 0%, #e8dcc4 100%) padding-box,
    linear-gradient(135deg,
      #1e0e02 0%,
      #f0c060 5%,
      #8a6018 11%,
      #fde890 19%,
      #5a3a08 26%,
      #d4a030 34%,
      #6a4010 42%,
      #d4a030 58%,
      #5a3a08 66%,
      #fde890 74%,
      #8a6018 82%,
      #f0c060 89%,
      #1e0e02 100%
    ) border-box;
  box-shadow:
    0 0 0 1px #1a0c02,
    0 0 0 3px #c8921a,
    0 0 0 4px #1a0c02,
    inset 0 0 0 2px #1a0c02,
    inset 0 0 0 3px #fde890,
    0 28px 60px rgba(0, 0, 0, 0.38),
    0 8px 20px rgba(0, 0, 0, 0.22);
}

.memorial-frame.frame-style-gold-rich::before {
  inset: 18px;
  border: 2px solid #c8921a;
  border-radius: 1px;
  box-shadow:
    0 0 0 1px rgba(253, 232, 144, 0.65),
    inset 0 0 0 1px rgba(253, 232, 144, 0.35);
}

.memorial-frame.frame-style-gold-rich::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  /* 4 corner rosettes (36px) + 4 mid-side diamonds (22px) */
  background-image:
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><defs><radialGradient id="g"><stop offset="0%" stop-color="%23fde890"/><stop offset="55%" stop-color="%23c8921a"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><g transform="translate(18,18)"><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(0)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(45)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(90)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(135)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(22.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(67.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(112.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(157.5)"/><circle r="6" fill="url(%23g)"/><circle r="2.5" fill="%23533008"/><circle r="1.2" fill="%23fde890"/></g></svg>'),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><defs><radialGradient id="g"><stop offset="0%" stop-color="%23fde890"/><stop offset="55%" stop-color="%23c8921a"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><g transform="translate(18,18)"><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(0)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(45)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(90)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(135)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(22.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(67.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(112.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(157.5)"/><circle r="6" fill="url(%23g)"/><circle r="2.5" fill="%23533008"/><circle r="1.2" fill="%23fde890"/></g></svg>'),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><defs><radialGradient id="g"><stop offset="0%" stop-color="%23fde890"/><stop offset="55%" stop-color="%23c8921a"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><g transform="translate(18,18)"><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(0)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(45)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(90)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(135)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(22.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(67.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(112.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(157.5)"/><circle r="6" fill="url(%23g)"/><circle r="2.5" fill="%23533008"/><circle r="1.2" fill="%23fde890"/></g></svg>'),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><defs><radialGradient id="g"><stop offset="0%" stop-color="%23fde890"/><stop offset="55%" stop-color="%23c8921a"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><g transform="translate(18,18)"><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(0)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(45)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(90)"/><ellipse rx="3.5" ry="10" fill="%23533008" transform="rotate(135)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(22.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(67.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(112.5)"/><ellipse rx="2.5" ry="7" fill="%23b07820" transform="rotate(157.5)"/><circle r="6" fill="url(%23g)"/><circle r="2.5" fill="%23533008"/><circle r="1.2" fill="%23fde890"/></g></svg>'),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><defs><radialGradient id="d"><stop offset="0%" stop-color="%23fde890"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><path d="M11 2 L20 11 L11 20 L2 11 Z" fill="url(%23d)" stroke="%23533008" stroke-width="0.5"/><path d="M11 5 L17 11 L11 17 L5 11 Z" fill="none" stroke="%23fde890" stroke-width="0.8"/><circle cx="11" cy="11" r="3" fill="%23533008"/><circle cx="11" cy="11" r="1.5" fill="%23fde890"/></svg>'),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><defs><radialGradient id="d"><stop offset="0%" stop-color="%23fde890"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><path d="M11 2 L20 11 L11 20 L2 11 Z" fill="url(%23d)" stroke="%23533008" stroke-width="0.5"/><path d="M11 5 L17 11 L11 17 L5 11 Z" fill="none" stroke="%23fde890" stroke-width="0.8"/><circle cx="11" cy="11" r="3" fill="%23533008"/><circle cx="11" cy="11" r="1.5" fill="%23fde890"/></svg>'),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><defs><radialGradient id="d"><stop offset="0%" stop-color="%23fde890"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><path d="M11 2 L20 11 L11 20 L2 11 Z" fill="url(%23d)" stroke="%23533008" stroke-width="0.5"/><path d="M11 5 L17 11 L11 17 L5 11 Z" fill="none" stroke="%23fde890" stroke-width="0.8"/><circle cx="11" cy="11" r="3" fill="%23533008"/><circle cx="11" cy="11" r="1.5" fill="%23fde890"/></svg>'),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><defs><radialGradient id="d"><stop offset="0%" stop-color="%23fde890"/><stop offset="100%" stop-color="%236a4010"/></radialGradient></defs><path d="M11 2 L20 11 L11 20 L2 11 Z" fill="url(%23d)" stroke="%23533008" stroke-width="0.5"/><path d="M11 5 L17 11 L11 17 L5 11 Z" fill="none" stroke="%23fde890" stroke-width="0.8"/><circle cx="11" cy="11" r="3" fill="%23533008"/><circle cx="11" cy="11" r="1.5" fill="%23fde890"/></svg>');
  background-size:
    36px 36px, 36px 36px, 36px 36px, 36px 36px,
    22px 22px, 22px 22px, 22px 22px, 22px 22px;
  background-repeat: no-repeat;
  background-position:
    left top, right top, right bottom, left bottom,
    50% 0%, 100% 50%, 50% 100%, 0% 50%;
}

.memorial-frame.frame-style-gold-simple {
  background:
    linear-gradient(180deg, #faf6ed 0%, #ece2cc 100%) padding-box,
    linear-gradient(180deg, #8d6a2d 0%, #dcb96d 52%, #7f5f2a 100%) border-box;
  border-width: 8px;
  box-shadow:
    inset 0 0 0 14px rgba(255, 249, 235, 0.92),
    inset 0 0 0 22px rgba(194, 150, 72, 0.22),
    0 14px 28px rgba(0, 0, 0, 0.08);
}

.memorial-frame.frame-style-gold-simple::after {
  content: none;
}

.memorial-frame.frame-style-black-ornament-rich {
  background:
    linear-gradient(180deg, #f5f5f5 0%, #e3e3e3 100%) padding-box,
    linear-gradient(180deg, #050505 0%, #444 50%, #050505 100%) border-box;
  border-width: 10px;
  box-shadow:
    inset 0 0 0 12px rgba(255, 255, 255, 0.94),
    inset 0 0 0 24px rgba(20, 20, 20, 0.9),
    0 14px 28px rgba(0, 0, 0, 0.08);
}

.memorial-frame.frame-style-black-ornament-rich::after {
  content: "";
  inset: 4px;
  border: none;
  background:
    radial-gradient(circle at 0 0, rgba(255,255,255,0.08) 2px, transparent 2px),
    radial-gradient(circle at 12px 12px, rgba(255,255,255,0.08) 2px, transparent 2px);
  background-size: 24px 24px;
  background-position: 0 0;
  opacity: 1;
  mix-blend-mode: normal;
  pointer-events: none;
}

.memorial-frame.frame-style-black-ornament-simple {
  background:
    linear-gradient(180deg, #f5f5f5 0%, #e3e3e3 100%) padding-box,
    linear-gradient(180deg, #111 0%, #565656 50%, #111 100%) border-box;
  border-width: 8px;
  box-shadow:
    inset 0 0 0 12px rgba(255, 255, 255, 0.94),
    inset 0 0 0 22px rgba(18, 18, 18, 0.88),
    0 14px 28px rgba(0, 0, 0, 0.08);
}

.memorial-frame.frame-style-black-ornament-simple::after {
  content: none;
}

/* Muslim open — no frame border */
.memorial-frame.frame-style-muslim-open-left,
.memorial-frame.frame-style-muslim-open-right {
  padding: 0;
  border: none;
  background: #1a1a1a;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
}

/* Muslim black — solid black frame */
.memorial-frame.frame-style-muslim-black-left,
.memorial-frame.frame-style-muslim-black-right {
  padding: 14px;
  background:
    #1a1a1a padding-box,
    linear-gradient(180deg, #0b0b0b 0%, #333 52%, #0b0b0b 100%) border-box;
  border: 8px solid transparent;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
}

/* Muslim marble — marble ornament frame */
.memorial-frame.frame-style-muslim-marble-left,
.memorial-frame.frame-style-muslim-marble-right {
  padding: 14px;
  background:
    #1a1a1a padding-box,
    linear-gradient(135deg, #c8c8c8 0%, #f4f4f4 24%, #bdbdbd 48%, #efefef 72%, #b5b5b5 100%) border-box;
  border: 9px solid transparent;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
}

/* Muslim — shared: remove decorative pseudo-elements */
.memorial-frame[class*="frame-style-muslim-"]::before,
.memorial-frame[class*="frame-style-muslim-"]::after {
  content: none;
}

/* Muslim open — photo fills entire frame */
.memorial-frame.frame-style-muslim-open-left img,
.memorial-frame.frame-style-muslim-open-right img {
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

/* Muslim black/marble — photo with padding */
.memorial-frame.frame-style-muslim-black-left img,
.memorial-frame.frame-style-muslim-black-right img,
.memorial-frame.frame-style-muslim-marble-left img,
.memorial-frame.frame-style-muslim-marble-right img {
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

/* Crescent decor — shared */
.memorial-frame[class*="frame-style-muslim-"] .memorial-frame-decor {
  display: block;
  inset: 0;
  z-index: 5;
  background-repeat: no-repeat;
  background-size: 44px 44px;
  pointer-events: none;
}

/* Crescent+star via CSS ::before (works without PNG asset) */
.memorial-frame[class*="frame-style-muslim-"] .memorial-frame-decor::before {
  content: "\262A";
  position: absolute;
  z-index: 6;
  font-size: 36px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* Crescent position — open (no frame, position from edge) */
.memorial-frame.frame-style-muslim-open-left .memorial-frame-decor {
  background-image: url("assets/crescent-star-white.png");
  background-position: 10px 8px;
}
.memorial-frame.frame-style-muslim-open-left .memorial-frame-decor::before {
  top: 10px;
  left: 14px;
}

.memorial-frame.frame-style-muslim-open-right .memorial-frame-decor {
  background-image: url("assets/crescent-star-white.png");
  background-position: calc(100% - 10px) 8px;
}
.memorial-frame.frame-style-muslim-open-right .memorial-frame-decor::before {
  top: 10px;
  right: 14px;
}

/* Crescent position — black/marble (account for border + padding) */
.memorial-frame.frame-style-muslim-black-left .memorial-frame-decor,
.memorial-frame.frame-style-muslim-marble-left .memorial-frame-decor {
  background-image: url("assets/crescent-star-white.png");
  background-position: 18px 16px;
}
.memorial-frame.frame-style-muslim-black-left .memorial-frame-decor::before,
.memorial-frame.frame-style-muslim-marble-left .memorial-frame-decor::before {
  top: 18px;
  left: 22px;
}

.memorial-frame.frame-style-muslim-black-right .memorial-frame-decor,
.memorial-frame.frame-style-muslim-marble-right .memorial-frame-decor {
  background-image: url("assets/crescent-star-white.png");
  background-position: calc(100% - 18px) 16px;
}
.memorial-frame.frame-style-muslim-black-right .memorial-frame-decor::before,
.memorial-frame.frame-style-muslim-marble-right .memorial-frame-decor::before {
  top: 18px;
  right: 22px;
}

/* ── Orthodox frames (full portrait) ── */
.memorial-frame.frame-style-orthodox-cross,
.memorial-frame.frame-style-orthodox-cross-spasi,
.memorial-frame.frame-style-orthodox-black,
.memorial-frame.frame-style-orthodox-gold {
  position: relative;
}

.memorial-frame.frame-style-orthodox-cross .memorial-frame-decor,
.memorial-frame.frame-style-orthodox-cross-spasi .memorial-frame-decor,
.memorial-frame.frame-style-orthodox-black .memorial-frame-decor,
.memorial-frame.frame-style-orthodox-gold .memorial-frame-decor {
  display: block !important;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

.memorial-frame[class*="orthodox"] .memorial-frame-decor::before {
  content: "☦";
  position: absolute;
  top: 4px;
  left: 10px;
  font-size: 28px;
  line-height: 1;
  color: #444;
  z-index: 5;
}

.memorial-frame.frame-style-orthodox-gold .memorial-frame-decor::before {
  color: #b8960c;
}

.memorial-frame.frame-style-orthodox-black {
  border: 10px solid #111;
  background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.5), 0 14px 28px rgba(0,0,0,0.12);
}

.memorial-frame.frame-style-orthodox-gold {
  border: 8px solid transparent;
  background:
    linear-gradient(180deg, #faf6ed 0%, #f0e8d8 100%) padding-box,
    linear-gradient(180deg, #c9a84c 0%, #d4af37 50%, #b8960c 100%) border-box;
  box-shadow: inset 0 0 0 12px rgba(255,255,255,0.7), 0 14px 28px rgba(0,0,0,0.1);
}

.memorial-frame.frame-style-orthodox-gold .memorial-frame-decor::before {
  background: #b8860b;
}

.memorial-frame.frame-style-orthodox-cross-spasi .memorial-frame-decor::after {
  content: "Спаси и сохрани";
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #555;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.08em;
}

.frame-style-block {
  margin-top: 18px;
}

.signals-extras {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.contract-page {
  max-width: 920px;
}

.frame-style-title {
  display: none;
}

.frame-style-lead {
  display: none;
}

.frame-style-lead {
  margin-bottom: 14px;
}

.frame-style-class-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.frame-style-class-button {
  padding: 8px 12px;
  border: 2px solid #111;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.frame-style-class-button:hover {
  transform: translateY(-1px);
}

.frame-style-class-button.is-active {
  background: #111;
  color: #fff;
}

.frame-style-list {
  display: grid;
  gap: 16px;
  overflow: visible;
}

.frame-style-group {
  display: grid;
  gap: 10px;
  overflow: visible;
}

.frame-style-group-title {
  display: none;
}

.frame-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
}

.frame-style-option {
  display: grid;
  gap: 8px;
  padding: 10px 8px;
  border: 2px solid #ddd;
  background: #fff;
  color: #111;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.frame-style-option:hover {
  border-color: #888;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.frame-style-option.is-selected {
  border-color: #111;
  box-shadow: 0 0 0 2px #111;
}

.frame-style-preview {
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  background:
    linear-gradient(180deg, #f8f8f8 0%, #ededed 100%) padding-box,
    linear-gradient(180deg, #222 0%, #8f8f8f 52%, #2a2a2a 100%) border-box;
  border: 5px solid transparent;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.92);
  transition: box-shadow 0.35s ease, background 0.35s ease, transform 0.35s ease;
}

.frame-style-option.is-selected .frame-style-preview {
  background:
    linear-gradient(180deg, #e9e9e9 0%, #dcdcdc 100%) padding-box,
    linear-gradient(180deg, #ffffff 0%, #cfcfcf 52%, #ffffff 100%) border-box;
}

.frame-style-preview.frame-style-classic {
  border-radius: 8px 8px 4px 4px;
}

.frame-style-preview.frame-style-arch {
  border-radius: 42% 42% 8px 8px / 18% 18% 8px 8px;
}

.frame-style-preview.frame-style-stela {
  border-radius: 24px 24px 8px 8px / 34px 34px 8px 8px;
}

.frame-style-preview.frame-style-monolith {
  border-radius: 90px 90px 6px 6px / 44px 44px 6px 6px;
}

.frame-style-preview.frame-style-chapel {
  border-radius: 18px 18px 8px 8px;
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, 0.92),
    inset 0 0 0 12px rgba(210, 210, 210, 0.55);
}

/* === black-thick preview === */
.frame-style-preview.frame-style-black-thick {
  border-width: 5px;
  background:
    linear-gradient(180deg, #fafafa 0%, #efefef 100%) padding-box,
    linear-gradient(180deg, #050505 0%, #3b3b3b 52%, #050505 100%) border-box;
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, 0.94),
    inset 0 0 0 14px rgba(10, 10, 10, 0.97);
}

/* === black-ribbon preview === */
.frame-style-preview.frame-style-black-ribbon {
  position: relative;
  background:
    linear-gradient(180deg, #fafafa 0%, #efefef 100%) padding-box,
    linear-gradient(180deg, #050505 0%, #3b3b3b 52%, #050505 100%) border-box;
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, 0.94),
    inset 0 0 0 13px rgba(10, 10, 10, 0.97);
}

.frame-style-preview.frame-style-black-ribbon::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  z-index: 3;
  background: linear-gradient(135deg, transparent 50%, #111 50%);
  pointer-events: none;
}

/* === black-ribbon-roses preview === */
.frame-style-preview.frame-style-black-ribbon-roses {
  position: relative;
  background:
    linear-gradient(180deg, #faf5f6 0%, #f0e8ea 100%) padding-box,
    linear-gradient(180deg, #1a0a0e 0%, #4a2030 52%, #1a0a0e 100%) border-box;
  box-shadow:
    inset 0 0 0 6px rgba(255, 240, 244, 0.94),
    inset 0 0 0 13px rgba(60, 15, 30, 0.95);
}

.frame-style-preview.frame-style-black-ribbon-roses::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  z-index: 3;
  background: linear-gradient(135deg, transparent 50%, #3a1020 50%);
  pointer-events: none;
}

.frame-style-preview.frame-style-black-ribbon-roses::before {
  content: none;
}

/* === gold-rich preview === */
.frame-style-preview.frame-style-gold-rich {
  border-width: 8px;
  border-radius: 2px;
  background:
    linear-gradient(180deg, #fbf7ef 0%, #e8dcc4 100%) padding-box,
    linear-gradient(135deg,
      #1e0e02 0%, #f0c060 5%, #8a6018 11%, #fde890 19%,
      #5a3a08 26%, #d4a030 34%, #6a4010 42%, #d4a030 58%,
      #5a3a08 66%, #fde890 74%, #8a6018 82%, #f0c060 89%, #1e0e02 100%
    ) border-box;
  box-shadow:
    0 0 0 1px #1a0c02,
    0 0 0 2px #c8921a,
    inset 0 0 0 1px #fde890;
}

.frame-style-preview.frame-style-gold-rich::after {
  content: none;
}

/* === gold-simple preview === */
.frame-style-preview.frame-style-gold-simple {
  border-width: 4px;
  background:
    linear-gradient(180deg, #f9f3e8 0%, #ece0c8 100%) padding-box,
    linear-gradient(180deg, #8d6a2d 0%, #dcb96d 52%, #7f5f2a 100%) border-box;
  box-shadow:
    inset 0 0 0 4px rgba(255, 249, 235, 0.94),
    inset 0 0 0 8px rgba(198, 153, 70, 0.28);
}

.frame-style-preview.frame-style-gold-simple::after {
  content: none;
}

/* === black-ornament-rich preview === */
.frame-style-preview.frame-style-black-ornament-rich {
  position: relative;
  background:
    linear-gradient(180deg, #f0f0f0 0%, #dadada 100%) padding-box,
    linear-gradient(180deg, #0a0a0a 0%, #3a3a3a 50%, #0a0a0a 100%) border-box;
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.92),
    inset 0 0 0 12px rgba(18, 18, 18, 0.92);
}

.frame-style-preview.frame-style-black-ornament-rich::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid rgba(180,155,90,0.6);
  z-index: 1;
  pointer-events: none;
}

.frame-style-preview.frame-style-black-ornament-rich::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(160,140,80,0.4);
  z-index: 1;
  pointer-events: none;
  box-shadow:
    inset 2px 2px 0 rgba(180,155,90,0.2),
    inset -2px -2px 0 rgba(180,155,90,0.2);
}

/* === muslim-open preview === */
.frame-style-preview.frame-style-muslim-open-left,
.frame-style-preview.frame-style-muslim-open-right {
  border-width: 0;
  background: linear-gradient(180deg, #f6f6f6 0%, #ededed 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* === muslim-black preview === */
.frame-style-preview.frame-style-muslim-black-left,
.frame-style-preview.frame-style-muslim-black-right {
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.94),
    inset 0 0 0 11px rgba(18, 18, 18, 0.94);
}

/* === muslim-marble preview === */
.frame-style-preview.frame-style-muslim-marble-left,
.frame-style-preview.frame-style-muslim-marble-right {
  background:
    linear-gradient(180deg, #f4f4f4 0%, #e7e7e7 100%) padding-box,
    linear-gradient(135deg, #c4c4c4 0%, #f5f5f5 22%, #bfbfbf 48%, #ededed 74%, #afafaf 100%) border-box;
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.94),
    inset 0 0 0 10px rgba(145, 145, 145, 0.24);
}

.frame-style-preview.frame-style-muslim-marble-left::after,
.frame-style-preview.frame-style-muslim-marble-right::after {
  content: none;
}

/* === muslim crescent icons === */
.frame-style-preview.frame-style-muslim-open-left::before,
.frame-style-preview.frame-style-muslim-open-right::before,
.frame-style-preview.frame-style-muslim-black-left::before,
.frame-style-preview.frame-style-muslim-black-right::before,
.frame-style-preview.frame-style-muslim-marble-left::before,
.frame-style-preview.frame-style-muslim-marble-right::before {
  content: "☪";
  position: absolute;
  top: 6px;
  width: 18px;
  height: 18px;
  z-index: 2;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  color: #888;
  pointer-events: none;
}

.frame-style-preview.frame-style-muslim-black-left::before,
.frame-style-preview.frame-style-muslim-black-right::before {
  color: #ccc;
}

.frame-style-preview.frame-style-muslim-open-left::before,
.frame-style-preview.frame-style-muslim-black-left::before,
.frame-style-preview.frame-style-muslim-marble-left::before {
  left: 6px;
}

.frame-style-preview.frame-style-muslim-open-right::before,
.frame-style-preview.frame-style-muslim-black-right::before,
.frame-style-preview.frame-style-muslim-marble-right::before {
  right: 6px;
}

/* Hover zoom for frame preview */
.frame-style-grid {
  overflow: visible;
}

.frame-style-option {
  overflow: visible;
  position: relative;
}

.frame-style-preview {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.frame-style-option:hover {
  z-index: 20;
}

.frame-style-option:hover .frame-style-preview {
  transform: scale(1.3);
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.frame-style-name {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

/* ── Orthodox frames (preview) ── */
.frame-style-preview.frame-style-orthodox-cross,
.frame-style-preview.frame-style-orthodox-cross-spasi,
.frame-style-preview.frame-style-orthodox-black,
.frame-style-preview.frame-style-orthodox-gold {
  position: relative;
  overflow: visible;
}

.frame-style-preview[class*="orthodox"]::before {
  content: "☦";
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 14px;
  line-height: 1;
  color: #444;
  z-index: 2;
}

.frame-style-preview.frame-style-orthodox-gold::before {
  color: #b8960c;
}

.frame-style-preview.frame-style-orthodox-black {
  border-color: #000;
  border-width: 6px;
  background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%) padding-box, #000 border-box;
}

.frame-style-preview.frame-style-orthodox-gold::before,
.frame-style-preview.frame-style-orthodox-gold .memorial-frame-decor::before {
  background: #b8860b;
}

.frame-style-preview.frame-style-orthodox-gold {
  border-width: 5px;
  background:
    linear-gradient(180deg, #faf6ed 0%, #f0e8d8 100%) padding-box,
    linear-gradient(180deg, #c9a84c 0%, #d4af37 50%, #b8960c 100%) border-box;
  border-color: transparent;
}

.frame-style-preview.frame-style-orthodox-cross-spasi::after {
  content: "СиС";
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.45rem;
  font-weight: 700;
  color: #666;
  letter-spacing: 0.05em;
}

.qr-card {
  padding: 10px 24px 24px;
  text-align: center;
  border-width: 3px;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.08);
}

.qr-card img {
  width: min(100%, 250px);
  height: auto;
  margin: 8px auto 16px;
  padding: 12px;
  border-radius: 0;
  border: 3px solid #111;
  background: #fff;
  transition: transform 0.2s ease, box-shadow 0.22s ease;
}

.qr-title,
.profile-code {
  font-weight: 700;
}

.qr-title {
  font-size: 1.05rem;
}

.profile-code {
  margin-bottom: 10px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  word-break: break-word;
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0;
  border: 2px solid #111;
  background: linear-gradient(180deg, #f5f5f5, #e7e7e7);
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transition: transform 0.24s ease, filter 0.24s ease;
}

.photo-thumb:hover {
  transform: translateY(-1px);
}

.photo-thumb:hover img {
  transform: scale(1.02);
}

.photo-thumb .photo-remove {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid #8b0000;
  background: #c60000;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.photo-thumb .photo-remove:hover {
  background: #e00000;
}

.photo-thumb.is-selected {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.22);
}

.photo-thumb.is-hidden {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 14px;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.link-item {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr auto;
  gap: 10px;
}

.offerings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.offerings-grid > .helper-text {
  grid-column: 1 / -1;
}

.offering-tile {
  border-radius: 8px;
  border: 2px solid #ddd;
  padding: 16px 12px;
  text-align: center;
  background: #fff;
  transition:
    transform 0.18s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.offering-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.05);
}

.offering-create-tile {
  display: grid;
  align-content: center;
  gap: 8px;
}

.offering-emoji {
  margin-bottom: 8px;
  font-size: 1.7rem;
}

.offering-count {
  width: 100%;
  margin-top: 10px;
}

.offering-price-label {
  margin-top: 2px;
}

.offering-log {
  margin-top: 14px;
  border-radius: 0;
  border: 2px solid #111;
  padding: 18px;
  background: #fff;
}

.offering-entry {
  padding: 10px 0;
  border-bottom: 1px solid #c9c9c9;
}

.offering-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.offering-remove-button {
  min-height: auto;
  padding: 0.45rem 0.7rem;
  white-space: nowrap;
}

.offering-entry:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Signals */
.signals-summary {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 20px 22px;
  border-radius: 0;
  border: 2px solid #111;
  background: #fff;
}

.summary-output {
  max-width: 360px;
  font-size: 1rem;
  line-height: 1.65;
  color: #111;
}

.signal-card {
  display: grid;
  gap: 14px;
}

.signal-head {
  display: grid;
  gap: 6px;
}

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

/* Old signal-scale track removed — new colored circles in profile-section-block */

.signal-dot {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.92);
}

.signal-dot.signal-tone-low {
  background: #cdeccd;
  border-color: #2f8b42;
  color: #195c26;
}

.signal-dot.signal-tone-mid {
  background: #f5ebad;
  border-color: #c09b1c;
  color: #775e00;
}

.signal-dot.signal-tone-high {
  background: #f7d4d4;
  border-color: #b83a3a;
  color: #7d1313;
}

.signal-dot.is-selected {
  transform: scale(1.08);
}

.signal-dot.is-selected.signal-tone-low {
  background: #35a548;
  border-color: #145622;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(53, 165, 72, 0.18);
}

.signal-dot.is-selected.signal-tone-mid {
  background: #e1b91d;
  border-color: #816500;
  color: #1b1400;
  box-shadow: 0 0 0 4px rgba(225, 185, 29, 0.18);
}

.signal-dot.is-selected.signal-tone-high {
  background: #db4343;
  border-color: #7f1111;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(219, 67, 67, 0.16);
}

.signal-meter {
  position: relative;
  display: block;
  margin-top: 8px;
  width: min(180px, 100%);
  height: 8px;
  border-radius: 999px;
  background: #ececec;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.signal-meter::before {
  display: none;
}

.signal-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.08),
    0 1px 6px rgba(0, 0, 0, 0.08);
}

.signal-meter-fill.signal-tone-low {
  background: #3ea44f;
}

.signal-meter-fill.signal-tone-mid {
  background: #dfbc2a;
}

.signal-meter-fill.signal-tone-high {
  background: #d94a4a;
}

.result-signal-meter {
  margin-top: 10px;
}

.signal-comment-grid {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: start;
}

.signal-audio {
  width: 100%;
}

.recording-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #111;
}

.recording-badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #000;
  opacity: 0.75;
}

.profile-results {
  display: grid;
  gap: 16px;
}

.result-card {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  opacity: 0;
  animation: search-result-enter 0.28s ease forwards;
  animation-delay: calc(var(--result-index, 0) * 0.06s);
}

.result-card img {
  width: 150px;
  height: 190px;
  object-fit: cover;
  border-radius: 0;
  border: 2px solid #111;
  background: linear-gradient(180deg, #efefef, #dcdcdc);
}

.result-type {
  margin: 10px 0;
  color: #111;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.is-readonly {
  background: #fff !important;
  color: #111 !important;
  cursor: default;
}

dialog {
  width: min(520px, calc(100% - 24px));
  border: 2px solid #111;
  border-radius: 0;
  padding: 0;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}

/* Dialogs */
dialog::backdrop {
  background: rgba(0, 0, 0, 0.22);
}

.dialog-form {
  padding: 24px;
}

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

.site-footer {
  width: 100vw;
  margin-top: 54px;
  margin-left: calc(50% - 50vw);
  padding-top: 10px;
  border-top: 1px solid #111;
  text-align: center;
  color: #232323;
  font-size: 0.8rem;
  line-height: 1.45;
}

html[dir="rtl"] body {
  text-align: right;
}

html[dir="rtl"] .header-side {
  justify-items: stretch;
}

html[dir="rtl"] .main-nav,
html[dir="rtl"] .search-row,
html[dir="rtl"] .tabs,
html[dir="rtl"] .profile-meta,
html[dir="rtl"] .header-actions {
  direction: rtl;
}

/* ═══════════════════════════════════════════
   Responsive — Tablet (≤1080px)
   ═══════════════════════════════════════════ */
@media (max-width: 1080px) {
  .home-panels,
  .memorial-layout,
  .memorial-aside,
  .dual-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .memorial-content,
  .memorial-aside,
  .dual-grid {
    display: contents;
  }

  .profile-note-card,
  .portrait-card,
  .memorial-top-stack,
  .memorial-hero-actions,
  .memorial-qr-card,
  .photo-panel,
  #display-name-card,
  #annotation-card,
  #memorial-text-card,
  #offerings-card,
  #track-card,
  #greeting-card,
  #links-card,
  #ai-card {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .memorial-hero-actions {
    justify-content: flex-start;
  }
}

/* ═══════════════════════════════════════════
   Responsive — Phone (≤768px)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Shell ── */
  .shell {
    width: 100%;
    padding: 0 0 24px;
  }

  /* ── Header ── */
  .site-header {
    margin-bottom: 20px;
    padding: 0;
  }

  .masthead {
    margin-bottom: 0;
  }

  .brand-block {
    width: 100%;
    padding: 22px 16px 20px;
    border-left: 0;
    border-right: 0;
  }

  .brand-mark {
    font-size: 2.8rem;
  }

  .motto-bar {
    width: 100%;
    font-size: 0.82rem;
    padding: 8px 14px;
    border-left: 0;
    border-right: 0;
  }

  /* ── Language — fixed pill bottom-right ── */
  .language-switch {
    position: fixed;
    bottom: 14px;
    right: 14px;
    top: auto;
    left: auto;
    width: auto;
    z-index: 200;
    background: #000;
    border: 2px solid #000;
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  }

  .language-switch span {
    display: none;
  }

  .language-switch select {
    font-size: 0.85rem;
    padding: 4px 8px;
    min-width: 110px;
    color: #fff;
    background: #000;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
  }

  /* ── Home button ── */
  .home-corner-button {
    position: fixed;
    bottom: 14px;
    left: 14px;
    top: auto;
    z-index: 200;
    border-radius: 50%;
    padding: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  }

  .home-corner-button svg {
    width: 24px;
    height: 24px;
  }

  /* ── Navigation — 2 columns ── */
  .header-side {
    margin-top: 0;
  }

  .main-nav {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    border-left: 0;
    border-right: 0;
  }

  .nav-button,
  .nav-static-button {
    padding: 12px 8px;
    font-size: 0.82rem;
    min-height: 46px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
  }

  .main-nav > *:nth-child(5n) {
    border-right: 1px solid rgba(255,255,255,0.3);
  }

  .main-nav > *:nth-child(2n) {
    border-right: 0;
  }

  .main-nav > *:last-child {
    border-right: 0;
  }

  /* ── Cards ── */
  .card,
  .hero-card,
  .results-card,
  .database-card,
  .manifest-card {
    padding: 18px 14px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .panel-card {
    padding: 14px 12px;
  }

  .profile-card {
    padding: 12px 8px;
    border-radius: 0;
  }

  /* ── Search ── */
  .search-row {
    flex-direction: column;
  }

  .search-row input[type="search"],
  .search-row input[type="text"] {
    width: 100%;
    font-size: 1rem;
    padding: 12px;
  }

  .search-row button {
    width: 100%;
    min-height: 46px;
  }

  /* ── Content pages ── */
  .content-page {
    padding: 18px 14px;
  }

  .content-page p,
  .content-page li {
    font-size: 0.92rem;
    line-height: 1.6;
  }

  /* ── Payment banner ── */
  .payment-banner {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    text-align: center;
  }

  .payment-banner button {
    width: 100%;
    min-height: 46px;
  }

  /* ── Portrait ── */
  .portrait-card {
    justify-self: center;
    width: 100%;
    max-width: 340px;
  }

  .display-name-card {
    justify-self: center;
    width: 100%;
    max-width: 340px;
  }

  .memorial-frame {
    max-width: 280px;
    margin: 0 auto;
  }

  /* ── Frame styles ── */
  .frame-style-class-list {
    flex-wrap: wrap;
    gap: 6px;
  }

  .frame-style-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  /* ── Photos ── */
  .photo-strip {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  /* ── Section headings ── */
  .section-heading {
    gap: 10px;
  }

  .section-heading.compact {
    flex-direction: column;
    align-items: stretch;
  }

  .section-heading .upload-button,
  .section-heading .secondary-button {
    width: 100%;
    text-align: center;
    min-height: 44px;
  }

  /* ── Dual grid (audio/track) — stack ── */
  .dual-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* ── Links ── */
  .link-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .link-item input {
    font-size: 0.92rem;
    padding: 10px;
  }

  /* ── Offerings ── */
  .offerings-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .offering-tile {
    padding: 8px 4px;
    font-size: 0.72rem;
  }

  .offering-choices-list {
    grid-template-columns: repeat(3, 1fr);
  }

  /* ── QR ── */
  .memorial-qr-card {
    text-align: center;
  }

  .memorial-qr-card img {
    max-width: 200px;
    margin: 0 auto;
  }

  /* ── Memorial text ── */
  #memorial-text {
    font-size: 0.95rem;
    min-height: 120px;
  }

  /* ── History ── */
  .history-fields {
    gap: 12px;
  }

  .history-field textarea,
  .history-field input {
    font-size: 0.92rem;
    padding: 10px;
  }

  /* ── Signals ── */
  .signal-item {
    padding: 12px;
  }

  .signal-scale {
    gap: 4px;
    flex-wrap: wrap;
  }

  .signal-scale-btn {
    min-width: 30px;
    min-height: 30px;
    font-size: 0.8rem;
  }

  .signal-text {
    font-size: 0.9rem;
  }

  .signals-intro {
    padding: 14px;
  }

  .signals-quote {
    font-size: 0.9rem;
  }

  /* ── Social / hero actions ── */
  .memorial-hero-actions {
    gap: 8px;
    flex-wrap: wrap;
  }

  /* ── Settings ── */
  .settings-panel {
    padding: 14px;
  }

  .settings-grid {
    gap: 12px;
  }

  .toggle span {
    font-size: 0.88rem;
  }

  /* ── Auth ── */
  .narrow {
    max-width: 100%;
  }

  .auth-switch {
    flex-direction: row;
  }

  .auth-switch-button {
    flex: 1;
    min-height: 44px;
  }

  .stack-form input {
    font-size: 1rem;
    padding: 12px;
  }

  .stack-form button[type="submit"] {
    min-height: 48px;
    font-size: 1rem;
  }

  /* ── Dialog ── */
  #offering-dialog {
    width: calc(100vw - 20px);
    max-width: 100%;
    padding: 18px;
    border-radius: 12px;
  }

  .dialog-actions {
    flex-direction: column;
    gap: 8px;
  }

  .dialog-actions button {
    width: 100%;
    min-height: 44px;
  }

  /* ── Buttons — touch-friendly ── */
  .secondary-button {
    min-height: 42px;
    padding: 0.5rem 1rem;
    font-size: 0.84rem;
  }

  .upload-button {
    min-height: 42px;
  }

  /* ── Section blocks ── */
  .section-block-header {
    padding: 14px;
  }

  .section-block-header h2 {
    font-size: 1.3rem;
  }

  /* ── Manifest ── */
  .manifest-item {
    font-size: 0.88rem;
    line-height: 1.55;
  }

  /* ── Footer ── */
  .site-footer {
    padding: 18px 14px;
    font-size: 0.84rem;
    margin-bottom: 60px; /* space for fixed language button */
  }

  /* ── Contract ── */
  .contract-page {
    padding: 16px 12px;
  }

  /* ── Comments ── */
  .comments-panel {
    padding: 12px;
  }

  #comment-text {
    font-size: 0.92rem;
    padding: 10px;
  }

  /* ── Helper text ── */
  .helper-text {
    font-size: 0.82rem;
  }

  /* ── Readonly banner ── */
  .readonly-banner {
    font-size: 0.88rem;
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  .upload-button,
  input,
  textarea,
  .select-shell,
  .select-shell::before,
  .select-shell::after,
  select,
  .card,
  .hero-card,
  .results-card,
  .database-card,
  .manifest-card,
  .database-tile,
  .panel-card,
  .result-card,
  .signal-card,
  .frame-style-option,
  .frame-style-preview,
  .photo-thumb,
  .photo-thumb img,
  .offering-tile,
  .view,
  .view.is-active,
  .view.is-leaving {
    animation: none !important;
    transition: none !important;
  }
}
