:root {
  --r: 20px;
  --transition-speed: 0.3s;
}

/* ── Theme Definitions ── */
body, body[data-tone="ink"] {
  --bg: #faf6e9;
  --panel: #fffefb;
  --ink: #3d3529;
  --muted: #8a7d6a;
  --line: rgba(61,53,41,.09);
  --accent: #c4864a;
  --accent-hover: #b37540;
  --shadow: 0 6px 20px rgba(61,53,41,.06);
  --tape-color: rgba(196, 134, 74, 0.22);
  --grid-dot: rgba(61,53,41,.08);
  --input-bg: rgba(61,53,41,.04);
  --empty-card-bg: #f2eddf;
}

body[data-tone="paper"] {
  --bg: #f4edd4;
  --panel: #faf7eb;
  --ink: #2b221a;
  --muted: #73604f;
  --line: rgba(43,34,26,.1);
  --accent: #a3501a;
  --accent-hover: #8c4213;
  --shadow: 0 6px 20px rgba(43,34,26,.08);
  --tape-color: rgba(163, 80, 26, 0.26);
  --grid-dot: rgba(43,34,26,.08);
  --input-bg: rgba(43,34,26,.04);
  --empty-card-bg: #e6dfca;
}

body[data-tone="mint"] {
  --bg: #edf5f0;
  --panel: #f7fbf9;
  --ink: #1a2e26;
  --muted: #5e7a70;
  --line: rgba(26,46,38,.09);
  --accent: #1e8267;
  --accent-hover: #166b54;
  --shadow: 0 6px 20px rgba(26,46,38,.07);
  --tape-color: rgba(30, 130, 103, 0.22);
  --grid-dot: rgba(26,46,38,.08);
  --input-bg: rgba(26,46,38,.04);
  --empty-card-bg: #dae5de;
}

body[data-tone="dark"] {
  --bg: #12141c;
  --panel: #1b1e2e;
  --ink: #e2e4ed;
  --muted: #8288a6;
  --line: rgba(226,228,237,.11);
  --accent: #5d83f7;
  --accent-hover: #486ed9;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --tape-color: rgba(93, 131, 247, 0.28);
  --grid-dot: rgba(226,228,237,.06);
  --input-bg: rgba(226,228,237,.06);
  --empty-card-bg: #23273a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Avenir Next", sans-serif;
  transition: background-color var(--transition-speed), color var(--transition-speed), background-image var(--transition-speed);
}

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

/* Global Smooth Transitions */
.hero, .create-panel, .workspace, .join-card, .drop-zone, .tone, .ghost-action, .primary-action, .feedback-action, .hour-card, .person-row, .field input, .share-input-wrapper {
  transition: background-color var(--transition-speed), border-color var(--transition-speed), color var(--transition-speed), box-shadow var(--transition-speed), transform 0.2s;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 80px;
}

/* ── Hero ── */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--panel);
  border-radius: var(--r);
  padding: 20px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.hero__copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hero__title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero__tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

