:root {
  color-scheme: light;
  --page: #f3f6f6;
  --surface: #ffffff;
  --surface-soft: #edf3f3;
  --ink: #142f34;
  --muted: #526b72;
  --line: #dce6e7;
  --accent: #007c78;
  --accent-ink: #ffffff;
  --accent-text: #006b66;
  --accent-soft: #e1f3ed;
  --danger: #a53131;
  --shadow: 0 8px 28px rgba(20, 47, 52, .05);
  --focus: #006b66;
}

html[data-brand="memory"] {
  --page: #f4f1ec;
  --surface-soft: #faf7f1;
  --accent: #e6b969;
  --accent-ink: #392713;
  --accent-text: #8b5b16;
  --accent-soft: #faedcf;
  --focus: #8b5b16;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #101b20;
    --surface: #17272d;
    --surface-soft: #21353c;
    --ink: #e8f1f2;
    --muted: #b2c5ca;
    --line: #30464e;
    --accent: #75d7c9;
    --accent-ink: #103c38;
    --accent-text: #9be7dc;
    --accent-soft: #173c34;
    --danger: #ff918b;
    --shadow: 0 24px 70px rgba(0, 0, 0, .28);
    --focus: #9be7dc;
  }

  html[data-brand="memory"] {
    --page: #12100d;
    --surface: #1d1914;
    --surface-soft: #251f18;
    --accent: #e8bd70;
    --accent-ink: #2d210f;
    --accent-text: #f0c77c;
    --accent-soft: #392d1c;
    --focus: #f0c77c;
  }
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }

main, .profile-copy, .album-copy, .identity-list div, .brand-name { min-width: 0; }
h1, h2, h3, p, dd, strong, .brand-name, .reference { overflow-wrap: anywhere; }
[id] { scroll-margin-top: 24px; }

