:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #6a737d;
  --line: #dbe1e6;
  --line-strong: #c7d0d8;
  --accent: #117865;
  --accent-dark: #075c4c;
  --accent-soft: #e5f3ef;
  --accent-ring: rgba(17, 120, 101, 0.16);
  --danger: #bf3f31;
  --danger-soft: #fff0ed;
  --warn-soft: #fff2de;
  --shadow: 0 18px 44px rgba(26, 36, 46, 0.08);
  --shadow-soft: 0 8px 24px rgba(26, 36, 46, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef4f1 0, rgba(238, 244, 241, 0) 310px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

@media (hover: hover) and (pointer: fine) {
  button:hover { background: var(--accent-dark); }
}

button:focus { outline: none; }
button:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #f1f5f4;
  border-color: #d5dfdc;
  color: var(--ink);
}

button.secondary:hover {
  background: #e6eeeb;
}

button.warning {
  background: var(--danger);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  min-height: 44px;
  color: var(--ink);
  outline: none;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  padding: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 120, 101, 0.12);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

a {
  color: var(--accent-dark);
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 850;
}

.brand p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #e6ecea;
  border: 1px solid #d7e1de;
  border-radius: 8px;
  padding: 5px;
  margin: 14px 0 16px;
}

.tabs button {
  background: transparent;
  color: #5f6968;
  min-height: 38px;
  padding: 0 8px;
}

.tabs button:hover,
.tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(27, 31, 36, 0.07);
}

.section {
  margin-top: 16px;
}

.guest-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.login-panel {
  width: min(480px, 100%);
  margin: 34px auto 0;
  padding: 22px;
}

.admin-login {
  border-top: 4px solid #263238;
}

.login-mark {
  width: fit-content;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 850;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(31, 43, 54, 0.05);
}

.metric.good {
  background: var(--accent-soft);
  border-color: #badcd4;
}

.metric-value {
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
}

.metric-label {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

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

.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row.wrap {
  flex-wrap: wrap;
}

.field label {
  display: block;
  color: #4f5b62;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
}

.guest-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 9px;
  min-width: 0;
  overflow: hidden;
}

.guest-card:hover {
  border-color: #b7c9c4;
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  font-weight: 800;
  min-width: 0;
}

.card-title > div:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  min-height: 28px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.rank-list {
  display: grid;
  gap: 9px;
}

.rank-item {
  display: grid;
  grid-template-columns: 36px 1fr 82px 36px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.rank-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #23302f;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.rank-actions {
  display: grid;
  grid-template-columns: repeat(2, 36px);
  gap: 6px;
}

.icon-btn {
  min-width: 36px;
  width: 36px;
  padding: 0;
  background: #eef3f1;
  border-color: #dae4e1;
  color: var(--ink);
}

.icon-btn:hover {
  background: #dfe9e6;
}

.empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fbfcfc;
}

.status {
  margin-top: 4px;
  min-height: 20px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.admin-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}

/* Keep the guest-management page tall enough for stable mobile keyboard scrolling. */
.admin-card-list:not(.compact) {
  min-height: 56vh;
  align-content: start;
  padding-bottom: 18vh;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-toolbar > div {
  min-width: 0;
}

.admin-list-tools {
  justify-content: flex-end;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  border: 1px solid #d7e1de;
  border-radius: 999px;
  background: #edf3f1;
  padding: 4px;
}

.segmented-control button {
  min-height: 32px;
  border-radius: 999px;
  background: transparent;
  color: #5d6a67;
  padding: 0 13px;
  box-shadow: none;
  font-size: 13px;
}

.segmented-control button:hover,
.segmented-control button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(27, 31, 36, 0.08);
}

.admin-setting-actions {
  justify-content: flex-end;
}

