/* “心游”项目团队工作日志 — visual system */
:root {
  --ink: #173b32;
  --ink-deep: #0f2b25;
  --ink-soft: #3e5b51;
  --paper: #f2ecdf;
  --paper-warm: #f8f3e9;
  --card: #fffdf8;
  --line: rgba(23, 59, 50, 0.13);
  --line-strong: rgba(23, 59, 50, 0.22);
  --accent: #d36f4c;
  --accent-deep: #b95635;
  --accent-soft: #f1c4ae;
  --gold: #b98c4b;
  --sage: #7d9687;
  --muted: #829086;
  --danger: #b34e3b;
  --cream: #f7f1e3;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-display: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, serif;
  --font-num: Georgia, "Times New Roman", "Songti SC", serif;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --shadow-panel: 0 22px 60px -42px rgba(23, 59, 50, 0.55);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 88% -6%, rgba(211, 111, 76, 0.1), transparent 62%),
    radial-gradient(900px 700px at -8% 22%, rgba(125, 150, 135, 0.14), transparent 60%),
    var(--paper);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--cream);
  background: var(--accent);
}

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

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contour-art {
  position: fixed;
  top: 120px;
  right: -230px;
  z-index: 0;
  width: 880px;
  height: 880px;
  color: rgba(23, 59, 50, 0.16);
  opacity: 0.5;
  pointer-events: none;
}

.contour-art svg {
  width: 100%;
  height: 100%;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 38px 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.seal {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: none;
  color: #fff7e9;
  background: linear-gradient(150deg, #da7a56, #c15d3b);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 13px;
  box-shadow: 0 10px 24px -12px rgba(185, 86, 53, 0.75), inset 0 0 0 1px rgba(94, 32, 17, 0.15);
  transform: rotate(-2deg);
  transition: transform 0.35s var(--ease);
}

.seal::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 247, 233, 0.42);
  border-radius: 8px;
}

.seal span {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.12em;
  line-height: 1;
}

.brand:hover .seal {
  transform: rotate(0deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-eyebrow {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.brand-title {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.2;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.sync-dot {
  position: relative;
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--gold);
  border-radius: 50%;
}

.sync-pill[data-state="live"] .sync-dot {
  background: #4d9273;
  animation: sync-pulse 2.6s infinite;
}

.sync-pill[data-state="connecting"] .sync-dot {
  background: #c59a56;
  animation: sync-pulse 1.4s infinite;
}

.sync-pill[data-state="offline"] .sync-dot {
  background: var(--danger);
  animation: none;
}

@keyframes sync-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(77, 146, 115, 0.28); }
  55% { box-shadow: 0 0 0 5px rgba(77, 146, 115, 0); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease), color 0.22s var(--ease), transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: rgba(255, 253, 248, 0.52);
  border-color: var(--line);
}

.btn-ghost:hover {
  background: var(--card);
  border-color: var(--line-strong);
}

.btn-dark {
  color: var(--cream);
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 10px 24px -15px rgba(23, 59, 50, 0.8);
}

.btn-dark:hover {
  background: #205044;
  border-color: #205044;
}

.btn-accent {
  color: #fff9ef;
  background: linear-gradient(135deg, #dc7c58, var(--accent));
  border-color: transparent;
  box-shadow: 0 12px 28px -14px rgba(185, 86, 53, 0.8);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #d2704c, var(--accent-deep));
  box-shadow: 0 15px 32px -12px rgba(185, 86, 53, 0.75);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--line-strong);
}

.btn-outline:hover {
  background: var(--paper-warm);
}

.btn-danger {
  color: #fff8f2;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #9d3f2e;
}

.btn-small {
  min-height: 32px;
  padding: 0 13px;
  font-size: 11px;
  border-radius: 8px;
}

.btn-full {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
}

.btn[disabled] {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

/* ---------- Page shell / masthead ---------- */
.page-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 38px 56px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding: 42px 2px 42px;
}

.masthead-copy {
  max-width: 790px;
}

.masthead-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--accent-deep);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.masthead-kicker span {
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.masthead h1 {
  margin: 16px 0 20px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(34px, 3.55vw, 52px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.28;
}

.masthead h1 em {
  position: relative;
  color: var(--accent-deep);
  font-style: normal;
  z-index: 0;
}

.masthead h1 em::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: 4px;
  left: -2px;
  z-index: -1;
  height: 12px;
  background: linear-gradient(90deg, rgba(211, 111, 76, 0.18), rgba(185, 140, 75, 0.22));
  border-radius: 2px;
  transform: rotate(-0.6deg);
}

.masthead-desc {
  max-width: 610px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.95;
}

.masthead-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
  flex: none;
  padding-bottom: 2px;
}