.profile-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.profile-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; font-size: 14px; font-weight: 750; }
.profile-nav a:hover { border-color: var(--focus); background: var(--accent-soft); }
.profile-event-guides { overflow: hidden; border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.profile-event-guides .section-heading { gap: 12px; margin-bottom: 0; }
.profile-event-label { align-self: start; padding-top: 6px; color: var(--muted); font-size: 10px; letter-spacing: .14em; white-space: nowrap; }
.profile-events-intro { margin: 12px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.profile-event-guide-list { display: grid; gap: 12px; }
.profile-event-guide { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.profile-event-guide.is-shooting { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); }
.profile-event-guide-copy { min-width: 0; }
.profile-event-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.profile-event-state i { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.is-shooting .profile-event-state { color: var(--accent-text); }
.profile-event-guide h3 { margin: 9px 0; font-size: clamp(20px, 4.4vw, 27px); font-weight: 850; line-height: 1.4; letter-spacing: -.03em; }
.profile-event-date { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.profile-event-guide-action { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 20px; min-height: 48px; padding: 13px 17px; border: 1px solid transparent; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 800; text-decoration: none; }
.profile-event-guide-action:hover { filter: brightness(.95); color: var(--accent-ink); }
.profile-event-arrow { font-size: 23px; line-height: 1; font-weight: 400; }
@media (max-width: 540px) {
  .profile-event-guide { align-items: stretch; flex-direction: column; gap: 17px; padding: 18px; }
  .profile-event-guide-action { width: 100%; }
  .profile-event-label { font-size: 9px; }
}
.directory-search { display: grid; gap: 8px; margin: 22px 0 18px; }
.directory-search label { font-size: 14px; font-weight: 750; }
.directory-search-row { display: flex; gap: 8px; }
.directory-search input { width: 100%; min-width: 0; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); color: var(--ink); font-size: 16px; }
.directory-search button { flex-shrink: 0; min-height: 48px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--ink); cursor: pointer; }
.directory-search .field-note { margin: 0; }
.form-progress { margin: 0; font-size: 14px; line-height: 1.6; }
.form-progress:empty { display: none; }
[data-character-count] { text-align: right; }
.complaint-form[aria-busy="true"] { opacity: .8; }

html {
  min-width: 320px;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: var(--page);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.public-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  margin: 0 0 24px;
  padding: 2px 0 16px;
  border-bottom: 1px solid var(--line);
}

.public-data-notice {
  position: sticky;
  top: max(4px, env(safe-area-inset-top));
  z-index: 9;
  margin: 0 0 14px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.public-data-notice p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.public-data-notice a {
  display: inline-block;
  min-height: 26px;
  margin-left: 6px;
  color: var(--accent-text);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  overflow: hidden;
  place-items: center;
  padding: 2px;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
  font-size: 17px;
  font-weight: 950;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: 34%;
  object-fit: cover;
}

/* The legacy alternate-brand visual remains hidden for old stored records. */
html[data-brand="memory"] .public-brand .brand-mark {
  display: none;
}

html[data-brand="memory"] .public-brand {
  gap: 0;
}

.brand-name {
  font-size: clamp(17px, 4vw, 20px);
  font-weight: 850;
  letter-spacing: .025em;
}

main {
  display: grid;
  gap: 20px;
}

.section-card,
.official-notice {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-card {
  padding: clamp(22px, 4.6vw, 38px);
}

.profile-hero {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  gap: clamp(22px, 4vw, 38px);
  align-items: start;
}

.profile-lottery {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  gap: 24px;
  align-items: center;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
}

.profile-lottery-copy {
  min-width: 0;
}

.profile-lottery-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.profile-lottery-meta span {
  display: inline-flex;
  align-items: center;
}

.profile-lottery-action {
  display: grid;
  min-height: 64px;
  align-content: center;
  gap: 2px;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 12%, transparent);
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.profile-lottery-action span {
  font-size: 17px;
  font-weight: 900;
}

.profile-lottery-action small {
  font-size: 11px;
  font-weight: 650;
  opacity: .76;
}

.profile-nfc-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  margin-top: 20px;
  padding: 15px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.profile-nfc-entry .section-kicker { margin-bottom: 4px; }
.profile-nfc-entry strong { display: block; }
.profile-nfc-entry p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.profile-nfc-action {
  display: inline-flex;
  min-height: 46px;
  padding: 10px 15px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--focus) 65%, var(--line));
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 820;
  text-align: center;
  text-decoration: none;
}

.avatar-frame {
  position: relative;
  width: 152px;
  height: 190px;
}

.avatar-frame::after {
  position: absolute;
  inset: -6px;
  z-index: -1;
  border: 1px solid var(--line);
  border-radius: 24px;
  content: "";
  transform: none;
}

.profile-avatar {
  display: grid;
  width: 152px;
  height: 190px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  object-fit: contain;
  object-position: center top;
}

.profile-avatar-fallback {
  align-content: center;
  gap: 3px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: .05em;
}

.profile-avatar-fallback small {
  display: block;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0;
  opacity: .72;
}

.section-kicker,
.media-type {
  margin: 0;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 8px 0 0;
  font-size: clamp(30px, 6vw, 50px);
  line-height: 1.2;
  letter-spacing: -.04em;
}

h2 {
  margin: 5px 0 0;
  font-size: clamp(23px, 4vw, 31px);
  line-height: 1.2;
  letter-spacing: -.025em;
}

h3 {
  margin: 5px 0 0;
  font-size: 17px;
  line-height: 1.4;
}

.profile-name {
  margin: 12px 0 0;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.25;
}

.profile-hero h1 { font-size: 22px; color: var(--muted); }

.identity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 22px 0 0;
}

.identity-list div {
  min-width: 112px;
}

.identity-list dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.identity-list dd {
  margin: 0;
  font-size: 15px;
  font-weight: 760;
}

.public-identity-card {
  display: grid;
  gap: 3px;
  margin-top: 18px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.public-identity-card span,
.public-identity-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.public-identity-card strong {
  font-size: 16px;
  line-height: 1.4;
}

.public-identity-card.is-current {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
}

.public-identity-card.is-unverified strong {
  color: var(--muted);
}

.profile-bio,
.section-intro,
.complaint-section > p,
.status-card > p {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.item-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.media-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.media-card img,
.media-placeholder {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
  color: var(--muted);
  object-fit: cover;
}

.media-placeholder span {
  font-size: 12px;
  font-weight: 760;
}

.media-link {
  display: block;
}

.media-copy {
  padding: 15px;
}

.media-type {
  color: var(--muted);
  font-size: 10px;
}

.text-link {
  display: inline-block;
  margin-top: 13px;
  color: var(--focus);
  font-size: 14px;
  font-weight: 780;
  text-underline-offset: 4px;
}

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

.album-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 9px 14px 9px 9px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-soft);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.album-card img,
.album-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 800;
  object-fit: cover;
}

.album-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.album-copy strong {
  font-size: 15px;
}

.album-copy span,
.album-copy time {
  color: var(--muted);
  font-size: 12px;
}

.album-copy .album-progress {
  display: grid;
  gap: 2px;
  margin-top: 4px;
  line-height: 1.45;
}

.album-copy .album-progress-label {
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 750;
}

.album-copy .album-progress small {
  color: var(--muted);
  font-size: 11px;
}

.album-copy .album-progress--unknown {
  color: var(--muted);
}

.album-arrow {
  color: var(--focus);
  font-size: 13px;
  font-weight: 800;
}

.empty-state {
  margin: 0;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.complaint-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  margin-top: 24px;
}

.complaint-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
}