h1, h2 {
  font-family: "LXGW WenKai Screen", Georgia, "Songti SC", serif;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.lede {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Theme Selector (Capsule Style) ── */
.tone-picker {
  display: inline-flex;
  gap: 2px;
  background: var(--input-bg);
  padding: 3px;
  border-radius: 999px;
  align-items: center;
  border: 1px solid var(--line);
}

.tone {
  height: 28px;
  min-height: 0;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tone:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

body[data-tone="dark"] .tone:hover {
  background: rgba(256, 256, 256, 0.05);
}

.tone.is-active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.feedback-action {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px 0 12px;
  color: var(--ink);
  background: var(--input-bg);
  background: color-mix(in srgb, var(--panel) 78%, var(--accent) 8%);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24);
}

.feedback-action::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.feedback-action:hover {
  color: var(--accent);
  background: var(--panel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* ── Metrics ── */
.hero__panel {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
  align-items: baseline;
}

.hero__panel > div {
  display: flex;
  align-items: baseline;
  gap: 4px;
  background: var(--input-bg);
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.metric {
  display: block;
  font-family: "LXGW WenKai Screen", Georgia, "Songti SC", serif;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1;
  color: var(--accent);
}

.metric-label,
label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.metric-label {
  white-space: nowrap;
}

/* ── Layout ── */
.session-error {
  text-align: center;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.session-error__icon {
  font-size: 48px;
  margin: 0;
}

.session-error h2 {
  font-size: 22px;
  margin: 0;
}

.session-error p {
  color: var(--muted);
  margin: 0;
}

.create-panel,
.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.create-panel {
  grid-template-columns: minmax(200px, 1fr) minmax(180px, 320px) minmax(120px, 180px) minmax(100px, 140px) auto;
  align-items: end;
  gap: 14px 18px;
  background: var(--panel);
  border-radius: var(--r);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.create-panel .field--hours {
  grid-column: 1 / -1;
  grid-row: 2;
  padding-top: 4px;
}

.create-copy h2,
.join-card h2 {
  margin: 0;
  font-family: "LXGW WenKai Screen", Georgia, "Songti SC", serif;
  font-size: 24px;
  color: var(--ink);
}

.create-copy p,
.join-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

/* ── Control rail ── */
.control-rail {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}

.field,
.share-box {
  display: grid;
  gap: 6px;
}

/* ── Join card ── */
.join-card {
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--r);
  border-left: 4px solid var(--accent);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  border-left-width: 4px;
}

.upload-tools {
  display: grid;
  gap: 12px;
}

/* ── Inputs ── */
.field input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 12px;
  min-height: 42px;
  padding: 0 14px;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 134, 74, 0.12);
}

body[data-tone="dark"] .field input:focus {
  box-shadow: 0 0 0 3px rgba(93, 131, 247, 0.2);
}

/* ── Share Box layout ── */
.share-input-wrapper {
  display: flex;
  gap: 6px;
  background: var(--input-bg);
  border-radius: 12px;
  align-items: center;
  padding: 2px 6px 2px 14px;
  border: 1px solid var(--line);
}

.share-input-wrapper input {
  border: none;
  background: transparent;
  padding: 0;
  height: 38px;
  min-height: 0;
  outline: none;
  color: var(--ink);
  flex: 1;
}

.share-input-wrapper .ghost-action {
  min-height: 30px;
  height: 30px;
  font-size: 11px;
  padding: 0 12px;
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  border: 1px solid var(--line);
}

/* ── Buttons ── */
.primary-action,
.ghost-action {
  min-height: 42px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 999px;
}

.ghost-action {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.ghost-action:hover {
  background: rgba(61,53,41,.06);
}

body[data-tone="dark"] .ghost-action:hover {
  background: rgba(226,228,237,.06);
}

.primary-action {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}

.primary-action:hover {
  background: var(--accent-hover);
}

.primary-action:active,
.ghost-action:active,
.feedback-action:active,
.leave-btn:active {
  transform: scale(0.96);
}

.expire-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.upload-all {
  min-height: 88px;
  border: 2px dashed var(--line);
  background: var(--input-bg);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  cursor: pointer;
  color: var(--ink);
}

.upload-all:hover {
  border-color: var(--accent);
}

.upload-all input,
.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.upload-all span {
  font-size: 14px;
  font-weight: 700;
}

.upload-all small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

/* ── iOS Toggle Switch ── */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--input-bg);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  border: 1px solid var(--line);
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--line);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.leave-btn {
  width: 100%;
  min-height: 36px;
  border: none;
  background: transparent;
  color: #c05040;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
}

.my-link-details {
  font-size: 12px;
  color: var(--ink);
  opacity: 0.5;
}
.my-link-details summary {
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.my-link-details summary:hover { opacity: 0.8; }
.my-link-details .my-link-inner {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  opacity: 1;
}

.leave-btn:hover {
  background: rgba(200, 80, 60, 0.07);
}

#joinBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Board & result ── */
.result h2,
.board h2 {
  margin: 0 0 8px;
  font-family: "LXGW WenKai Screen", Georgia, "Songti SC", serif;
  font-size: 22px;
  color: var(--ink);
}

/* ── Timeline ── */
.timeline { min-width: 0; }

.timeline__header,
.result__top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-top: 1.5px dashed var(--line);
  border-bottom: 1.5px dashed var(--line);
  padding: 10px 0;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

/* ── Polaroid Hour Cards ── */
.hour-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
}

.hour-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  position: relative;
  padding: 8px 8px 4px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

/* Dynamic scattering effect for realism */
.hour-card.has-image {
  transform: rotate(var(--rot, 0.6deg));
}
.hour-card.has-image:nth-child(2n) {
  --rot: -1deg;
}
.hour-card.has-image:nth-child(3n) {
  --rot: 0.8deg;
}
.hour-card.has-image:nth-child(4n) {
  --rot: -0.6deg;
}

.hour-card:hover {
  transform: translateY(-6px) scale(1.03) rotate(0deg) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

/* Washi Tape decoration */
.hour-card.has-image::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  width: 50px;
  height: 14px;
  background-color: var(--tape-color);
  background-image: linear-gradient(135deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);
  background-size: 8px 8px;
  backdrop-filter: blur(1px);
  z-index: 5;
  pointer-events: none;
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  opacity: 0.85;
}

.drop-zone {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--empty-card-bg);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block;
  color: var(--muted);
  border: 1px dashed var(--line);
}

.hour-card.has-image .drop-zone {
  background: #ffffff;
  border: 5px solid #ffffff; /* Polaroid Frame border */
  border-bottom-width: 14px; /* Polaroid bottom border */
  border-radius: 6px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.06);
}

body[data-tone="dark"] .hour-card.has-image .drop-zone {
  background: #25283b;
  border-color: #25283b;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.drop-zone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  border-radius: 2px;
}

.hour-card.has-image .drop-zone img { display: block; }

.hour-label {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  background: var(--panel);
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.65;
  transition: opacity 0.2s, transform 0.2s;
}

.camera-icon {
  width: 22px;
  height: 22px;
  stroke: var(--muted);
  stroke-width: 1.8;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.drop-zone:hover .drop-hint {
  opacity: 1;
}

.drop-zone:hover .camera-icon {
  transform: scale(1.18) rotate(6deg);
}

.hour-card.has-image .drop-hint { display: none; }

.hour-card:not(.has-image) .caption-input {
  display: none;
}

.caption-input {
  width: 100%;
  min-height: 28px;
  max-height: 48px;
  font-size: 12px;
  padding: 4px 0;
  background: transparent;
  border: none;
  border-bottom: 1.2px dashed var(--line);
  color: var(--ink);
  outline: none;
  font-family: "LXGW WenKai Screen", serif;
  text-align: center;
  line-height: 1.35;
  resize: none;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* 空状态：极淡铅笔图标居中，比文字提示更克制
   ——一旦聚焦或输入了内容，图标自动消失 */
.caption-input::placeholder { color: transparent; }

.caption-input:placeholder-shown {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23322820' stroke-opacity='0.4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4Z'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

.caption-input:focus {
  border-bottom-color: var(--accent);
  background-image: none;
}

[data-tone="dark"] .caption-input:placeholder-shown {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='0.5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4Z'/></svg>");
}

.delete-hour {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 4;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(220, 80, 60, 0.85);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s, transform 0.2s, background-color 0.2s;
}

.hour-card:hover .delete-hour {
  opacity: 1;
  transform: scale(1);
}

.delete-hour:hover {
  background: rgba(220, 80, 60, 1);
  transform: scale(1.1);
}

/* ── Period chips (time-of-day presets) ── */
.period-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.hour-mode-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--muted);
}

.hour-mode-divider::before,
.hour-mode-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.period-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.period-chip:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.period-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Hour picker (Create panel settings) ── */
.hour-pick-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.hour-pick-actions { display: flex; gap: 6px; }

.hour-pick-actions .ghost-action {
  min-height: 28px;
  font-size: 11px;
  padding: 0 10px;
}

.hour-pick-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
  user-select: none;
}

.hour-pick-cell {
  aspect-ratio: 1;
  border: none;
  background: var(--input-bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.hour-pick-cell:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  border-color: var(--line);
}

/* Sky gradient color mapping for selected hours */
.hour-pick-cell.is-selected[data-hour="6"],
.hour-pick-cell.is-selected[data-hour="7"],
.hour-pick-cell.is-selected[data-hour="8"],
.hour-pick-cell.is-selected[data-hour="9"],
.hour-pick-cell.is-selected[data-hour="10"],
.hour-pick-cell.is-selected[data-hour="11"] {
  background: linear-gradient(135deg, #f7c768, #e08b3c);
  color: #fff;
  border-color: transparent;
}

.hour-pick-cell.is-selected[data-hour="12"],
.hour-pick-cell.is-selected[data-hour="13"],
.hour-pick-cell.is-selected[data-hour="14"],
.hour-pick-cell.is-selected[data-hour="15"],
.hour-pick-cell.is-selected[data-hour="16"],
.hour-pick-cell.is-selected[data-hour="17"] {
  background: linear-gradient(135deg, #e08b3c, #c9572b);
  color: #fff;
  border-color: transparent;
}

.hour-pick-cell.is-selected[data-hour="18"],
.hour-pick-cell.is-selected[data-hour="19"],
.hour-pick-cell.is-selected[data-hour="20"],
.hour-pick-cell.is-selected[data-hour="21"] {
  background: linear-gradient(135deg, #ad4a63, #5a3c70);
  color: #fff;
  border-color: transparent;
}

.hour-pick-cell.is-selected[data-hour="22"],
.hour-pick-cell.is-selected[data-hour="23"],
.hour-pick-cell.is-selected[data-hour="0"],
.hour-pick-cell.is-selected[data-hour="1"],
.hour-pick-cell.is-selected[data-hour="2"],
.hour-pick-cell.is-selected[data-hour="3"],
.hour-pick-cell.is-selected[data-hour="4"],
.hour-pick-cell.is-selected[data-hour="5"] {
  background: linear-gradient(135deg, #2f3252, #161830);
  color: #fff;
  border-color: transparent;
}

/* ── Board & progress ── */
.board,
.result {
  margin-top: 24px;
  padding-top: 20px;
}

.people-board { display: grid; gap: 12px; }

.person-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border-radius: var(--r);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.person-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.person-name strong {
  font-family: "LXGW WenKai Screen", serif;
  font-size: 15px;
}

/* 完成挑战的横幅引导 */
.completion-banner {
  margin: 12px 0 4px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(196, 134, 74, 0.16));
  border: 1px solid rgba(196, 134, 74, 0.35);
  font-size: 14px;
  line-height: 1.6;
  color: inherit;
}

/* Gold Crown completion badge */
.completion-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  background: linear-gradient(135deg, #ffd700, #ffa500);
  color: #fff;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 800;
  box-shadow: 0 2px 5px rgba(255, 165, 0, 0.25);
  animation: badge-bounce 2s infinite;
}

@keyframes badge-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* Timeline grid dot tracker */
.mini-hours {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mini-hours > span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
  position: relative;
  cursor: default;
}

.mini-hours > span.is-filled {
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 1.5px var(--panel);
}

.mini-hours > span.is-filled:hover {
  transform: scale(1.3);
  box-shadow: 0 0 8px var(--accent);
  z-index: 10;
}

/* Popover Tooltip for photo browsing */
.dot-tooltip {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 6px 7px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 132px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  z-index: 100;
}

.dot-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--panel);
}

.mini-hours > span:hover .dot-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dot-tooltip img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg);
}

.dot-tooltip-time {
  font-size: 9px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.dot-tooltip-caption {
  display: block;
  align-self: stretch;
  flex: 0 0 auto;
  font-size: 10px;
  font-family: "LXGW WenKai Screen", serif;
  color: var(--ink);
  text-align: center;
  width: 118px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  max-height: 3.75em;
  overflow: hidden;
}

/* ── Result poster list ── */
.poster-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
}

.ios-save-hint {
  font-size: 13px;
  opacity: 0.55;
  margin: 0 0 4px;
}

.poster-item { display: grid; gap: 10px; }

.poster-item canvas,
.poster-item img {
  width: 100%;
  height: auto;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .workspace,
  .create-panel,
  .person-row {
    grid-template-columns: 1fr;
  }
  .control-rail { position: static; }
  .hour-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 12px;
  }
  .hero__panel { width: 100%; gap: 8px; justify-content: stretch; }
  .hero__panel > div { flex: 1; justify-content: center; padding: 6px 10px; }
  .hour-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .mini-hours { gap: 4px; }
}

/* ── Save status ── */
.save-status {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 6;
}

.save-status.is-ok {
  background: rgba(90, 170, 128, 0.95);
  color: #fff;
  opacity: 1;
}

.save-status.is-err {
  background: rgba(200, 80, 60, 0.95);
  color: #fff;
  opacity: 1;
}

.hour-card.is-saving .drop-zone::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(250,246,233, 0.60);
  border-radius: inherit;
  z-index: 5;
}

body[data-tone="dark"] .hour-card.is-saving .drop-zone::after {
  background: rgba(18, 20, 28, 0.6);
}

.hour-card.is-saving .drop-zone::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid rgba(61,53,41,.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

body[data-tone="dark"] .hour-card.is-saving .drop-zone::before {
  border-color: rgba(226,228,237,.15);
  border-top-color: var(--accent);
}

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