:root {
  color-scheme: light;
  --bg: #fff7eb;
  --panel: #fffaf2;
  --ink: #1a1a1a;
  --muted: #6f6257;
  --line: #e8d9c8;
  --accent: #c2542e;
  --accent-dark: #97381f;
  --blue: #0f2233;
  --gold: #d4af37;
  --shadow: 0 12px 28px rgba(15, 34, 51, 0.1);
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.crop-open {
  overflow: hidden;
}

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

button,
.file-action,
.photo-picker {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

button:hover,
.file-action:hover,
.photo-picker:hover {
  border-color: #c9b9a5;
}

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

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.danger {
  color: #9d221c;
}

.topbar {
  min-height: 104px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 24px clamp(18px, 5vw, 46px) 18px;
  background: var(--bg);
  color: var(--ink);
}

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

.help-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 8px;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-size: 1.05rem;
  font-weight: 900;
}

.help-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.brand-block {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  gap: 5px;
  width: min(275px, 68vw);
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  justify-items: start;
  justify-content: start;
  align-content: end;
}

.brand-logo {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
  text-transform: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.15rem, 6vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
  color: var(--blue);
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto 110px;
  max-width: calc(100% - 28px);
  overflow-x: hidden;
}

.mobile-nav,
.mobile-detail-head {
  display: none;
}

.compact-save {
  min-height: 38px;
  padding-inline: 16px;
}

.toolbar,
.stats,
.detail-panel,
.list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 11px;
  border-radius: 8px;
}

.search {
  min-width: 0;
}

.search-filter {
  position: relative;
}

.search-filter input {
  padding-right: 52px;
}

.filter-indicator {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  z-index: 1;
  width: 42px;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  color: var(--blue);
  pointer-events: none;
}

.filter-icon {
  position: relative;
  width: 21px;
  height: 16px;
  display: block;
}

.filter-icon::before,
.filter-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
}

.filter-icon::after {
  left: 3px;
  right: auto;
  top: -3px;
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: #fffaf2;
  box-shadow: 10px 7px 0 -1px #fffaf2, 10px 7px 0 1px currentColor, 2px 14px 0 -1px #fffaf2, 2px 14px 0 1px currentColor;
}

.filter-indicator.has-filter {
  color: var(--accent);
}

.filter-indicator.has-filter::after {
  content: attr(data-short);
  position: absolute;
  right: 2px;
  top: 2px;
  min-width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fffaf2;
  font-size: 0.58rem;
  font-weight: 900;
}

.search-filter select {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
  width: 50px;
  height: 100%;
  opacity: 0;
  color: var(--blue);
  cursor: pointer;
}

label span,
.search span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 247, 0.94);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(183, 51, 43, 0.13);
}

.import-action {
  white-space: nowrap;
  min-height: 45px;
  align-self: end;
}

.file-action input,
.photo-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.stats {
  margin-top: 8px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.stats > div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.stats > div:last-child {
  border-right: 0;
}

.stats strong {
  display: inline-block;
  color: var(--blue);
  font-size: 1rem;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  margin: 0;
  text-align: center;
}

.stat-rating {
  align-items: center;
}

.stat-rating .stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.stat-rating-value {
  min-width: 0;
}

.stat-rating-value .rating-stars-display {
  margin-top: 0;
  gap: 2px;
}

.stat-rating-value .rating-star-box {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: #e7e7e7;
  color: white;
  font-size: 0.68rem;
}

.stat-rating-value .rating-star-fill {
  background: #c2542e;
}

.stat-rating-value .rating-star-symbol {
  color: white;
}

.stat-rating-value .rating-number {
  font-size: 0.74rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  margin-top: 14px;
  max-width: 100%;
  overflow-x: hidden;
}

.privacy-note {
  margin-top: 14px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.privacy-note p {
  margin: 0;
}

.list-panel,
.detail-panel {
  border-radius: 8px;
  min-width: 0;
}

.list-panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  align-self: start;
  max-height: calc(100vh - 230px);
  overflow: auto;
}

.pizza-list {
  display: grid;
  gap: 11px;
}

.pizza-card {
  width: 100%;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: var(--shadow);
}

.pizza-card.active {
  border-color: rgba(15, 34, 51, 0.18);
  box-shadow: 0 0 0 2px rgba(15, 34, 51, 0.08), var(--shadow);
}

.thumb {
  width: 128px;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #eef1f2;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 900;
}

.thumb img,
.photo-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.18s ease, object-position 0.18s ease;
}