.complaint-form label:nth-of-type(3),
.complaint-form .primary-action,
.privacy-note {
  grid-column: 1 / -1;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 16px;
}

select {
  min-height: 50px;
  padding: 0 13px;
}

textarea {
  min-height: 148px;
  padding: 13px;
  line-height: 1.6;
  resize: vertical;
}

.field-note,
.privacy-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.65;
}

.primary-action {
  display: grid;
  min-height: 50px;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.action-link {
  margin-top: 24px;
}

.official-notice {
  padding: 18px 20px;
  box-shadow: none;
}

.official-notice strong {
  font-size: 13px;
}

.official-notice p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.success-icon,
.status-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--focus);
  font-size: 25px;
  font-weight: 900;
}

.reference {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink) !important;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px !important;
}

.status-main {
  min-height: min(68dvh, 650px);
  place-items: center;
}

.status-card {
  width: min(100%, 600px);
}

.status-icon {
  width: 62px;
  font-size: 13px;
  letter-spacing: .05em;
}

.status-help {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--surface);
}

@media (hover: hover) {
  .album-card:hover,
  .media-card:hover {
    border-color: color-mix(in srgb, var(--accent) 74%, var(--line));
  }

  .album-card:hover,
  .profile-lottery-action:hover,
  .primary-action:hover {
    transform: translateY(-2px);
  }

  .album-card:hover,
  .profile-lottery-action:hover {
    box-shadow: 0 14px 32px color-mix(in srgb, var(--accent) 18%, transparent);
  }

  .primary-action:hover {
    filter: brightness(1.035);
  }
}

@media (max-width: 760px) {
  .works-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  body {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .section-card,
  .official-notice {
    border-radius: 20px;
  }

  .section-card {
    padding: 22px 18px;
  }

  .public-brand {
    margin-bottom: 14px;
  }

  .profile-hero {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px 16px;
  }

  .profile-hero .avatar-frame { grid-column: 1; grid-row: 1 / span 3; }
  .profile-hero .profile-copy { display: contents; }
  .profile-hero .profile-copy > .section-kicker { grid-column: 2; align-self: end; }
  .profile-hero h1 { grid-column: 2; margin: 0; font-size: 19px; }
  .profile-hero .profile-name { grid-column: 2; margin: 0; font-size: 28px; }
  .profile-hero .identity-list,
  .profile-hero .public-identity-card,
  .profile-hero .profile-bio,
  .profile-hero .profile-nfc-entry { grid-column: 1 / -1; }

  .profile-lottery {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .profile-lottery-action {
    width: 100%;
    min-height: 58px;
  }

  .profile-nfc-entry { grid-template-columns: 1fr; }
  .profile-nfc-action { width: 100%; }

  .avatar-frame,
  .profile-avatar {
    width: 88px;
    height: 110px;
  }

  .profile-avatar {
    border-radius: 14px;
  }

  .profile-hero .identity-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

  .profile-avatar-fallback {
    font-size: 32px;
  }

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

  .complaint-form {
    grid-template-columns: 1fr;
  }

  .complaint-form label,
  .complaint-form label:nth-of-type(3),
  .complaint-form .primary-action,
  .privacy-note {
    grid-column: 1;
  }
}

@media (max-width: 390px) {
  .works-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-wrap: wrap;
  }

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

  .album-card img,
  .album-icon {
    width: 50px;
    height: 50px;
  }

  .album-arrow {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
  }
}

.photo-frame-promo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 22px;
  align-items: center;
  background: linear-gradient(125deg, var(--surface), var(--accent-soft));
}

.photo-frame-promo h2 {
  margin: 7px 0;
  color: var(--ink);
  font-size: clamp(20px, 3vw, 25px);
}

.photo-frame-promo p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.photo-frame-promo .section-kicker { color: var(--accent-text); }

.photo-frame-promo button {
  min-height: 48px;
  padding: 11px 17px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.photo-frame-promo button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.photo-frame-promo .field-note { grid-column: 1 / -1; }
.photo-frame-promo .field-note:empty { display: none; }

@media (max-width: 540px) {
  .photo-frame-promo { grid-template-columns: minmax(0, 1fr); }
  .photo-frame-promo button { width: 100%; }
}