.masthead-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(23, 59, 50, 0.2);
  border-radius: 50%;
}

.orbit-ring::before,
.orbit-ring::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.orbit-ring::before {
  inset: 9px;
  border: 1px dashed rgba(185, 140, 75, 0.45);
}

.orbit-ring::after {
  top: -2px;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--accent);
  transform: translateX(-50%);
}

.orbit-core {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: var(--accent-deep);
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 12px 30px -18px rgba(23, 59, 50, 0.5);
}

.orbit-core .icon {
  width: 25px;
  height: 25px;
  stroke-width: 1.4;
}

.masthead-numbers {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--ink-soft);
}

.masthead-numbers > div:not(.divider) {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.masthead-numbers strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.masthead-numbers span {
  font-size: 9.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.masthead-numbers .divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

/* ---------- Workspace ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 432px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (min-width: 1081px) {
  .editor-panel:not(.is-unlocked) {
    position: sticky;
    top: 18px;
  }
}

/* ---------- Editor ---------- */
.editor-panel {
  position: relative;
  padding: 25px 24px 23px;
  color: var(--cream);
  background:
    radial-gradient(420px 260px at 106% -8%, rgba(211, 111, 76, 0.22), transparent 62%),
    radial-gradient(500px 340px at -20% 108%, rgba(125, 150, 135, 0.16), transparent 65%),
    linear-gradient(158deg, #1b483c 0%, #163b32 52%, #113029 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 70px -44px rgba(15, 43, 37, 0.9);
}

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

.section-index {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.editor-panel .section-index {
  color: rgba(247, 241, 227, 0.48);
}

.editor-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  color: rgba(247, 241, 227, 0.6);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.editor-status .icon {
  width: 12px;
  height: 12px;
}

.editor-status.is-unlocked {
  color: #c9e0c5;
  background: rgba(108, 157, 117, 0.12);
  border-color: rgba(159, 200, 158, 0.26);
}

.editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 22px;
}

.editor-heading h2 {
  margin: 0;
  color: #fbf4e6;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.editor-heading p {
  margin: 7px 0 0;
  color: rgba(247, 241, 227, 0.48);
  font-size: 11.5px;
  letter-spacing: 0.03em;
}

.edit-mode-badge {
  flex: none;
  margin-top: 6px;
  padding: 4px 9px;
  color: #ffd9c7;
  background: rgba(211, 111, 76, 0.14);
  border: 1px solid rgba(240, 172, 142, 0.26);
  border-radius: 999px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.editor-body {
  position: relative;
}

.editor-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 365px;
  padding: 38px 22px 30px;
  text-align: center;
  background:
    radial-gradient(280px 190px at 50% 0%, rgba(255, 255, 255, 0.055), transparent 70%),
    rgba(255, 255, 255, 0.022);
  border: 1px dashed rgba(247, 241, 227, 0.17);
  border-radius: var(--radius-lg);
}

.lock-emblem {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #f0a888;
  background: rgba(211, 111, 76, 0.12);
  border: 1px solid rgba(240, 168, 136, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(211, 111, 76, 0.035);
}

.lock-emblem .icon {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

.editor-lock h3 {
  margin: 22px 0 8px;
  color: #fbf4e6;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
}

.editor-lock p {
  max-width: 290px;
  margin: 0;
  color: rgba(247, 241, 227, 0.53);
  font-size: 11.5px;
  line-height: 1.9;
}

.editor-lock .btn {
  min-height: 44px;
  margin-top: 23px;
  padding: 0 19px;
  font-size: 12px;
}

.lock-footnote {
  margin-top: 15px;
  color: rgba(247, 241, 227, 0.32);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 19px;
  animation: form-reveal 0.45s var(--ease);
}

.entry-form.is-locked {
  display: none;
}

@keyframes form-reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.field {
  position: relative;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.field-label-row label {
  color: rgba(247, 241, 227, 0.9);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.required {
  margin-left: 7px;
  color: #f0b39a;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.optional {
  margin-left: 7px;
  color: rgba(247, 241, 227, 0.36);
  font-size: 9px;
  font-weight: 400;
}

.field-one-line,
.char-count {
  color: rgba(247, 241, 227, 0.35);
  font-size: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.field-one-line.is-active {
  color: #e7b59f;
}

.field-control {
  width: 100%;
  color: #fbf5e9;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.135);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field-control::placeholder {
  color: rgba(247, 241, 227, 0.3);
}

.field-control:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.field-control:focus {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(232, 159, 128, 0.75);
  box-shadow: 0 0 0 3px rgba(211, 111, 76, 0.12);
}

.field-control.is-invalid {
  background: rgba(211, 111, 76, 0.08);
  border-color: rgba(240, 146, 116, 0.8);
}

.date-trigger,
.member-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 47px;
  padding: 0 13px;
  text-align: left;
  cursor: pointer;
}

.date-trigger[aria-expanded="true"],
.member-trigger[aria-expanded="true"] {
  border-color: rgba(232, 159, 128, 0.75);
  background: rgba(255, 255, 255, 0.075);
}

.control-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  color: rgba(247, 241, 227, 0.56);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 7px;
}

.control-icon .icon {
  width: 14px;
  height: 14px;
}

.date-display,
.member-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.date-display.is-placeholder,
.member-trigger-text.is-placeholder {
  color: rgba(247, 241, 227, 0.34);
}

.control-chevron {
  width: 14px;
  height: 14px;
  color: rgba(247, 241, 227, 0.38);
  transition: transform 0.22s var(--ease);
}

[aria-expanded="true"] > .control-chevron {
  transform: rotate(180deg);
}

.member-count-bubble {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  color: #1a3c32;
  background: #efc3ad;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
}

.textarea {
  min-height: 106px;
  padding: 12px 13px;
  line-height: 1.8;
  resize: vertical;
}

.input {
  height: 46px;
  padding: 0 13px;
}

.field-error {
  margin: 7px 0 0;
  color: #ffb8a1;
  font-size: 10.5px;
  letter-spacing: 0.01em;
}

/* Popovers */
.popover-anchor {
  position: relative;
}

.calendar-popover,
.member-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 45;
  width: 100%;
  min-width: 296px;
  color: var(--ink);
  background: #fcf8ef;
  border: 1px solid rgba(23, 59, 50, 0.14);
  border-radius: 16px;
  box-shadow: 0 24px 60px -18px rgba(9, 33, 27, 0.48);
  animation: popover-in 0.18s var(--ease);
}

@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.calendar-popover {
  padding: 14px;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 2px 11px;
}

.calendar-head strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.icon-btn .icon {
  width: 15px;
  height: 15px;
}

.icon-btn:hover {
  color: var(--ink);
  background: #f1e8d8;
  border-color: rgba(23, 59, 50, 0.08);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding-bottom: 5px;
  color: var(--muted);
  font-size: 9.5px;
  text-align: center;
}

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

.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  height: 33px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-num);
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.calendar-day:hover {
  background: #f0e6d4;
  color: var(--ink);
}

.calendar-day.is-other {
  color: #c0b5a3;
}

.calendar-day.is-today {
  border-color: rgba(185, 140, 75, 0.65);
  font-weight: 700;
}

.calendar-day.is-today::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 3px;
  height: 3px;
  background: var(--gold);
  border-radius: 50%;
}

.calendar-day.is-selected {
  color: #fbf5e9;
  background: var(--ink);
  border-color: var(--ink);
  font-weight: 700;
}

.calendar-day.is-selected::after {
  background: #e8b48d;
}

.calendar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9px;
}

.text-link {
  padding: 0;
  color: var(--accent-deep);
  background: none;
  border: none;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(185, 86, 53, 0.35);
  text-underline-offset: 3px;
}

.text-link:hover {
  color: var(--accent);
}

.text-link.muted {
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
}

.text-link.muted:hover {
  color: var(--danger);
}

.member-popover {
  padding: 13px;
}

.member-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 9px;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
}

.member-popover-head span:last-child {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.member-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  max-height: 252px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cdbfa9 transparent;
}

.member-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.member-option:hover {
  background: #f1e8d8;
}

.member-option.is-selected {
  background: #efe4d2;
}

.member-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: none;
  color: transparent;
  background: #fffdf8;
  border: 1px solid #c9bca7;
  border-radius: 4px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.check-box .icon {
  width: 10px;
  height: 10px;
  stroke-width: 2.4;
}

.member-option input:checked + .check-box {
  color: #fff8ec;
  background: var(--ink);
  border-color: var(--ink);
}

.member-option input:focus-visible + .check-box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.member-option-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-option.is-selected .member-option-name {
  color: var(--ink);
  font-weight: 600;
}

.member-popover-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.avatar {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
}

.avatar.av-0 { color: #7b4f2e; background: #ead3ba; }
.avatar.av-1 { color: #3f6049; background: #d7e1d1; }
.avatar.av-2 { color: #8a493b; background: #eed4cc; }
.avatar.av-3 { color: #3e5872; background: #d7dfe8; }
.avatar.av-4 { color: #72602c; background: #e9ddc0; }
.avatar.av-5 { color: #5c4b76; background: #ded7e8; }

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.selected-chips:empty {
  display: none;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 5px;
  color: rgba(251, 245, 233, 0.9);
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 10px;
}

.person-chip .avatar {
  width: 18px;
  height: 18px;
  font-size: 8px;
}

.chip-remove {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  color: rgba(247, 241, 227, 0.44);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.chip-remove:hover {
  color: #ffd1bd;
  background: rgba(211, 111, 76, 0.16);
}

.chip-remove .icon {
  width: 10px;
  height: 10px;
}

/* Score section */
.score-section {
  padding: 14px 15px 12px;
  background: rgba(255, 255, 255, 0.042);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 15px;
  animation: form-reveal 0.3s var(--ease);
}

.score-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.score-head h3 {
  margin: 0;
  color: rgba(251, 245, 233, 0.92);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.score-head p {
  margin: 4px 0 0;
  color: rgba(247, 241, 227, 0.36);
  font-size: 9.5px;
}

.score-total {
  color: rgba(247, 241, 227, 0.44);
  font-size: 10px;
  white-space: nowrap;
}

.score-total strong {
  color: #f1bfa7;
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 500;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 1px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.075);
}

.score-row:last-child {
  padding-bottom: 2px;
  border-bottom: none;
}

.score-person {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: rgba(251, 245, 233, 0.84);
  font-size: 11px;
}

.score-person .avatar {
  width: 22px;
  height: 22px;
  font-size: 9px;
}

.score-options {
  display: flex;
  gap: 4px;
  flex: none;
}

.score-option {
  position: relative;
  cursor: pointer;
}

.score-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.score-option span {
  display: grid;
  place-items: center;
  width: 33px;
  height: 29px;
  color: rgba(251, 245, 233, 0.76);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  font-family: var(--font-num);
  font-size: 11.5px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease), transform 0.16s var(--ease);
}

.score-option:hover span {
  color: #fbf5e9;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.score-option input:checked + span {
  color: #183b31;
  background: linear-gradient(145deg, #f3c9b1, #e5a985);
  border-color: #f3c9b1;
  font-weight: 700;
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.4);
}

.score-option input:focus-visible + span {
  outline: 2px solid #f3c9b1;
  outline-offset: 2px;
}

.score-row.is-invalid .score-option span {
  border-color: rgba(255, 159, 128, 0.65);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 1px;
}

.btn-submit {
  width: 100%;
  min-height: 49px;
  border-radius: 13px;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.btn-submit .icon {
  width: 17px;
  height: 17px;
  margin-left: 2px;
}

.btn-cancel {
  min-height: 34px;
  color: rgba(247, 241, 227, 0.45);
  font-size: 10.5px;
}

.btn-cancel:hover {
  color: rgba(247, 241, 227, 0.8);
  background: rgba(255, 255, 255, 0.05);
}

.form-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: -5px 0 0;
  color: rgba(247, 241, 227, 0.28);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.form-footnote .icon {
  width: 11px;
  height: 11px;
}

/* ---------- Viewer ---------- */
.viewer {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.viewer-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 1px 3px 3px;
}

.viewer-heading h2 {
  margin: 7px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.viewer-heading p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.85;
  text-align: right;
}

.stats-panel,
.records-panel {
  position: relative;
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(4px);
}

.stats-panel {
  padding: 22px 22px 18px;
  overflow: hidden;
}

.stats-panel::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -90px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(211, 111, 76, 0.075), transparent 66%);
  pointer-events: none;
}

.panel-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.015em;
}

.panel-chip {
  flex: none;
  padding: 5px 9px;
  color: var(--ink-soft);
  background: #f4ecdd;
  border: 1px solid rgba(23, 59, 50, 0.07);
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.03em;
}

.stat-cards {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 17px 0 21px;
}

.stat-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 12px 11px;
  background: linear-gradient(155deg, #faf5ea, #f6efe2);
  border: 1px solid rgba(23, 59, 50, 0.08);
  border-radius: 13px;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(23, 59, 50, 0.08);
  border-radius: 50%;
}

.stat-icon .icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.5;
}

.stat-card > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.stat-unit {
  align-self: end;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.leaderboard-head {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 2px;
}

.leaderboard-head h4 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.leaderboard-head span {
  color: var(--muted);
  font-size: 10px;
}

.leaderboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
  gap: 3px 5px;
  margin-top: 8px;
}

.member-card {
  display: grid;
  grid-template-columns: 17px 28px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1px 7px;
  width: 100%;
  padding: 7px 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.member-card:hover {
  background: #faf4e8;
  border-color: rgba(23, 59, 50, 0.08);
}

.member-card.is-zero {
  opacity: 0.58;
}

.member-card .rank {
  grid-row: 1;
  color: #a3ada5;
  font-family: var(--font-num);
  font-size: 9.5px;
  text-align: center;
}

.member-card:nth-child(1) .rank {
  color: var(--gold);
  font-weight: 700;
}

.member-card:nth-child(2) .rank,
.member-card:nth-child(3) .rank {
  color: var(--accent);
  font-weight: 700;
}

.member-card .avatar {
  grid-row: 1;
  width: 27px;
  height: 27px;
  font-size: 10px;
}

.member-info {
  grid-row: 1;
  min-width: 0;
}

.member-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-meta {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-score {
  grid-row: 1;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
}

.member-score small {
  margin-left: 1px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 400;
}

.member-progress {
  grid-row: 2;
  grid-column: 2 / -1;
  width: 100%;
  height: 3px;
  margin-top: 4px;
  appearance: none;
  border: none;
  border-radius: 999px;
  overflow: hidden;
}

.member-progress::-webkit-progress-bar {
  background: #eae1d2;
  border-radius: 999px;
}

.member-progress::-webkit-progress-value {
  background: linear-gradient(90deg, #c9a264, #d97a55);
  border-radius: 999px;
}

.member-progress::-moz-progress-bar {
  background: linear-gradient(90deg, #c9a264, #d97a55);
  border-radius: 999px;
}

/* ---------- Records ---------- */
.records-panel {
  padding: 22px;
}

.records-heading {
  align-items: center;
}

.record-count {
  flex: none;
  padding: 5px 10px;
  color: var(--accent-deep);
  background: rgba(211, 111, 76, 0.09);
  border: 1px solid rgba(211, 111, 76, 0.15);
  border-radius: 999px;
  font-family: var(--font-num);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.records-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0 12px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 39px;
  color: var(--ink);
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-box input::placeholder {
  color: #9aa49d;
}

.search-box input:focus {
  background: #fffdf8;
  border-color: rgba(211, 111, 76, 0.55);
  box-shadow: 0 0 0 3px rgba(211, 111, 76, 0.09);
}

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

.search-clear {
  position: absolute;
  top: 50%;
  right: 9px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--muted);
  background: #eee5d5;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transform: translateY(-50%);
}

.search-clear:hover {
  color: var(--ink);
  background: #e4d8c4;
}

.search-clear .icon {
  width: 11px;
  height: 11px;
}

.btn-export {
  min-height: 42px;
  border-radius: 11px;
  font-size: 11px;
}

.active-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 11px;
  color: var(--ink-soft);
  background: #f5ecdb;
  border: 1px solid rgba(185, 140, 75, 0.14);
  border-radius: 9px;
  font-size: 10.5px;
}

.active-filter strong {
  color: var(--accent-deep);
}

.active-filter button {
  padding: 0;
  color: var(--accent-deep);
  background: none;
  border: none;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.table-scroll-hint {
  display: none;
  align-items: center;
  gap: 5px;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.table-scroll-hint span {
  color: var(--accent);
  font-family: var(--font-num);
}

.table-wrap {
  position: relative;
  max-height: 645px;
  overflow: auto;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 13px;
  scrollbar-width: thin;
  scrollbar-color: #cdbfa9 #f6efe3;
}

.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #f6efe3;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #d2c5b1;
  border-radius: 999px;
}

.records-table {
  width: 100%;
  min-width: 730px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.records-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 12px;
  color: #77857a;
  background: #f6efe2;
  border-bottom: 1px solid var(--line);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  white-space: nowrap;
}

.records-table th.col-date { width: 105px; }
.records-table th.col-people { width: 194px; }
.records-table th.col-note { width: 142px; }
.records-table th.col-actions { width: 78px; text-align: center; }

.records-table td {
  padding: 13px 12px;
  color: var(--ink-soft);
  border-bottom: 1px solid rgba(23, 59, 50, 0.07);
  font-size: 12px;
  line-height: 1.75;
  vertical-align: top;
  transition: background 0.18s var(--ease);
}

.records-table tbody tr:last-child td {
  border-bottom: none;
}

.records-table tbody tr:hover td {
  background: #fdf9f0;
}

.date-main {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.date-week {
  display: block;
  margin-top: 3px;
  color: #98a29b;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.edited-mark {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 4px;
  color: #a28a62;
  background: #f6eddd;
  border-radius: 3px;
  font-size: 7.5px;
  vertical-align: 1px;
}

.record-content {
  color: #2d493f;
  white-space: pre-wrap;
  word-break: break-word;
}

.people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.person-score {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(23, 59, 50, 0.12);
  border-radius: 6px;
  white-space: nowrap;
}

.person-score .ps-name {
  padding: 2px 5px;
  color: var(--ink-soft);
  background: #f7f1e5;
  font-size: 10px;
}

.person-score .ps-score {
  display: grid;
  place-items: center;
  min-width: 20px;
  padding: 2px 4px;
  color: #f8f1e3;
  background: var(--ink);
  font-family: var(--font-num);
  font-size: 10px;
  font-weight: 700;
}

.record-note {
  color: #77857a;
  font-size: 11px;
  word-break: break-word;
}

.record-note.is-empty {
  color: #c0b7a8;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.row-action {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: #8c998f;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.row-action .icon {
  width: 13px;
  height: 13px;
}

.row-action.edit:hover {
  color: var(--ink);
  background: #f1e7d6;
  border-color: var(--line);
}

.row-action.delete:hover {
  color: var(--danger);
  background: #f9eae4;
  border-color: rgba(179, 78, 59, 0.16);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 58px 20px 54px;
  text-align: center;
  border: 1px dashed rgba(23, 59, 50, 0.16);
  border-radius: 13px;
}

.empty-illustration {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: var(--accent);
  background: radial-gradient(circle at 35% 30%, #fffdf7, #f4e9d8);
  border: 1px solid rgba(185, 140, 75, 0.2);
  border-radius: 50%;
  box-shadow: 0 10px 26px -18px rgba(23, 59, 50, 0.5);
}

.empty-illustration .icon {
  width: 31px;
  height: 31px;
  stroke-width: 1.25;
}

.empty-state h4 {
  margin: 16px 0 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.8;
}

.empty-state .btn {
  min-height: 38px;
  font-size: 11px;
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 2px 0;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.foot-sync {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.foot-sync i {
  width: 5px;
  height: 5px;
  background: #4d9273;
  border-radius: 50%;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 19px 38px 28px;
  border-top: 1px solid rgba(23, 59, 50, 0.09);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.footer-brand p {
  margin: 0;
}

.mini-seal {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff7e9;
  background: var(--accent);
  border-radius: 5px;
  font-family: var(--font-display);
  font-size: 11px;
  transform: rotate(-3deg);
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.footer-dot {
  color: #c2b8a8;
}

/* ---------- Modals ---------- */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 31, 25, 0.58);
  backdrop-filter: blur(7px);
  animation: fade-in 0.2s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: min(430px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 29px 29px 25px;
  background: #fcf8ef;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 21px;
  box-shadow: 0 34px 90px -24px rgba(4, 25, 19, 0.65);
  animation: modal-in 0.28s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-wide {
  width: min(500px, 100%);
}

.modal-small {
  width: min(392px, 100%);
}

.modal-close {
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--ink);
  background: #f0e6d6;
}

.modal-close .icon {
  width: 15px;
  height: 15px;
}

.modal-emblem {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 15px;
  color: var(--accent-deep);
  background: rgba(211, 111, 76, 0.1);
  border: 1px solid rgba(211, 111, 76, 0.16);
  border-radius: 50%;
}

.modal-emblem .icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
}

.modal-emblem-danger {
  color: var(--danger);
  background: rgba(179, 78, 59, 0.09);
  border-color: rgba(179, 78, 59, 0.15);
}

.modal-kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.modal h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.modal-desc {
  margin: 0 0 19px;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.85;
}

.modal-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
}

.password-wrap {
  position: relative;
}

.password-wrap .input {
  height: 47px;
  padding-right: 57px;
  color: var(--ink);
  background: #fffdf8;
  border-color: var(--line-strong);
}

.password-wrap .input::placeholder {
  color: #a6ada7;
}

.password-wrap .input:focus {
  background: #fffdf8;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(211, 111, 76, 0.1);
}

.password-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 31px;
  padding: 0 8px;
  color: var(--accent-deep);
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
}

.password-toggle:hover {
  background: #f5ecdd;
}

.auth-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 10.5px;
}

.modal-hint {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.8;
  text-align: center;
}

.modal .btn-full {
  margin-top: 13px;
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 4px 0 2px;
}

.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.share-label {
  flex: none;
  width: 64px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.share-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-copy {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.share-copy:hover {
  color: var(--ink);
  background: #f5ecdd;
}

.share-copy .icon {
  width: 12px;
  height: 12px;
}

.share-empty {
  padding: 10px;
  color: var(--muted);
  background: #f7f0e3;
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.7;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.confirm-actions .btn {
  min-height: 40px;
  font-size: 11px;
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(350px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  color: #f8f2e5;
  background: rgba(20, 53, 44, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  box-shadow: 0 18px 40px -18px rgba(5, 27, 21, 0.7);
  font-size: 11px;
  line-height: 1.65;
  pointer-events: auto;
  animation: toast-in 0.28s var(--ease);
}

.toast::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  margin-top: 5px;
  background: #8fc4a5;
  border-radius: 50%;
}

.toast[data-kind="error"]::before {
  background: #f19b7f;
}

.toast[data-kind="info"]::before {
  background: #e7c27d;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.copy-fallback {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: minmax(360px, 400px) minmax(0, 1fr);
    gap: 20px;
  }

  .masthead h1 {
    font-size: 42px;
  }

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

  .leaderboard {
    grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .editor-panel {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
  }

  .viewer {
    gap: 18px;
  }

  .masthead {
    padding-top: 34px;
  }

  .masthead h1 {
    font-size: 40px;
  }

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

@media (max-width: 860px) {
  .site-header {
    padding: 20px 24px 18px;
  }

  .page-shell {
    padding: 0 24px 44px;
  }

  .site-footer {
    padding: 18px 24px 24px;
  }

  .masthead {
    padding: 26px 0 30px;
    align-items: flex-start;
  }

  .masthead-aside {
    display: none;
  }

  .masthead h1 {
    font-size: 36px;
  }

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

  .contour-art {
    opacity: 0.3;
  }
}

@media (max-width: 700px) {
  .site-header {
    flex-wrap: wrap;
    gap: 14px;
    padding: 16px 16px 14px;
  }

  .brand {
    gap: 10px;
  }

  .seal {
    width: 46px;
    height: 46px;
    border-radius: 11px;
  }

  .seal span {
    font-size: 16px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-eyebrow {
    font-size: 7.5px;
    letter-spacing: 0.13em;
  }

  .header-actions {
    width: 100%;
    gap: 7px;
  }

  .sync-pill {
    height: 34px;
    margin-right: auto;
  }

  .header-actions .btn {
    min-height: 36px;
    padding: 0 13px;
    font-size: 11px;
  }

  #shareBtn span {
    display: none;
  }

  .page-shell {
    padding: 0 16px 36px;
  }

  .masthead {
    padding: 24px 0 24px;
  }

  .masthead h1 {
    margin: 13px 0 14px;
    font-size: 30px;
    line-height: 1.34;
  }

  .masthead-desc {
    font-size: 12px;
    line-height: 1.85;
  }

  .masthead-kicker {
    font-size: 9px;
  }

  .editor-panel {
    padding: 20px 17px;
    border-radius: 20px;
  }

  .editor-heading {
    margin: 15px 0 18px;
  }

  .editor-heading h2 {
    font-size: 25px;
  }

  .editor-lock {
    min-height: 340px;
    padding: 32px 16px 26px;
  }

  .calendar-popover,
  .member-popover {
    min-width: 0;
  }

  .viewer-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-top: 5px;
  }

  .viewer-heading h2 {
    font-size: 24px;
  }

  .viewer-heading p {
    text-align: left;
  }

  .stats-panel,
  .records-panel {
    padding: 17px;
    border-radius: 18px;
  }

  .panel-heading h3 {
    font-size: 19px;
  }

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

  .records-toolbar {
    gap: 7px;
  }

  .btn-export span {
    display: none;
  }

  .btn-export {
    width: 42px;
    padding: 0;
  }

  .table-wrap {
    max-height: 560px;
  }

  .records-table {
    min-width: 690px;
  }

  .table-scroll-hint {
    display: flex;
  }

  .records-table th.col-date,
  .records-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fffdf9;
    box-shadow: 1px 0 0 var(--line);
  }

  .records-table th.col-date {
    z-index: 3;
    background: #f6efe2;
  }

  .records-table tbody tr:hover td:first-child {
    background: #fdf9f0;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 16px 16px 22px;
  }

  .modal {
    padding: 25px 20px 22px;
  }

  .modal h3 {
    font-size: 23px;
  }

  .toast-stack {
    right: 16px;
    bottom: 16px;
    width: calc(100vw - 32px);
  }
}

@media (max-width: 480px) {
  .brand-eyebrow {
    display: none;
  }

  .sync-pill {
    padding: 0 9px;
    font-size: 9.5px;
  }

  #lockBtnText {
    font-size: 10.5px;
  }

  .masthead h1 {
    font-size: 27px;
  }

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

  .stat-card {
    padding: 10px 9px;
    gap: 7px;
  }

  .stat-icon {
    width: 28px;
    height: 28px;
  }

  .stat-icon .icon {
    width: 13px;
    height: 13px;
  }

  .stat-value {
    font-size: 21px;
  }

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

  .leaderboard-head span {
    display: none;
  }

  .score-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .score-options {
    width: 100%;
  }

  .score-option {
    flex: 1;
  }

  .score-option span {
    width: 100%;
  }

  .member-options {
    grid-template-columns: 1fr;
    max-height: 220px;
  }

  .calendar-day {
    height: 31px;
  }

  .selected-chips {
    gap: 4px;
  }

  .records-panel .panel-heading h3 {
    font-size: 18px;
  }
}

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