.thumb.empty-thumb {
  padding: 16px;
  background: linear-gradient(145deg, #fffaf2, #eef1f2);
}

.thumb.empty-thumb img {
  max-width: 100%;
  width: 50px;
  height: auto;
  object-fit: contain;
}

.thumb.empty-thumb span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.card-title {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.05;
  color: var(--blue);
}

.card-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.rating-stars-display {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
}

.rating-star-box {
  position: relative;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 3px;
  background: #e7e7e7;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.78rem;
  line-height: 1;
}

.rating-star-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill);
  background: var(--accent);
}

.rating-star-symbol {
  position: relative;
  z-index: 1;
}

.rating-number {
  margin-left: 5px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.tag-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.tag {
  border-radius: 999px;
  background: #f3dfce;
  color: #8a3d24;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
}

.empty-symbol {
  display: block;
  max-width: 100%;
  width: 70px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 12px;
}

.empty-state p {
  color: var(--muted);
}

.pizza-form {
  display: grid;
  gap: 15px;
  padding: 16px;
  max-width: 100%;
  overflow-x: hidden;
}

.form-head,
.field-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.form-head label,
.field-grid label {
  min-width: 0;
}

.form-head input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}

.form-head {
  grid-template-columns: 1fr 180px;
}

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

.photo-preview {
  aspect-ratio: 4 / 3;
  min-height: 0;
  border: 1px dashed #c9b9a5;
  border-radius: 8px;
  background: #eee3d6;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.photo-preview.has-photo {
  position: relative;
  cursor: pointer;
}

.photo-preview.crop-mode::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255, 250, 242, 0.92);
  border-radius: 6px;
  box-shadow: 0 0 0 999px rgba(15, 34, 51, 0.16);
  pointer-events: none;
}

.photo-preview.crop-mode::before {
  content: "Trascina per posizionare";
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  border-radius: 999px;
  background: rgba(15, 34, 51, 0.74);
  color: white;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 800;
  pointer-events: none;
}

.photo-preview.draft-photo::before {
  content: "Da confermare";
}

.photo-preview.has-photo img {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: none;
}

.photo-preview.dragging {
  cursor: grabbing;
}

.photo-preview.dragging::before {
  content: "Ritaglio manuale";
}

.full-photo-reference {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 3;
  width: 76px;
  height: 58px;
  border: 2px solid rgba(255, 250, 242, 0.96);
  border-radius: 6px;
  background: rgba(238, 227, 214, 0.92);
  box-shadow: 0 8px 22px rgba(15, 34, 51, 0.2);
  overflow: hidden;
  pointer-events: none;
}

.full-photo-reference img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform: none;
}

.photos-section {
  display: grid;
  gap: 12px;
}

.photo-slot {
  display: grid;
  gap: 8px;
}

.main-photo {
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: end;
}

.main-photo-tools {
  display: grid;
  gap: 8px;
}

.photo-adjust {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.86);
  overflow: hidden;
}

.photo-adjust summary {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.photo-adjust-grid {
  display: grid;
  gap: 9px;
  padding: 0 10px 10px;
}

.photo-adjust-grid select,
.photo-adjust-grid input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

.zoom-control span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.zoom-control b {
  color: var(--blue);
}

.zoom-control input {
  padding-inline: 0;
  accent-color: var(--accent);
}

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

.photo-nudge button {
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
}

.confirm-photo-btn {
  width: 100%;
  min-height: 38px;
  font-size: 0.86rem;
}

.confirm-photo-btn:disabled {
  opacity: 0.62;
}

.secondary-photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.secondary-photo {
  position: relative;
  align-content: start;
}

.secondary-photo .photo-preview {
  position: relative;
}

.secondary-photo .photo-preview {
  border-style: solid;
}

.secondary-photo .photo-preview span {
  color: #a7784d;
  font-size: 1.7rem;
}

.icon-picker {
  position: absolute;
  right: 8px;
  top: 68px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  background: rgba(33, 25, 20, 0.86);
  border-color: rgba(33, 25, 20, 0.86);
  color: white;
  font-size: 1.25rem;
  line-height: 1;
}

.photo-label-select {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.secondary-photo-adjust summary {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.secondary-photo-adjust .photo-adjust-grid {
  gap: 7px;
  padding: 0 8px 8px;
}

.secondary-photo-adjust .photo-adjust-grid select,
.secondary-photo-adjust .photo-adjust-grid input {
  min-height: 34px;
  font-size: 0.78rem;
}

.photo-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(33, 25, 20, 0.78);
  color: white;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.photo-preview.small {
  aspect-ratio: 1;
  min-height: 0;
}

.photo-edit-btn {
  width: 100%;
  min-height: 42px;
  font-size: 0.86rem;
}

.form-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
}

.form-actions button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
  padding: 0 6px;
  font-size: 0.78rem;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(98px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: #202124;
  color: white;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: min(520px, calc(100% - 24px));
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 34, 51, 0.34);
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(430px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(15, 34, 51, 0.18);
  padding: 18px;
}

.modal-panel h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--blue);
  font-size: 1.25rem;
}

