@font-face {
  font-family: Fredoka;
  src: url("assets/fonts/fredoka.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: Nunito;
  src: url("assets/fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}
:root {
  --ink: #362143;
  --muted: #735d7b;
  --paper: #fff8fc;
  --pink: #ce286e;
  --line: #eedce9;
  --field-surface: #fdf6fb;
  --field-border: #d6b4cb;
  --field-hint: #806478;
  --field-halo: #ce286e22;
  --display: "Fredoka", "Trebuchet MS", sans-serif;
  --copy: "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.5 var(--copy); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #7244bd; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.06; }
.wrap { width: min(1180px, calc(100% - 80px)); margin-inline: auto; }
.topbar { background: #fffdfd; border-bottom: 1px solid #f2e1ec; }
.topbar-inner { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font: 600 1.68rem/1 var(--display); letter-spacing: -.04em; }
.brand b { color: var(--pink); font-weight: 600; }
.brand-mark { width: 37px; height: 35px; display: grid; place-items: center; padding-top: 1px; border: 2px solid #f38fb9; border-radius: 52% 52% 49% 47%; background: #ffd2e5; color: #be2564; font: 1.25rem/1 system-ui; transform: rotate(-10deg); box-shadow: 0 2px #f6b6d5; }
.theme-toggle { display: grid; place-items: center; flex: none; width: 42px; min-height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff5fb; color: #a71b58; font: 1.35rem/1 system-ui; }
.theme-toggle:hover { background: #ffe7f2; }
.theme-sun, [data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: inline; }
.button { display: inline-flex; min-height: 45px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; padding: 9px 17px; font-size: .91rem; font-weight: 900; line-height: 1.25; transition: background .15s, box-shadow .15s, transform .15s; }
.button span { font-size: 1.24em; line-height: 1; }
.primary { color: #fff; background: var(--pink); box-shadow: 0 3px 0 #9f2057; }
.primary:hover { background: #b81f60; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #9f2057; }
.secondary { color: #6c3a61; background: #fff5fb; border-color: #edd0e2; }
.secondary:hover { background: #ffe5f2; }
.casting { margin-top: 34px; scroll-margin-top: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title { display: flex; align-items: center; gap: 13px; }
.section-icon { flex: none; display: inline-grid; place-items: center; width: 49px; height: 49px; border-radius: 15px; border: 1px solid #f9cadf; background: #ffe4f1; color: #bf2a6a; font: 1.65rem/1 system-ui; }
.section-title h1 { font-size: clamp(1.85rem, 3vw, 2.45rem); letter-spacing: -.025em; }
.section-title p { margin-top: 4px; color: var(--muted); font-weight: 700; }
.filters { display: flex; align-items: center; padding: 4px; gap: 3px; border: 1px solid var(--line); border-radius: 999px; background: white; }
.filters button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 5px 11px; border: 0; border-radius: 999px; background: transparent; color: #6e5a75; font-size: .875rem; font-weight: 900; white-space: nowrap; }
.filters button[aria-pressed=true], .filters button:hover { color: #a9205c; background: #ffe7f2; }
.filters span { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding-inline: 3px; border-radius: 20px; background: #f5edf7; font-size: .76rem; }
.filters button[aria-pressed=true] span { background: #ffd0e5; }
.cast-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { position: relative; display: grid; grid-template-rows: auto 1fr; min-width: 0; overflow: hidden; padding: 8px; border: 1px solid var(--line); border-radius: 23px; background: #fff; box-shadow: 0 4px 0 #f5e6f0; }
.card-media { position: relative; container-type: inline-size; }
.portrait { position: relative; overflow: hidden; display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 16px; background-color: var(--portrait-color, #ffd4e7); }
.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--photo-position, 50% 43%);
  transform-origin: var(--photo-position, 50% 43%);
  transform: scale(var(--photo-zoom, 1));
}
.portrait span { font: 600 4.4rem/1 var(--display); color: #8d3a6a; }
.card.out .portrait { filter: grayscale(1) brightness(.75); }
.elimination-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-9deg);
  padding: .2em .58em .26em;
  border: 3px solid #ffb5d4;
  border-radius: 11px;
  background: #951a50;
  color: #fff3fa;
  box-shadow: 0 4px 0 #4d173b, 0 7px 20px #1d0d1b69;
  font: 700 clamp(1.1rem, 10cqi, 2.45rem)/1.1 var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.status { display: inline-flex; align-items: center; gap: 5px; width: max-content; white-space: nowrap; border-radius: 999px; padding: 5px 10px; background: #e6f9ed; color: #205a41; font-size: .82rem; font-weight: 900; line-height: 1.2; }
.status::before { content: ""; display: block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.out { background: #f7e6ef; color: #87395d; }
.card-body { display: grid; grid-template-rows: auto 1fr auto; padding: 14px 8px 8px; }
.card-body > :is(.eliminate, .departed) { grid-row: 3; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-heading .status { flex: none; margin-top: 2px; }
.card h3 { min-width: 0; font-size: 1.7rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.card p { margin-top: 4px; color: var(--muted); font-size: .93rem; min-height: 1.5em; overflow-wrap: anywhere; }
.eliminate { width: 100%; margin-top: 12px; color: #a81e59; background: #fff0f7; border-color: #f6d1e2; }
.eliminate:hover { background: #ffdeee; }
.departed { display: block; margin-top: 12px; padding: 10px 8px; border: 1px solid #f1cadd; border-radius: 14px; background: #ffedf5; text-align: center; color: #8d2355; font-weight: 900; }
.empty { grid-column: 1 / -1; padding: 35px 22px; border: 1px dashed #ebc4db; border-radius: 20px; text-align: center; color: var(--muted); background: #fff; }
.admin { margin-top: 40px; }
.access-panel { max-width: 430px; margin: 34px auto; }
#retry-casting { margin-top: 14px; }
[data-server-casting]:not([data-casting-ready]) #regie { display: none; }
.transfer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.transfer-actions label.button { margin: 0; cursor: pointer; }
.transfer-actions:has(#import-cast:focus-visible) label { outline: 2px solid var(--pink); outline-offset: 2px; }
.accessible-input { position: absolute; width: 1px !important; min-height: 1px !important; padding: 0 !important; clip-path: inset(50%); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.admin-panels { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 18px; align-items: start; }
.panel { padding: 24px; min-width: 0; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 4px 0 #f5e6f0; }
.panel h2 { margin-bottom: 18px; font-size: 1.6rem; }
.panel label { display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; margin: 14px 0 5px; font-weight: 900; }
.panel label small { color: var(--muted); font-weight: 700; font-size: .78rem; }
:is(.panel, .description-form) input {
  display: block;
  width: 100%;
  min-height: 46px;
  min-width: 0;
  padding: 9px 13px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--field-surface);
  color: var(--ink);
  caret-color: var(--pink);
  transition: border-color .15s, box-shadow .15s;
}
:is(.panel, .description-form) input::placeholder { color: var(--field-hint); opacity: 1; }
:is(.panel, .description-form) input:hover { border-color: var(--field-hint); }
:is(.panel, .description-form) input:focus {
  border-color: var(--pink);
  outline: 1px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--field-halo);
}
.panel input[type=file] { padding: 6px; font-size: .875rem; }
.panel input::file-selector-button { border: 0; border-radius: 7px; padding: 6px 9px; margin-right: 8px; background: #ffe6f1; color: #7b2351; font-weight: 800; cursor: pointer; }
.panel .primary { margin-top: 16px; }
.panel .primary:disabled { opacity: .65; cursor: wait; }
.field-note { margin-top: 4px; font-size: .875rem; color: var(--muted); }
.form-error { color: #a42750; margin-top: 8px; font-weight: 800; }
.admin-list { list-style: none; margin: 0; padding: 0; container-type: inline-size; }
.admin-list li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #f0e4ed; }
.admin-list .portrait { width: 44px; height: 44px; aspect-ratio: 1; border-radius: 10px; }
.admin-list .portrait span { font-size: 1.6rem; }
.admin-list strong { display: block; margin-bottom: 3px; line-height: 1.15; overflow-wrap: anywhere; }
.admin-list .button { min-height: 38px; padding: 6px 10px; }
.admin-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
@container (max-width: 395px) {
  .admin-list li { grid-template-columns: 44px minmax(0, 1fr); }
  .admin-actions { grid-column: 2; justify-content: flex-start; }
}
.photo-crop { margin-top: 10px; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px 28px; margin-top: 35px; border-top: 1px solid var(--line); color: var(--muted); font-weight: 800; }
.footer > span { font-family: var(--display); font-size: 1.1rem; }
.footer > span span { color: var(--pink); }
.footer small { font-size: .82rem; }
dialog { width: min(420px, calc(100% - 32px)); padding: 0; color: var(--ink); border: 1px solid #ebbbd4; border-radius: 25px; background: #fffbfe; box-shadow: 0 20px 70px #32113248; }
dialog::backdrop { background: #29113773; }
.dialog-body { padding: 26px; }
.dialog-body h2 { margin: 13px 0 10px; font-size: 1.9rem; }
.dialog-body p { color: var(--muted); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 21px; }
.description-form h2 { margin-top: 0; }
.description-form label { display: block; margin: 16px 0 5px; font-weight: 900; }
.description-form button:disabled { opacity: .65; cursor: wait; }
#crop-dialog { width: min(490px, calc(100% - 32px)); }
.crop-form h2 { margin: 0 0 16px; }
.crop-preview { margin-bottom: 13px; }
.crop-form label { display: block; font-weight: 900; }
.crop-form input[type=range] { display: block; width: 100%; height: 28px; margin: 0 0 8px; accent-color: var(--pink); cursor: ew-resize; }
.crop-reset { border: 0; padding: 3px 0; background: none; color: var(--muted); text-decoration: underline; font-weight: 800; }
.toast { position: fixed; z-index: 4; right: 20px; bottom: 20px; max-width: calc(100% - 40px); border-radius: 14px; background: var(--ink); color: white; font-weight: 800; box-shadow: 0 7px 24px #32113232; }
.toast:not(:empty) { padding: 12px 17px; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1b1421;
  --ink: #fff1fb;
  --muted: #d2b9d4;
  --pink: #ff9fc9;
  --line: #52354f;
  --field-surface: #221729;
  --field-border: #795474;
  --field-hint: #b99db5;
  --field-halo: #ff9fc92b;
  --surface: #2a1d31;
  --rose-surface: #49243c;
  --rose-hover: #55304a;
}
[data-theme="dark"] :focus-visible { outline-color: #d8b1fb; }
[data-theme="dark"] .topbar { background: #23182a; border-color: var(--line); }
[data-theme="dark"] .filters button { color: var(--muted); }
[data-theme="dark"] .filters button:is(:hover, [aria-pressed="true"]),
[data-theme="dark"] .theme-toggle { color: var(--pink); background: var(--rose-surface); border-color: #774360; }
[data-theme="dark"] .theme-toggle:hover { background: var(--rose-hover); }
[data-theme="dark"] :is(.card, .panel, .filters, .empty, dialog) { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] :is(.card, .panel) { box-shadow: 0 4px #130e18; }
[data-theme="dark"] :is(.section-icon, .secondary, .eliminate) { color: var(--pink); background: var(--rose-surface); border-color: #774360; }
[data-theme="dark"] :is(.secondary, .eliminate):hover { background: var(--rose-hover); }
[data-theme="dark"] .primary { color: #40142e; box-shadow: 0 3px #a94a76; }
[data-theme="dark"] .primary:hover { background: #ffc0db; }
[data-theme="dark"] .filters span { background: #3e2b46; }
[data-theme="dark"] .filters button[aria-pressed="true"] span { background: #643652; }
[data-theme="dark"] .status { background: #214336; color: #c2f6d9; }
[data-theme="dark"] .status.out { background: #562e45; color: #ffc3da; }
[data-theme="dark"] .departed { background: #3b2339; color: #ffc1de; border-color: #69415c; }
[data-theme="dark"] .panel input::file-selector-button { background: var(--rose-surface); color: var(--pink); }
[data-theme="dark"] .admin-list li { border-color: var(--line); }
[data-theme="dark"] .form-error { color: #ffacc6; }
[data-theme="dark"] dialog::backdrop { background: #100a14b0; }
[data-theme="dark"] .toast { background: #f6cbe4; color: #341a30; }
@media (max-width: 980px) {
  .wrap { width: calc(100% - 56px); }
  .cast-grid { gap: 14px; }
}
@media (max-width: 730px) {
  .wrap { width: calc(100% - 36px); }
  .section-head { flex-wrap: wrap; }
  .cast-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-panels { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .wrap { width: calc(100% - 28px); }
  .topbar-inner { min-height: 64px; gap: 7px; flex-wrap: wrap; padding-block: 8px; }
  .brand { font-size: 1.3rem; gap: 6px; }
  .brand-mark { width: 27px; height: 26px; font-size: .9rem; }
  .theme-toggle { width: 38px; }
  .cast-grid { grid-template-columns: 1fr; }
  .filters button { padding-inline: 9px; }
  .panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
@media (forced-colors: active) {
  :is(.panel, .description-form) input:focus { outline-color: Highlight; }
}