.admin-setting-panel {
  display: grid;
  gap: 10px;
  min-width: min(520px, 100%);
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 13px;
  color: #34413f;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.snapshot-save-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.ui-chat-btn { position: relative; min-height: 34px; padding: 0 12px; border-radius: 18px; background: #f2f5f4; color: #1b2a28; border: 1px solid #dbe5e1; }
.ui-chat-badge { position:absolute; top:-7px; right:-7px; min-width:18px; height:18px; padding:0 5px; display:none; align-items:center; justify-content:center; border:2px solid #fff; border-radius:999px; background:#e5484d; color:#fff; font-size:10px; line-height:1; font-weight:800; box-shadow:0 2px 6px rgba(229,72,77,.35); }
.ui-chat-badge.visible { display:inline-flex; }
.chat-screen { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; background: #f7f9f8; }
.chat-screen.ChatApp { background: #f5f7fa; color: #1f2933; }
.chat-screen.ChatApp .chat-header { flex: 0 0 58px; min-height: 58px; padding: 0 14px; background: #fff; box-shadow: 0 1px 0 rgba(31,41,55,.08); z-index: 2; }
.chat-screen.ChatApp .chat-header strong { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.chat-header-actions { gap: 10px; margin-left: auto; }
.chat-header-clear { min-height: 30px; padding: 0 10px; border-radius: 15px; }
.chat-screen.ChatApp .chat-back { color: #1677ff; font-size: 32px; }
.chat-screen.ChatApp .chat-list { flex: 1 1 0; background: #f5f7fa; padding: 18px 14px 12px; }
.chat-screen.ChatApp .chat-bubble { border-radius: 8px 16px 16px 16px; border: 1px solid #e7ebf0; box-shadow: 0 2px 5px rgba(31,41,55,.06); font-size: 15px; line-height: 1.5; }
.chat-screen.ChatApp .mine .chat-bubble { border: 0; border-radius: 16px 8px 16px 16px; background: #1677ff; box-shadow: 0 3px 8px rgba(22,119,255,.22); }
.chat-screen.ChatApp .chat-composer { flex: 0 0 auto; min-height: 64px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -1px 0 rgba(31,41,55,.08); z-index: 2; }
.chat-screen.ChatApp .chat-input { background: #f2f4f7; border-color: transparent; }
.chat-screen.ChatApp .chat-send-btn { background: #1677ff; }
.chat-screen.ChatApp .chat-photo-btn { background: #f0f2f5; color: #1677ff; }
.ui-wrapper.chat-wrapper { height: 100vh; min-height: 100vh; overflow: hidden; align-items: stretch; }
.ui-phone.chat-phone { height: 100dvh; max-height: none; overflow: hidden; }
.chat-phone .chat-screen { flex: 1 1 auto; height: auto; min-height: 0; }
.chat-screen.ChatApp { position: relative; overflow: hidden; }
.chat-screen.ChatApp .chat-list { padding-bottom: 156px; }
.chat-screen.ChatApp .chat-composer { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; }
body.chat-view-open { overflow: hidden; position: fixed; top: 0; left: 0; width: 100%; height: 100%; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: rgba(255,255,255,.88); border-bottom: 1px solid #e6ece9; }
.chat-back { min-height: 32px; width: 36px; padding: 0; background: transparent; color: #167561; font-size: 30px; }
.chat-anonymous-toggle { display: flex; align-items: center; gap: 6px; color: #68736f; font-size: 12px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px; overscroll-behavior: contain; }
.chat-message { position: relative; display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 14px; padding-left: 42px; }
.chat-message.mine { align-items: flex-end; padding-left: 0; padding-right: 42px; }
.chat-author-line { display: block; margin: 0 4px 4px; }
.chat-author, .chat-time { color: #8a9490; font-size: 11px; margin: 0; }
.chat-author { font-size: 14px; font-weight: 650; color: #55625e; margin-bottom: 5px; }
.chat-avatar { position: absolute; left: 0; top: 20px; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 750; line-height: 32px; text-align: center; box-shadow: 0 2px 6px rgba(20,35,45,.14); }
.mine .chat-avatar { left: auto; right: 0; }
.mine .chat-author { color: #1677ff; }
.chat-time { margin: 4px 4px 0; }
.chat-bubble { max-width: 78%; padding: 10px 13px; border-radius: 17px 17px 17px 5px; background: #fff; color: #27312f; box-shadow: 0 3px 12px rgba(35,55,49,.07); white-space: pre-wrap; overflow-wrap: anywhere; }
.mine .chat-bubble { border-radius: 17px 17px 5px 17px; background: #167b67; color: #fff; }
.chat-image { display: block; max-width: 220px; max-height: 260px; border-radius: 14px; object-fit: cover; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.chat-image { cursor: zoom-in; }
.chat-image-protected { width: 220px; height: 260px; border-radius: 14px; background-color: #eef1f4; background-repeat: no-repeat; background-position: center; background-size: contain; cursor: zoom-in; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.chat-image-large { width: min(94vw, 760px); height: min(88vh, 760px); max-width: 94vw; max-height: 88vh; border-radius: 10px; background-color: transparent; cursor: default; }
.chat-image-modal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 18px; background: rgba(8, 14, 20, .82); backdrop-filter: blur(8px); }
.chat-image-viewer { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.chat-image-viewer img { display: block; max-width: min(94vw, 760px); max-height: 88vh; width: auto; height: auto; border-radius: 10px; object-fit: contain; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.chat-image-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.chat-image-watermark-item {
  color: rgba(255,255,255,.2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  transform: rotate(-24deg);
  text-shadow: 0 1px 3px rgba(0,0,0,.65);
  user-select: none;
}
.chat-image-watermark-item.is-center {
  color: rgba(255,255,255,.62);
  font-size: 17px;
  text-shadow: 0 1px 4px rgba(0,0,0,.72);
}
.chat-image-close { position: fixed; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); width: 42px; height: 42px; min-height: 42px; padding: 0; z-index: 2; border-radius: 50%; background: rgba(255,255,255,.94); color: #263238; font-size: 26px; line-height: 1; }
body.chat-image-open { overflow: hidden; touch-action: none; }
.chat-empty { padding: 48px 12px; color: #98a39f; text-align: center; font-size: 14px; }
.chat-new-indicator { position: absolute; left: 50%; bottom: 76px; z-index: 3; min-height: 30px; padding: 0 14px; border: 0; border-radius: 16px; background: #1677ff; color: #fff; box-shadow: 0 5px 16px rgba(22,119,255,.28); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .2s ease, transform .2s ease; }
.chat-new-indicator.visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.chat-message { animation: chat-message-in .2s ease-out; }
@keyframes chat-message-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-composer { display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.94); border-top: 1px solid #e5ebe8; }
.chat-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 120px;
  height: 40px;
  overflow-y: auto;
  border-radius: 20px;
  padding: 9px 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
  cursor: text;
  caret-color: #1677ff;
  -webkit-user-modify: read-write-plaintext-only;
  -webkit-tap-highlight-color: transparent;
}
.chat-input:empty::before {
  content: attr(data-placeholder);
  color: #98a2ad;
  pointer-events: none;
}
/* WebKit has no public API for dismissing its input accessory view, but these
   declarations prevent the editable surface from being treated like a
   navigable form field on Safari. */
.chat-input {
  -webkit-appearance: none;
  -webkit-user-select: text;
  -webkit-touch-callout: none;
}
@supports (-webkit-touch-callout: none) {
  .chat-input[contenteditable="true"] {
    -webkit-user-modify: read-write-plaintext-only;
  }
}
.chat-send-btn { min-height: 40px; padding: 0 14px; border-radius: 20px; }
.chat-photo-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #eef3f1; color: #167561; font-size: 24px; cursor: pointer; }
.chat-photo-btn input { display: none; }
.chat-delete-btn, .chat-clear-btn { min-height: 24px; padding: 0 8px; border-radius: 12px; background: #fff0ed; color: #b33b2f; border: 1px solid #f0c8c1; font-size: 11px; }
.chat-message-menu { position: fixed; inset: 0; z-index: 3100; display: grid; place-items: center; background: rgba(10,18,24,.28); backdrop-filter: blur(3px); }
.chat-message-menu-panel { display: grid; gap: 10px; width: min(280px, calc(100vw - 40px)); padding: 16px; border-radius: 16px; background: #fff; box-shadow: 0 18px 50px rgba(10,20,30,.2); }
.chat-message-menu-panel button { width: 100%; }
.chat-color-modal { position: fixed; inset: 0; z-index: 3200; display: grid; place-items: center; background: rgba(10,18,24,.3); backdrop-filter: blur(4px); }
.chat-color-panel { display: grid; gap: 14px; width: min(300px, calc(100vw - 40px)); padding: 18px; border-radius: 18px; background: #fff; box-shadow: 0 20px 60px rgba(10,20,30,.2); }
.chat-color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.chat-color-option { width: 42px; height: 42px; min-height: 42px; padding: 0; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #d9e0e5; }

/* Stable mobile chat viewport:
   the page itself never scrolls; only the message pane does. The visual
   viewport height is changed when the keyboard opens, while the header and
   composer stay in the same grid and never get translated. */
.ui-wrapper.chat-wrapper {
  position: fixed;
  inset: 0;
  height: var(--chat-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
  overscroll-behavior: none;
}
.ui-phone.chat-phone {
  width: min(414px, 100%);
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}
.chat-screen.ChatApp {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}
.chat-screen.ChatApp .chat-header {
  grid-row: 1;
  flex: none;
  min-height: 58px;
  position: relative;
  z-index: 4;
}
.chat-screen.ChatApp .chat-list {
  grid-row: 2;
  min-height: 0;
  height: auto;
  flex: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 14px 18px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}
.chat-screen.ChatApp .chat-composer {
  grid-row: 3;
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  min-height: 64px;
  flex: none;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 4;
}
.chat-screen.ChatApp .chat-new-indicator {
  grid-row: 2;
  align-self: end;
  justify-self: center;
  position: absolute;
  bottom: 76px;
}
body.chat-view-open {
  position: static;
  width: auto;
  height: auto;
  overflow: hidden;
  overscroll-behavior: none;
}
html:has(body.chat-view-open),
body.chat-view-open #app {
  height: 100%;
  min-height: 0;
}

.snapshot-save-hint {
  padding: 4px 2px;
}


.snapshot-toolbar-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.snapshot-list {
  display: grid;
  gap: 7px;
}

.snapshot-item {
  overflow: hidden;
  border: 1px solid #e3ebe8;
  border-radius: 10px;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.snapshot-item.expanded {
  border-color: #b9d8d0;
  box-shadow: 0 6px 18px rgba(35, 71, 65, .08);
}

.snapshot-row,
.snapshot-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: rgba(247, 250, 249, 0.82);
  padding: 8px 10px;
}

.snapshot-preview-row {
  border: 1px solid #edf2f1;
  border-radius: 10px;
}

.snapshot-summary {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  box-shadow: none;
}

.snapshot-summary:hover { background: transparent; }
.snapshot-summary > span:last-child { min-width: 0; }
.snapshot-chevron {
  width: 20px;
  color: var(--accent-dark);
  font-size: 20px;
  line-height: 1;
  text-align: center;
}

.snapshot-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.snapshot-inline-detail {
  display: grid;
  gap: 8px;
  border-top: 1px solid #e7efed;
  padding: 10px;
  background: #fbfdfc;
  animation: snapshot-expand .2s ease-out;
}

@keyframes snapshot-expand {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.snapshot-name-panel { max-width: 440px !important; }
.snapshot-records-panel {
  max-width: 620px !important;
  height: min(720px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.snapshot-modal-list {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

@media (max-width: 560px) {
  .snapshot-save-row { grid-template-columns: 1fr; }
  .snapshot-toolbar-actions { justify-content: stretch; }
  .snapshot-toolbar-actions button { flex: 1; }
  .snapshot-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .snapshot-actions { justify-content: flex-end; }
  .snapshot-actions .action-chip { flex: 1; }
  .snapshot-records-panel { height: calc(100vh - 24px); max-height: calc(100vh - 24px); }
}

.snapshot-row strong,
.snapshot-preview-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.snapshot-preview {
  max-width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
}

.snapshot-preview-list {
  display: grid;
  gap: 8px;
}

.snapshot-choice-tags {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.admin-card-list.compact {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.admin-card {
  position: relative;
  display: grid;
  gap: 14px;
  border: 1px solid rgba(205, 216, 222, 0.82);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfd 100%);
  padding: 15px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.admin-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #5fae9e);
  opacity: 0.72;
}

.admin-card:hover {
  border-color: #b9cec8;
  box-shadow: 0 16px 36px rgba(26, 36, 46, 0.1);
  transform: translateY(-1px);
}

.admin-card.is-editing {
  border-color: #92c8ba;
  background: linear-gradient(180deg, #fbfffe 0%, #f6fbf9 100%);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-soft);
}

.admin-card-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.admin-card-title {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.admin-card-badges {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  flex: 0 0 auto;
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  height: 30px;
  border-radius: 999px;
  border-color: #dce5e2;
  background: #f3f6f5;
  color: #63706e;
  padding: 0 10px 0 5px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 850;
}

.status-toggle:hover {
  background: #eaf0ee;
  color: #2c3836;
}

.status-toggle:active {
  transform: scale(0.97);
}

.status-toggle-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #cbd5d2;
  transition: background 180ms ease;
}

.status-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(20, 28, 34, 0.22);
  transition: transform 180ms ease;
}

.status-toggle.is-on {
  border-color: #9fd0c4;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.status-toggle.is-on:hover {
  background: #d6eee8;
}

.status-toggle.is-on .status-toggle-track {
  background: var(--accent);
}

.status-toggle.is-on .status-toggle-knob {
  transform: translateX(14px);
}

.muted-pill {
  background: #eef1f1;
  color: #697574;
}

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

.info-item {
  min-width: 0;
  border: 1px solid #edf2f1;
  border-radius: 9px;
  background: rgba(247, 250, 249, 0.86);
  padding: 7px 9px;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.info-item strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
}

.admin-actions button {
  min-height: 0;
}

.action-chip {
  min-height: 30px;
  height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  background: #f6f8f8;
  border-color: #dce5e2;
  color: #3d4a48;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}

.action-chip:hover {
  background: #edf3f1;
  border-color: #c9d8d4;
  color: #1c2c2a;
}

.primary-chip {
  background: var(--accent-soft);
  border-color: #b9ded5;
  color: var(--accent-dark);
}

.primary-chip:hover {
  background: #d6eee8;
  border-color: #9fd0c4;
  color: #064f43;
}

.danger-chip {
  background: #fff7f5;
  border-color: #f1cbc4;
  color: #9e3327;
}

.danger-chip:hover {
  background: var(--danger-soft);
  border-color: #e8afa5;
  color: #82281f;
}

.solid-danger {
  background: #fbe5e1;
  border-color: #e9b7af;
  color: #8f2d24;
}

.solid-danger:hover {
  background: #f5d4ce;
  border-color: #da9e94;
}

.pair-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 42px;
  gap: 8px;
  align-items: end;
}

.match-tab,
.match-toolbar,
.match-editor { width: 100%; min-width: 0; max-width: 100%; }
.match-toolbar, .match-editor { overflow: hidden; }
.match-toolbar .row { width: 100%; min-width: 0; }
.match-toolbar .row button { flex: 0 1 auto; min-width: 0; }
.match-editor { padding: 16px; }
.match-editor .pair-row { width: 100%; min-width: 0; }
.pair-row select { min-width: 0; max-width: 100%; }

.pair-meta {
  grid-column: 1 / -1;
}

.canvas-wrap {
  width: 100%;
  overflow-x: auto;
}

#resultCanvas {
  display: none;
}

.result-image {
  display: block;
  width: min(100%, 900px);
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  user-select: auto;
  -webkit-user-drag: auto;
  -webkit-touch-callout: default;
  touch-action: auto;
}

@media (max-width: 720px) {
  body {
    background: var(--bg);
  }

  .shell {
    max-width: 430px;
    padding: 18px 14px 40px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand h1 {
    font-size: 24px;
  }

  .grid,
  .grid.three,
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    padding: 12px;
  }

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

  .admin-card-list,
  .admin-card-list.compact {
    grid-template-columns: 1fr;
  }

  .admin-card-list:not(.compact) {
    min-height: 62vh;
    padding-bottom: 24vh;
  }

  .admin-toolbar {
    display: grid;
  }

  .admin-toolbar button {
    width: 100%;
  }

  .admin-card {
    padding: 12px;
  }

  .admin-card-head {
    display: grid;
    gap: 8px;
  }

  .admin-card-badges {
    justify-content: flex-start;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

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

  .guest-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .panel {
    padding: 14px;
  }

  .login-panel {
    margin-top: 18px;
  }

  .pair-row {
    grid-template-columns: 1fr;
  }

  .pair-row .icon-btn {
    width: 100%;
  }

  .rank-item {
    grid-template-columns: 34px 1fr 36px;
  }

  .rank-actions {
    grid-column: 2 / 3;
    grid-row: 2;
  }
}
.modal-overlay { position: fixed; inset: 0; background: rgba(8,18,24,0.56); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-overlay .panel { max-width: 480px; width: 100%; box-shadow: 0 24px 64px rgba(0,0,0,0.2); }
.admin-choice-modal { align-items: center; overscroll-behavior: contain; touch-action: none; }
.admin-choice-modal-panel { width: min(520px, calc(100vw - 32px)); max-height: min(680px, calc(100vh - 32px)); display:flex; flex-direction:column; overflow:hidden; gap:12px; }
.admin-choice-modal-panel > .card-title { flex:0 0 auto; }
.admin-choice-modal-list { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; touch-action:pan-y; padding:4px 2px 12px; align-content:start; grid-auto-rows:max-content; }
.admin-choice-modal-list .card { flex:0 0 auto; min-height:72px; height:max-content; }
.admin-choice-modal-panel > .secondary { flex:0 0 auto; margin-top:10px; }
.secondary-admins-modal { background: rgba(15, 23, 28, .48); backdrop-filter: blur(10px); }
.secondary-admins-panel { width: min(600px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: #fff; box-shadow: 0 28px 80px rgba(8, 18, 24, .24); }
.secondary-admins-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:22px 24px 18px; border-bottom:1px solid #edf1f0; }
.secondary-admins-header h3 { margin:0 0 5px; font-size:20px; color:#1b2927; }
.secondary-admins-close { min-height:32px; padding:0 12px; }
.secondary-admins-section-title { padding:16px 24px 8px; color:#7a8783; font-size:12px; font-weight:800; letter-spacing:.04em; }
.secondary-admins-panel > .stack { flex:1; min-height:80px; overflow:auto; padding:0 24px 12px; }
.secondary-admin-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px 0; border-bottom:1px solid #edf1f0; }
.secondary-admin-identity { display:flex; align-items:center; gap:11px; min-width:0; }
.secondary-admin-avatar { width:34px; height:34px; display:grid; place-items:center; flex:0 0 34px; border-radius:50%; background:#e7f3ef; color:#117865; font-weight:800; }
.secondary-admin-status { margin-top:3px; color:#9aa6a2; font-size:12px; }
.secondary-admin-status.enabled { color:#16856f; }
.secondary-admin-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px; }
.secondary-admin-actions .action-chip { min-width:58px; height:32px; min-height:32px; padding:0 10px; display:inline-flex; align-items:center; justify-content:center; white-space:nowrap; }
.secondary-admin-actions .danger-chip { min-width:58px; }
.secondary-admin-footer { padding:16px 24px 20px; border-top:1px solid #edf1f0; background:#fbfcfc; }
.secondary-admin-footer > .primary-chip { width:100%; min-height:40px; }
.secondary-admin-form { margin-top:14px; padding-top:14px; border-top:1px dashed #dce6e2; }
.secondary-admin-form-title { margin-bottom:10px; color:#34413f; font-size:13px; font-weight:800; }
.secondary-admin-fields { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.secondary-admin-form-actions { display:flex; align-items:center; gap:8px; margin-top:10px; }
.secondary-admin-form-actions > button { min-width:88px; min-height:38px; height:38px; display:inline-flex; align-items:center; justify-content:center; white-space:nowrap; }
.secondary-admin-enabled { display:inline-flex; align-items:center; gap:6px; margin-right:auto; color:#52615d; font-size:13px; }
.secondary-admin-form-actions .muted { font-size:12px; }
@media (max-width: 560px) { .secondary-admins-panel { border-radius:16px; } .secondary-admins-header, .secondary-admins-panel > .stack, .secondary-admins-footer { padding-left:16px; padding-right:16px; } .secondary-admin-row { align-items:flex-start; flex-direction:column; } .secondary-admin-actions { width:100%; display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:6px; } .secondary-admin-actions .action-chip { width:100%; min-width:0; } .secondary-admin-fields { grid-template-columns:1fr; } .secondary-admin-form-actions { flex-wrap:wrap; } .secondary-admin-form-actions > button { flex:1 1 120px; } .secondary-admin-enabled { flex:1 0 100%; margin-right:0; } }
.guest-edit-modal { align-items: flex-start; overflow: auto; padding-top: 28px; padding-bottom: 28px; }
.guest-edit-panel { width: min(860px, 100%); }
.guest-edit-panel .panel { max-width: none; }

/* Spacing override for the regular-admin dialog */
.secondary-admins-footer { padding: 20px 28px 24px !important; }
.secondary-admins-footer > .primary-chip { display: block; width: auto; min-width: 190px; min-height: 42px; margin: 0 auto; }
@media (max-width: 560px) {
  .secondary-admins-footer { padding-left: 18px !important; padding-right: 18px !important; }
  .secondary-admins-footer > .primary-chip { min-width: 180px; }
}
 

.guest-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: #eef3f1;
}

@media (min-width: 980px) {
  .guest-list {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}

@media (max-width: 420px) {
  .shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .guest-list {
    grid-template-columns: 1fr;
  }

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

  .guest-photo {
    aspect-ratio: 4 / 5;
  }
}

/* Product polish */
body {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 127, 154, 0.12), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(17, 120, 101, 0.12), transparent 30%),
    linear-gradient(180deg, #f7faf9 0%, #eef3f1 100%);
}

.panel,
.card,
.login-panel {
  border-radius: 14px;
}

.topbar {
  padding: 4px 2px;
}

.brand h1 {
  letter-spacing: 0;
}

.social-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.selection-panel {
  position: sticky;
  top: 16px;
  border: 1px solid rgba(197, 211, 216, 0.72);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.wheel-area {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.profile-wheel {
  display: grid;
  grid-template-columns: minmax(76px, 0.26fr) minmax(280px, 430px) minmax(76px, 0.26fr);
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 620px;
  perspective: 1200px;
}

.profile-card {
  overflow: hidden;
  border: 1px solid rgba(210, 219, 224, 0.82);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(25, 35, 45, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  width: 100%;
  max-width: 430px;
  justify-self: center;
}

.profile-card:hover {
  transform: translateY(-3px);
  border-color: rgba(17, 120, 101, 0.28);
  box-shadow: 0 26px 68px rgba(25, 35, 45, 0.14);
}

.profile-media {
  position: relative;
  overflow: hidden;
  background: #e8efed;
}

.profile-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  transform: scale(1.001);
}

.placeholder-photo {
  display: grid;
  place-items: center;
  color: #fff;
  padding: 28px;
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 38px;
  font-weight: 900;
  background: linear-gradient(135deg, #117865, #263238);
}

.profile-media::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.photo-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(16, 24, 32, 0.34);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.photo-nav:hover {
  background: rgba(16, 24, 32, 0.52);
}

.photo-nav.prev {
  left: 10px;
}

.photo-nav.next {
  right: 10px;
}

.photo-dots {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  display: flex;
  gap: 5px;
  transform: translateX(-50%);
}

.photo-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  transition: width 160ms ease, background 160ms ease;
}

.photo-dots span.active {
  width: 18px;
  background: #fff;
}

.photo-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  border-radius: 999px;
  padding: 4px 9px;
  color: #fff;
  background: rgba(16, 24, 32, 0.38);
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.profile-body {
  display: grid;
  gap: 12px;
  padding: 15px;
}

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

.profile-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.wheel-side-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 150px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: #fff;
  box-shadow: 0 18px 42px rgba(25, 35, 45, 0.16);
  opacity: 0.72;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

.wheel-side-card:hover {
  opacity: 0.95;
  background: #fff;
  box-shadow: 0 24px 56px rgba(25, 35, 45, 0.22);
}

.wheel-side-card.prev-card {
  transform: rotateY(26deg) rotateZ(-5deg) translateX(12px) scale(0.92);
  transform-origin: right center;
}

.wheel-side-card.next-card {
  transform: rotateY(-26deg) rotateZ(5deg) translateX(-12px) scale(0.92);
  transform-origin: left center;
}

.wheel-side-card.prev-card:hover {
  transform: rotateY(18deg) rotateZ(-3deg) translateX(4px) scale(0.96);
}

.wheel-side-card.next-card:hover {
  transform: rotateY(-18deg) rotateZ(3deg) translateX(-4px) scale(0.96);
}

.wheel-side-card img,
.side-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4.2;
  display: grid;
  place-items: center;
  object-fit: cover;
  background: linear-gradient(135deg, #526b67, #10201d);
}

.side-placeholder {
  padding: 12px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.wheel-side-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 50%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.58));
}

.wheel-side-card span {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 900;
  text-align: left;
  overflow-wrap: anywhere;
}

.quick-jump {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.quick-jump-toggle {
  border-radius: 999px;
  min-height: 38px;
}

.quick-jump-panel {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: min(680px, 100%);
  border: 1px solid rgba(205, 216, 222, 0.78);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  padding: 12px;
  backdrop-filter: blur(16px);
}

.quick-jump-panel button {
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: #f5f8f7;
  border-color: #dce6e3;
  color: #40504d;
  font-size: 13px;
}

.quick-jump-panel button.active,
.quick-jump-panel button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-head .tag-row {
  margin-top: 8px;
}

.profile-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #f2f5f4;
  color: #52615f;
  font-size: 12px;
  font-weight: 800;
}

.profile-tag::before {
  content: "#";
  color: #8a9996;
  margin-right: 1px;
}

.select-button {
  flex: 0 0 auto;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 16px;
  background: linear-gradient(135deg, #ff6f91, #ff9671);
  box-shadow: 0 10px 24px rgba(255, 111, 145, 0.26);
}

.select-button:hover {
  background: linear-gradient(135deg, #f85d83, #ff865f);
}

.select-button.selected {
  background: #263238;
}

.profile-facts {
  display: grid;
  gap: 6px;
}

.profile-facts .muted {
  border-radius: 10px;
  background: #f8faf9;
  padding: 8px 10px;
}

.admin-card,
.admin-toolbar {
  border-radius: 16px;
}

.action-chip {
  letter-spacing: 0;
}

@media (max-width: 860px) {
  .social-layout {
    grid-template-columns: 1fr;
  }

  .selection-panel {
    position: static;
  }

  .profile-wheel {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    gap: 8px;
    min-height: auto;
  }

  .wheel-side-card {
    border-radius: 14px;
  }

  .wheel-side-card span {
    display: none;
  }
}

@media (max-width: 720px) {
  .profile-card {
    border-radius: 20px;
  }

  .profile-photo {
    aspect-ratio: 4 / 5;
  }

  .photo-nav {
    opacity: 0.92;
  }
}

.photo-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.photo-manage-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  cursor: grab;
  touch-action: none;
}

.photo-manage-item.dragging {
  opacity: 0.55;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.photo-manage-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #eef3f1;
}

.photo-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 999px;
  border-color: rgba(255,255,255,0.72);
  background: rgba(18, 25, 30, 0.7);
  color: #fff;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
}

.photo-delete:hover {
  background: rgba(191, 63, 49, 0.92);
}

.photo-upload-row {
  display: grid;
  gap: 6px;
}

.photo-empty {
  grid-column: 1 / -1;
  padding: 14px;
}

/* Guest app redesign inspired by the provided mobile reference */
.guest-shell {
  width: min(1180px, 100%);
}

.guest-shell .topbar {
  width: min(760px, 100%);
  margin: 0 auto 16px;
  border-radius: 22px;
  padding: 10px 14px;
  background: rgba(255, 247, 235, 0.72);
  box-shadow: 0 16px 50px rgba(180, 92, 48, 0.12);
  backdrop-filter: blur(18px);
}

.guest-shell .brand h1 {
  font-size: 22px;
}

.guest-shell .brand p {
  margin-top: 3px;
}

.phone-screen {
  position: relative;
  overflow: hidden;
  width: min(390px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background:
    radial-gradient(circle at 12% 92%, rgba(129, 85, 255, 0.22), transparent 21%),
    radial-gradient(circle at 86% 72%, rgba(255, 130, 80, 0.22), transparent 28%),
    linear-gradient(180deg, #fff9ed 0%, #ffe5c8 100%);
  box-shadow: 0 30px 80px rgba(177, 94, 39, 0.24);
  padding: 18px 22px 24px;
}

.phone-status {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 24px;
  color: #101820;
  font-size: 12px;
  font-weight: 850;
}

.phone-status span:last-child {
  text-align: right;
  letter-spacing: 1px;
}

.phone-island {
  width: 74px;
  height: 22px;
  border-radius: 999px;
  background: #050505;
}

.login-screen {
  min-height: 640px;
  display: grid;
  align-content: start;
  gap: 13px;
  text-align: center;
}

.login-logo {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(128, 64, 20, 0.16);
  font-size: 30px;
}

.login-screen h2 {
  margin: 0;
  font-size: 26px;
}

.title-rule {
  justify-self: center;
  width: 92px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f06b55, #7a35c9, #2cc6a4);
}

.login-avatar {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: linear-gradient(180deg, #e2b28a, #9d6041);
  font-size: 34px;
  box-shadow: 0 16px 34px rgba(100, 50, 20, 0.18);
}

.login-copy {
  text-align: center;
}

.login-button {
  border-radius: 16px;
  background: linear-gradient(180deg, #9c4cc5, #7228a9);
  box-shadow: 0 12px 24px rgba(115, 40, 169, 0.32);
}

.login-button:hover {
  background: linear-gradient(180deg, #8f43ba, #642099);
}

.guest-shell .social-layout {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 26px;
}

.guest-shell .selection-panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 249, 239, 0.78));
  box-shadow: 0 28px 70px rgba(177, 94, 39, 0.16);
}

.guest-shell .profile-wheel {
  grid-template-columns: minmax(86px, 0.26fr) minmax(300px, 420px) minmax(86px, 0.26fr);
  min-height: 650px;
}

.guest-shell .profile-card {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 72px rgba(178, 89, 43, 0.22);
}

.guest-shell .profile-photo {
  aspect-ratio: 1.12 / 1;
}

.guest-shell .profile-body {
  padding: 16px;
}

.guest-shell .select-button {
  background: linear-gradient(135deg, #ff8f70, #f06477);
  box-shadow: 0 12px 24px rgba(240, 100, 119, 0.26);
}

.guest-shell .select-button:hover {
  background: linear-gradient(135deg, #ff7b5f, #e9586d);
}

.guest-shell .select-button.selected {
  background: linear-gradient(135deg, #7a35c9, #4f2396);
}

.gallery-button {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 3;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  background: rgba(16, 24, 32, 0.4);
  border-color: rgba(255, 255, 255, 0.36);
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.gallery-button:hover {
  background: rgba(16, 24, 32, 0.56);
}

.quick-jump-toggle {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 26px rgba(177, 94, 39, 0.12);
}

.quick-jump-panel {
  border-color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 249, 240, 0.9);
  box-shadow: 0 18px 48px rgba(177, 94, 39, 0.14);
}

.quick-jump-panel button.active,
.quick-jump-panel button:hover {
  background: linear-gradient(135deg, #9c4cc5, #f06477);
  border-color: transparent;
  color: #fff;
}

.top-picks-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.76);
  color: #5d315f;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(130, 65, 140, 0.12);
}

.gallery-screen {
  width: min(420px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  background: #fffdf8;
}

.gallery-head,
.gallery-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.gallery-head h2 {
  margin: 0;
  font-size: 22px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
}

.gallery-placeholder {
  min-height: 320px;
  border-radius: 16px;
  margin: 14px 0;
}

.guest-shell .rank-item {
  border: 0;
  box-shadow: 0 10px 22px rgba(120, 68, 30, 0.08);
}

.guest-shell .rank-item:nth-child(1) {
  background: linear-gradient(90deg, #ffe7e1, #fff);
}

.guest-shell .rank-item:nth-child(2) {
  background: linear-gradient(90deg, #fff2ce, #fff);
}

.guest-shell .rank-item:nth-child(3) {
  background: linear-gradient(90deg, #dbf6dc, #fff);
}

.guest-shell .rank-item:nth-child(4) {
  background: linear-gradient(90deg, #ecdafa, #fff);
}

@media (max-width: 860px) {
  .guest-shell .social-layout {
    grid-template-columns: 1fr;
  }

  .guest-shell .profile-wheel {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    min-height: auto;
    gap: 8px;
  }

  .guest-shell .wheel-side-card {
    border-radius: 14px;
  }
}

/* Full guest-side rebuild: phone-only app surfaces */
.guest-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding-top: 30px;
}

.guest-shell > .topbar {
  display: none;
}

.browse-screen,
.picks-screen,
.gallery-screen {
  width: min(390px, calc(100vw - 24px));
  min-height: 680px;
}

.browse-screen {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 10px;
  padding-bottom: 18px;
}

.browse-top {
  display: flex;
  justify-content: flex-end;
  min-height: 32px;
}

.browse-top .top-picks-pill {
  border: 0;
  min-height: 32px;
  background: rgba(255, 255, 255, 0.82);
  color: #2b1d19;
  box-shadow: 0 9px 20px rgba(111, 55, 22, 0.13);
}

.browse-screen .profile-wheel {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 5px;
  min-height: 0;
  margin: 0 -10px;
  perspective: 900px;
}

.browse-screen .profile-card {
  max-width: 276px;
  border-radius: 14px;
  box-shadow: 0 18px 34px rgba(111, 55, 22, 0.24);
}

.browse-screen .profile-card:hover {
  transform: none;
}

.browse-screen .profile-photo {
  aspect-ratio: 1.34 / 1;
}

.browse-screen .placeholder-photo {
  font-size: 30px;
  min-height: 206px;
}

.browse-screen .profile-body {
  gap: 8px;
  padding: 12px;
}

.browse-screen .profile-head {
  display: grid;
  gap: 8px;
}

.browse-screen .profile-head h2 {
  font-size: 18px;
}

.browse-screen .profile-facts {
  gap: 5px;
}

.browse-screen .profile-facts .muted {
  padding: 0;
  background: transparent;
  color: #2d2927;
}

.browse-screen .select-button {
  width: 100%;
  justify-content: center;
  min-height: 42px;
  border-radius: 14px;
}

.browse-screen .wheel-side-card {
  max-width: 58px;
  border-radius: 12px;
  opacity: 0.7;
}

.browse-screen .wheel-side-card.prev-card {
  transform: rotateY(34deg) rotateZ(-4deg) translateX(18px) scale(0.92);
}

.browse-screen .wheel-side-card.next-card {
  transform: rotateY(-34deg) rotateZ(4deg) translateX(-18px) scale(0.92);
}

.browse-screen .wheel-side-card span {
  display: none;
}

.browse-screen .wheel-side-card img,
.browse-screen .side-placeholder {
  aspect-ratio: 0.64 / 1;
}

.browse-screen .quick-jump {
  gap: 8px;
}

.browse-screen .quick-jump-toggle,
.guest-logout {
  justify-self: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 13px;
}

.guest-logout {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.86);
  color: #6b5146;
}

.picks-screen {
  background: #fff;
  padding: 18px 22px 24px;
}

.picks-screen h2 {
  margin: 0;
  text-align: center;
  font-size: 20px;
}

.picks-rule {
  width: 100%;
  margin: 0 auto 10px;
  height: 3px;
}

.picks-rank-list {
  gap: 8px;
  margin-top: 4px;
}

.picks-screen .rank-item {
  grid-template-columns: 42px 1fr 36px 28px;
  min-height: 46px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #ece5df;
  box-shadow: none;
}

.picks-screen .rank-num {
  width: 42px;
  height: 100%;
  border-radius: 0;
  background: #ffe3dd;
  color: #cc6c5f;
  font-size: 18px;
}

.picks-screen .rank-item:nth-child(2) .rank-num {
  background: #fff0c8;
  color: #c7972f;
}

.picks-screen .rank-item:nth-child(3) .rank-num {
  background: #cfefce;
  color: #4b9a55;
}

.picks-screen .rank-item:nth-child(4) .rank-num {
  background: #ead8f7;
  color: #8b59b1;
}

.picks-screen .rank-actions {
  display: flex;
  gap: 3px;
  grid-column: auto;
  grid-row: auto;
}

.picks-screen .icon-btn {
  width: 28px;
  min-width: 28px;
  height: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
}

.submit-picks {
  margin-top: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #9c4cc5, #7228a9);
  box-shadow: 0 12px 24px rgba(115, 40, 169, 0.28);
}

.go-back-button {
  border-radius: 999px;
  background: #fff;
}

.guest-order-overlay { z-index: 30; }
.guest-order-overlay { overscroll-behavior: contain; touch-action: auto; user-select: none; }
.guest-order-panel { width: min(680px, calc(100vw - 28px)); height: min(760px, calc(100vh - 32px)); max-height: calc(100vh - 32px); display:grid; grid-template-rows:auto minmax(0,1fr) auto; overflow:hidden; overscroll-behavior:contain; background:rgba(250,252,252,.98); border:1px solid rgba(255,255,255,.8); border-radius:24px; padding:20px 18px 0; box-shadow:0 30px 80px rgba(18,30,35,.28); }
.guest-order-panel .modal-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:12px; }
.guest-order-panel h3 { margin:0 0 4px; font-size:21px; letter-spacing:-.01em; }
.guest-order-vue { min-height:0; overflow:hidden; }
.guest-order-list { display:grid; align-content:start; gap:8px; min-height:0; height:100%; overflow-y:auto; overflow-x:hidden; padding:4px 2px 96px; scrollbar-width:thin; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; touch-action:pan-y; }
.guest-order-row { display:grid; grid-template-columns:38px 24px minmax(0,1fr) auto; align-items:center; gap:9px; min-height:58px; padding:7px 9px; border:1px solid #e1e9e7; border-radius:15px; background:#fff; cursor:grab; box-shadow:0 3px 12px rgba(33,55,60,.06); transition:transform 260ms cubic-bezier(.2,.75,.25,1), box-shadow 180ms ease, background 180ms ease; will-change:transform; touch-action:pan-y; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.guest-order-row * { user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; pointer-events:none; }
.guest-order-row:hover { box-shadow:0 8px 20px rgba(33,55,60,.11); }
.guest-order-row:active, body.guest-order-dragging .guest-order-row { cursor:grabbing; }
.guest-order-row:active { cursor:grabbing; }
.guest-order-num { display:grid; place-items:center; width:28px; height:28px; border-radius:50%; background:#e5f2ee; color:#24695a; font-weight:800; }
.guest-order-drag { color:#8aa09a; font-size:20px; user-select:none; }
.guest-order-actions { display:flex; gap:5px; }
.guest-order-footer { margin:0 -18px; padding:12px 18px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid #e3ebe9; background:rgba(250,252,252,.96); position:relative; z-index:2; }
.guest-order-position { width:76px; }
.guest-order-footer .spacer { flex:1; }
.guest-order-ghost { display:grid !important; visibility:visible !important; opacity:.72 !important; min-height:58px !important; background:#e8f3f0 !important; border:1px dashed #8ebcaf !important; box-shadow:none !important; color:#315b52 !important; }
.guest-order-ghost * { display:initial !important; visibility:visible !important; opacity:1 !important; color:inherit !important; }
.guest-order-chosen:not(.guest-order-ghost) { visibility:hidden !important; opacity:0 !important; }
@media (max-width: 640px) { .guest-order-row { grid-template-columns:30px 20px minmax(0,1fr); } .guest-order-actions { grid-column:3; } }
body.guest-order-open { overflow: hidden; }
body:not(.guest-order-open) { overflow-y: auto; }
body.guest-order-dragging { user-select:none; }