.modal-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.4;
}

.install-ios-guide {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.install-ios-guide img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.install-steps {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
}

.install-steps div {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.install-steps strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #c2542e;
  color: #fffaf2;
  font-size: 0.82rem;
}

.backup-panel {
  display: grid;
  gap: 12px;
}

.storage-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 247, 0.72);
}

.storage-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 900;
}

.storage-summary-head strong {
  text-align: right;
}

.storage-bar {
  height: 8px;
  border-radius: 999px;
  background: #eadfce;
  overflow: hidden;
}

.storage-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #c2542e;
  transition: width 0.2s ease;
}

.storage-bar span.is-low {
  background: #9d221c;
}

.storage-summary p,
.backup-import-choice p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.backup-actions,
.backup-choice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.backup-import-choice {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(194, 84, 46, 0.25);
  border-radius: 8px;
  background: rgba(242, 225, 207, 0.45);
}

.backup-import-choice[hidden] {
  display: none;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 34, 51, 0.52);
}

.crop-modal[hidden] {
  display: none;
}

.crop-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto auto;
  gap: 12px;
  border: 1px solid rgba(255, 250, 242, 0.32);
  border-radius: 8px;
  background: #211914;
  color: #fffaf2;
  box-shadow: 0 22px 58px rgba(15, 34, 51, 0.34);
  padding: 14px;
}

.crop-top,
.crop-actions,
.crop-zoom span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crop-top h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

#cropCloseBtn {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-color: rgba(255, 250, 242, 0.3);
  background: rgba(255, 250, 242, 0.1);
  color: #fffaf2;
  font-size: 1.25rem;
}

.crop-stage {
  position: relative;
  min-height: 280px;
  max-height: min(62vh, 560px);
  border-radius: 8px;
  background: #0f2233;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.crop-stage.dragging {
  cursor: grabbing;
}

.crop-image {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
  will-change: transform, width;
}

.crop-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78vw, 520px);
  max-width: calc(100% - 52px);
  aspect-ratio: 4 / 3;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 250, 242, 0.8);
  background:
    linear-gradient(#fffaf2, #fffaf2) left top / 28px 5px no-repeat,
    linear-gradient(#fffaf2, #fffaf2) left top / 5px 28px no-repeat,
    linear-gradient(#fffaf2, #fffaf2) right top / 28px 5px no-repeat,
    linear-gradient(#fffaf2, #fffaf2) right top / 5px 28px no-repeat,
    linear-gradient(#fffaf2, #fffaf2) left bottom / 28px 5px no-repeat,
    linear-gradient(#fffaf2, #fffaf2) left bottom / 5px 28px no-repeat,
    linear-gradient(#fffaf2, #fffaf2) right bottom / 28px 5px no-repeat,
    linear-gradient(#fffaf2, #fffaf2) right bottom / 5px 28px no-repeat;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
  pointer-events: none;
}

.crop-zoom {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.crop-zoom input {
  width: 100%;
  accent-color: var(--accent);
}

.crop-actions button {
  flex: 1 1 0;
}

.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 34, 51, 0.38);
}

.guide-modal[hidden] {
  display: none;
}

.guide-panel {
  width: min(420px, 100%);
  aspect-ratio: 9 / 16;
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 18px 46px rgba(15, 34, 51, 0.22);
  padding: 16px;
}

.guide-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

#guideCloseBtn {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 8px;
  color: var(--blue);
  font-size: 1.25rem;
}

.guide-slide {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 13px;
  padding: 8px 2px;
}

.guide-visual {
  min-height: 126px;
  display: grid;
  place-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  padding: 14px;
}

.guide-visual img {
  display: block;
  max-width: min(260px, 82%);
  height: auto;
  object-fit: contain;
}

.guide-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: 2.4rem;
  font-weight: 900;
}

.guide-visual-phone .guide-mark,
.guide-visual-backup .guide-mark {
  background: var(--accent);
}

.guide-visual-photo .guide-mark,
.guide-visual-privacy .guide-mark {
  background: var(--gold);
  color: var(--blue);
}

.guide-chip-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.guide-chip-row span {
  border-radius: 999px;
  background: #f3dfce;
  color: #8a3d24;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.guide-slide h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--blue);
  font-size: clamp(1.75rem, 8vw, 2.35rem);
  line-height: 1.05;
}

.guide-slide p {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.42;
}

.guide-slide .guide-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.guide-credit {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  margin-top: 18px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
}

.guide-credit:hover {
  color: var(--accent);
}

.instagram-mark {
  position: relative;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.instagram-mark::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.instagram-mark::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.guide-slide ul {
  margin: 0;
  padding-left: 18px;
  color: var(--blue);
  font-weight: 800;
  line-height: 1.45;
}

.guide-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.guide-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #e7d7c6;
}

.guide-dots span.active {
  width: 18px;
  background: var(--accent);
}

.guide-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  width: min(420px, calc(100% - 30px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 16px 36px rgba(15, 34, 51, 0.14);
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  min-height: 54px;
  display: grid;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
}

.bottom-nav button span {
  font-size: 1.35rem;
  line-height: 1;
}

.bottom-nav button.active {
  color: var(--accent);
}

@media (max-width: 820px) {
  .crop-modal {
    padding: 10px;
  }

  .crop-panel {
    max-height: calc(100dvh - 20px);
    grid-template-rows: auto minmax(260px, 1fr) auto auto;
    padding: 12px;
  }

  .crop-stage {
    min-height: 260px;
    max-height: 58dvh;
  }

  .crop-frame {
    width: min(82vw, 430px);
    max-width: calc(100% - 34px);
  }

  body[data-view="list"] .detail-panel,
  body[data-view="detail"] .toolbar,
  body[data-view="detail"] .stats,
  body[data-view="detail"] .list-panel {
    display: none;
  }

  .mobile-nav {
    display: none;
  }

  .mobile-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 2px;
  }

  .mobile-detail-head span {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
  }

  .toolbar,
  .content-grid,
  .form-head,
  .field-grid,
  .main-photo,
  .secondary-photos {
    grid-template-columns: 1fr;
  }

  .secondary-photos {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-head input[type="date"] {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .topbar {
    min-height: 104px;
    align-items: end;
  }

  .topbar .primary {
    display: none;
  }

  .shell {
    width: min(430px, calc(100% - 28px));
    max-width: calc(100% - 28px);
  }

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

  .stats > div {
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: 5px 5px;
  }

  .stats > div:last-child {
    border-right: 0;
  }

  .stats strong {
    font-size: 1rem;
  }

  .stats span {
    font-size: 0.72rem;
  }

  .form-actions {
    gap: 5px;
  }

  .form-actions button {
    min-height: 36px;
    padding: 0 4px;
    font-size: 0.72rem;
  }

  .list-panel {
    max-height: none;
  }

  .photo-preview {
    min-height: 0;
  }

  .secondary-photo .photo-preview {
    min-height: 0;
  }

  .secondary-photo .icon-picker {
    top: 88px;
  }

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

  .pizza-card {
    grid-template-columns: 126px minmax(0, 1fr);
    min-height: 0;
  }

  .thumb {
    width: 126px;
    height: auto;
  }
}

@media (max-width: 430px) {
  .backup-choice-actions {
    grid-template-columns: 1fr;
  }

  .pizza-card {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .thumb {
    width: 118px;
    height: auto;
  }

  .card-title {
    font-size: 1rem;
  }

  .rating-star-box {
    width: 16px;
    height: 16px;
    font-size: 0.7rem;
  }

  .trust-value,
  .rating-number {
    font-size: 0.78rem;
  }
}
