:root {
  color-scheme: light;
  --primary: #b83f87;
  --primary-strong: #9f3272;
  --primary-weak: #fff0f8;
  --primary-weak-text: #96336e;
  --foreground: #202733;
  --body: #4f5967;
  --muted: #7a828d;
  --canvas: #fff;
  --page: #f7f8f9;
  --surface: #f0f2f4;
  --border: #e2e5e9;
  --danger: #d83945;
  --danger-weak: #fff1f2;
  --success: #16883e;
  --success-weak: #edfaf2;
  --warning: #b26800;
  --warning-weak: #fff7e6;
  --focus: rgb(184 63 135 / .18);
  --radius: 10px;
  --font: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  --display: "Gaegu", "Nanum Pen Script", "Apple SD Gothic Neo", cursive;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@font-face { font-family: "Gaegu"; src: url("/assets/fonts/gaegu-300.ttf") format("truetype"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Gaegu"; src: url("/assets/fonts/gaegu-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Gaegu"; src: url("/assets/fonts/gaegu-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }

* { box-sizing: border-box; }
html { background: var(--page); scroll-behavior: smooth; }
body { margin: 0; overflow-wrap: break-word; color: var(--foreground); background: var(--page); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
.app-shell { overflow-x: clip; }
a { color: inherit; }
button, input { font: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: rgb(184 63 135 / .12); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:active, .button-primary:active, .button-secondary:active { transform: scale(.98); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 2; padding: 10px 14px; border-radius: 10px; color: #fff; background: var(--primary); opacity: 0; pointer-events: none; transform: translateY(-150%); }
.skip-link:focus-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.site-header { height: 64px; border-bottom: 1px solid var(--border); background: rgb(255 255 255 / .94); }
.nav-inner { width: min(100% - 48px, 1120px); height: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--foreground); font-size: 19px; font-weight: 700; letter-spacing: -.02em; text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
nav form { margin: 0; }
.role { padding: 4px 8px; border-radius: 6px; color: var(--body); background: var(--surface); font-size: 12px; font-weight: 600; }
.nav-link { color: var(--primary-weak-text); font-weight: 600; text-decoration: none; }
.nav-link:hover { color: var(--primary-strong); }
.nav-button, .text-button { min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; color: var(--body); background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none; }
.nav-button:hover, .text-button:hover { color: var(--foreground); background: var(--surface); }

main { width: min(100% - 48px, 1120px); margin: 0 auto; padding: 64px 0 104px; }
h1, h2, h3 { margin: 0; color: var(--foreground); font-family: var(--font); text-wrap: balance; }
h1 { font-size: clamp(32px, 4vw, 42px); font-weight: 700; line-height: 1.25; letter-spacing: -.035em; }
h2 { font-size: 24px; font-weight: 700; line-height: 1.4; letter-spacing: -.025em; }
h3 { font-size: 20px; font-weight: 600; line-height: 1.4; }
p { margin: 0; color: var(--body); text-wrap: pretty; }
code { font-family: var(--mono); font-size: .9em; }
small { color: var(--muted); font-variant-numeric: tabular-nums; }

.page-intro { margin-bottom: 44px; }
.page-intro p, .page-heading p { max-width: 65ch; margin-top: 10px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; margin-bottom: 40px; }
.page-heading .actions { justify-content: flex-end; }
.actions { display: flex; align-items: center; gap: 10px; }
.actions form { margin: 0; }
.back-link { display: inline-flex; margin-bottom: 24px; color: var(--primary-weak-text); font-size: 14px; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.notice { margin: -24px 0 32px; padding: 14px 16px; border: 1px solid #bce7ca; border-radius: var(--radius); color: var(--success); background: var(--success-weak); font-size: 14px; font-weight: 600; }
.error { color: var(--danger); }
.status { width: fit-content; display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-success { color: var(--success); background: var(--success-weak); }
.status-danger { color: var(--danger); background: var(--danger-weak); }
.status-warning { color: var(--warning); background: var(--warning-weak); }
.status-neutral { color: var(--body); background: var(--surface); }
.status-panel { margin-bottom: 24px; padding: 24px 28px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
.status-panel h2 { font-size: 20px; }
.status-panel p { margin-top: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.status-detail { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--border); }

.project-section { margin-bottom: 24px; padding: 28px 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
.project-section h2 { margin-bottom: 18px; }
.project-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.project-section-header h2 { margin-bottom: 4px; }
.project-section-header p { color: var(--muted); font-size: 13px; }
.document-toolbar { margin: 20px 0 12px; padding: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.document-toolbar input, .document-toolbar select { width: auto !important; min-height: 40px !important; padding-inline: 12px !important; background: #fff !important; }
.document-toolbar input { flex: 1 1 160px; }
.document-toolbar select { flex: 0 1 150px; }
.document-toolbar-separator { width: 1px; height: 28px; background: var(--border); }
.document-select { flex: none; display: grid; place-items: center; }
.document-file[draggable="true"] { cursor: grab; }
.document-file.is-hidden { opacity: .58; background: var(--surface); }
.document-file.is-pinned { background: var(--primary-weak); }
.document-source { margin-top: 3px; display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.document-inline-editor { display: flex; align-items: center; gap: 6px; }
.document-inline-editor input { width: min(300px, 42vw) !important; min-height: 40px !important; background: #fff !important; }
.icon-button { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; flex: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button:hover, .icon-button.is-active { color: var(--primary-weak-text); background: var(--primary-weak); }
.icon-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.move-button { display: none; }
.upload-folder summary.is-drop-target { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--primary-weak); }
.document-list { margin: 0; padding: 0; list-style: none; }
.document-row, .upload-file-row { min-height: 64px; padding: 12px 4px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); }
.document-name, .upload-file-name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.document-file > .upload-file-name { flex: 1; text-align: left; }
.document-actions { display: flex; flex: none; gap: 8px; }
.empty-row { padding: 28px 4px; color: var(--muted); text-align: center !important; }

/* Shared application controls. */
.button-primary, button.button-primary, .button-secondary { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .12s ease; }
.button-primary, button.button-primary { border: 1px solid var(--primary); color: #fff; background: var(--primary); }
.button-primary:hover { border-color: var(--primary-strong); background: var(--primary-strong); }
.button-secondary { border: 1px solid var(--border); color: var(--foreground); background: var(--canvas); }
.button-secondary:hover { color: var(--foreground); background: var(--surface); }
button:disabled { border-color: var(--surface); color: var(--muted); background: var(--surface); cursor: not-allowed; transform: none; }

.table-wrap { max-width: 100%; overflow-x: auto; margin-bottom: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
.project-table { min-width: 760px; }
th, td { padding: 18px 20px; text-align: left; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
th { color: var(--muted); font-size: 13px; font-weight: 600; }
td:last-child, th:last-child { text-align: right; }
.project-name { font-size: 16px; font-weight: 600; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.row-actions form { margin: 0; display: flex; }
.row-actions .text-button { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.danger { color: var(--danger); }
.danger:hover { color: var(--danger) !important; background: var(--danger-weak); }

.admin-footer-actions { display: flex; justify-content: flex-end; }
.dialog { width: min(100% - 32px, 640px); max-height: min(88dvh, 760px); margin: auto; padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 16px; color: var(--foreground); background: var(--canvas); box-shadow: 0 24px 64px rgb(25 31 40 / .18); opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .18s ease-out, transform .18s cubic-bezier(.2, .8, .2, 1), overlay .18s allow-discrete, display .18s allow-discrete; }
.dialog[open] { opacity: 1; transform: translateY(0) scale(1); }
.dialog::backdrop { background: rgb(25 31 40 / 0); backdrop-filter: blur(0); transition: background-color .18s ease-out, backdrop-filter .18s ease-out, overlay .18s allow-discrete, display .18s allow-discrete; }
.dialog[open]::backdrop { background: rgb(25 31 40 / .42); backdrop-filter: blur(2px); }
@starting-style {
  .dialog[open] { opacity: 0; transform: translateY(10px) scale(.98); }
  .dialog[open]::backdrop { background: rgb(25 31 40 / 0); backdrop-filter: blur(0); }
}
.dialog-header { padding: 28px 28px 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { font-size: 22px; }
.dialog-header p { margin-top: 6px; font-size: 14px; }
.dialog-close { width: 36px; height: 36px; padding: 0; display: grid; flex: none; place-items: center; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.dialog-close:hover { color: var(--foreground); background: var(--surface); }
.dialog-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dialog form { padding: 26px 28px 28px; }
.dialog-actions { padding-top: 6px; display: flex; justify-content: flex-end; gap: 10px; }

.form-section { padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
.form-section + .form-section { margin-top: 24px; }
.form-section h2, .uploads h2 { margin-bottom: 28px; }
.viewer-heading { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.viewer-heading h2 { margin-bottom: 4px; }
.viewer-heading p { color: var(--muted); font-size: 14px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; color: var(--body); font-size: 14px; font-weight: 600; }
.viewer-projects { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.viewer-share-select { min-width: 240px; align-self: flex-end; }
.viewer-share-page { width: min(1440px, calc(100vw - 48px)); margin-left: 50%; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); transform: translateX(-50%); }
.viewer-share-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.viewer-share-column-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.viewer-share-column-header h2 { font-size: 22px; }
.viewer-share-column-header p { color: var(--muted); font-size: 13px; }
.viewer-share-page .upload-search { margin: 16px 0 10px; }
.viewer-share-list { min-height: 52vh; max-height: 62vh; padding: 10px; display: grid; align-content: start; gap: 6px; overflow: auto; border: 1px dashed var(--border); border-radius: 10px; background: var(--page); }
.viewer-share-list.is-allowed { border-color: var(--primary); background: var(--primary-weak); }
.viewer-share-item { padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--canvas); cursor: grab; }
.viewer-share-item span { min-width: 0; margin-right: auto; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; }
.viewer-share-page form > .form-actions { margin-top: 20px; }
.stack { display: grid; gap: 20px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-wide { grid-column: 1 / -1; }
label { display: grid; gap: 8px; color: var(--body); font-size: 14px; font-weight: 600; }
input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]), select { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--foreground); background: var(--canvas); transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; appearance: none; border: 1px solid #c8d0da; border-radius: 4px; background: var(--canvas); }
input[type="checkbox"]:checked { border-color: var(--primary); background: var(--primary) url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m4 8 2.4 2.4L12 5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e") center/14px no-repeat; }
label:has(input[type="checkbox"]) { grid-template-columns: 16px 1fr; align-items: center; cursor: pointer; }
input::placeholder { color: var(--muted); }
input:not([type="checkbox"]):not([type="file"]):hover { border-color: #c9d0d8; }
input:not([type="checkbox"]):not([type="file"]):focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); outline: 0; }
input:not([type="checkbox"]):not([type="file"]):disabled { color: var(--muted); background: var(--surface); }
.form-actions { padding-top: 4px; display: flex; justify-content: flex-end; }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.input-action .button-secondary { min-height: 52px; }
.github-picker-status { min-height: 21px; margin: -8px 0 0; color: var(--muted); font-size: 13px; }
.github-picker-status:empty { min-height: 0; }
[data-branch-select] { margin-top: 8px; }
.directory-picker { max-height: 320px; padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.directory-toolbar { position: sticky; top: 0; z-index: 1; padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); background: rgb(247 248 249 / .96); backdrop-filter: blur(8px); }
.directory-toolbar input { min-height: 44px !important; background: #fff !important; }
.directory-toolbar span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.directory-options { padding: 8px 12px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.directory-options label:has(input[type="checkbox"]) { min-width: 0; padding: 8px; border-radius: 7px; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.directory-picker label:has(input[type="checkbox"]):hover { background: #fff; }
.input-action:has([data-public-dirs][hidden]) { grid-template-columns: 1fr; }

.upload-section { margin: 24px 0; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
.upload-section p { max-width: 65ch; margin-top: 8px; color: var(--muted); font-size: 14px; }
.upload-section form { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 16px; }
.upload-section form.is-dragging { border-radius: 12px; outline: 3px dashed var(--primary); outline-offset: 10px; }
.upload-location { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.upload-location strong { color: var(--foreground); font-family: var(--mono); overflow-wrap: anywhere; }
.upload-location button { margin-left: auto; }
.upload-drop-hint { margin: -4px 0 0 !important; text-align: center; }
.upload-complete { margin-top: 20px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; border-radius: 10px; background: var(--primary-weak); }
.upload-complete span { min-width: 0; margin-right: auto; overflow-wrap: anywhere; }
.file-field { min-width: 0; }
.file-picker { position: relative; min-height: 96px; padding: 16px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; color: var(--body); background: #fbfcfd; font-weight: 400; transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease; }
.file-picker:hover { border-color: #b8c1cc; background: #f7f9fb; }
.file-picker:has(input:focus-visible) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.file-picker-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; color: var(--primary-weak-text); background: var(--primary-weak); }
.file-picker-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.file-picker-copy { min-width: 0; display: grid; gap: 3px; }
.file-picker-copy strong { color: var(--foreground); font-size: 14px; font-weight: 600; }
.file-picker-copy small { overflow: hidden; color: var(--muted); font-size: 13px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-button { min-height: 36px; padding-inline: 12px; pointer-events: none; }
.file-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-section label:has(input[type="checkbox"]) { justify-self: start; }
.upload-section form > .button-primary { justify-self: end; }
.uploads { padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
.uploads-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.uploads-header h2 { margin-bottom: 4px; }
.uploads-header p { color: var(--muted); font-size: 13px; }
.upload-tree-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.upload-search { margin: 24px 0 12px; display: block; }
.upload-search input { width: 100%; }
.upload-tree { border-top: 1px solid var(--border); }
.upload-folder { border-bottom: 1px solid var(--border); }
.upload-folder summary { min-height: 56px; padding: 0 8px; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; list-style: none; }
.upload-folder summary::-webkit-details-marker { display: none; }
.upload-folder summary::before { content: "›"; color: var(--muted); font-size: 24px; transform: rotate(0); transition: transform .18s; }
.upload-folder[open] > summary::before { transform: rotate(90deg); }
.upload-folder summary:hover { background: var(--primary-weak); }
.upload-folder-target { padding: 4px 0; border: 0; color: inherit; background: transparent; font: inherit; cursor: pointer; }
.upload-folder-target:hover { color: var(--primary-weak-text); text-decoration: underline; }
.upload-folder summary small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.folder-rename-button { flex: none; }
.upload-folder-children { padding-left: 24px; }
.upload-file-row:last-child { border-bottom: 0; }
.upload-file-row form { flex: none; }
.inline { display: inline; margin: 0; }

.empty-state { width: min(100%, 560px); margin: 12vh auto 0; padding: 40px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); text-align: center; }
.empty-state p { margin: 12px auto 24px; max-width: 44ch; }

.message-state { position: relative; min-height: min(620px, calc(100dvh - 232px)); padding: clamp(44px, 7vw, 88px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .72fr); align-items: center; gap: 48px; overflow: hidden; border: 1px solid var(--border); border-radius: 24px; background: #fcfcfd; }
.message-state::before { content: ""; position: absolute; inset: 0; opacity: .4; background-image: radial-gradient(var(--border) .75px, transparent .75px); background-size: 18px 18px; pointer-events: none; }
.message-copy { position: relative; z-index: 1; max-width: 560px; }
.message-eyebrow { margin-bottom: 18px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.message-eyebrow::before { content: ""; width: 27px; height: 1px; background: var(--foreground); }
.message-state h1 { max-width: 10ch; font: 700 clamp(48px, 6vw, 80px)/.95 "Gaegu", cursive; letter-spacing: -.035em; }
.message-copy > p:not(.message-eyebrow) { max-width: 44ch; margin-top: 24px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.message-action { min-height: 48px; margin-top: 32px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: #fff; background: var(--primary); box-shadow: 0 10px 24px rgb(184 63 135 / .2); font-weight: 700; text-decoration: none; transition: transform .2s, box-shadow .2s, filter .2s; }
.message-action:hover { transform: translateY(-2px); filter: saturate(.88); box-shadow: 0 14px 29px rgb(184 63 135 / .26); }
.message-action:active { transform: translateY(1px); box-shadow: none; }
.message-action:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.message-character { position: relative; z-index: 1; justify-self: center; width: min(100%, 340px); transform: rotate(4deg); }
.message-character::before { content: ""; position: absolute; inset: 12% -8% -5% 10%; border-radius: 46% 54% 42% 58% / 55% 42% 58% 45%; background: #f8d8eb; transform: rotate(-9deg); }
.message-character img { position: relative; width: 100%; height: auto; display: block; border-radius: 24%; box-shadow: 0 24px 70px rgb(62 78 101 / .13); }

.auth-page { min-width: 320px; background: #fff; }
.auth-page main { width: 100%; min-height: 100dvh; margin: 0; padding: 0; }
.login-skip { position: fixed; top: -64px; left: 16px; z-index: 2; padding: 12px 16px; color: #fff; background: #202733; }
.login-skip:focus { top: 16px; }
.login { --login-fg: #202733; --login-muted: #7a828d; --login-border: #e2e5e9; --login-accent: #b83f87; --login-pink: #ffc2e9; min-height: 100dvh; display: grid; grid-template-columns: 56% 44%; color: var(--login-fg); }
.login-intro { position: relative; min-width: 0; min-height: 100dvh; padding: clamp(32px, 4vw, 72px); display: flex; overflow: hidden; border-right: 1px solid var(--login-border); background: #fcfcfd; font-family: "Gaegu", cursive; }
.login-intro::after { content: ""; position: absolute; inset: 0; opacity: .38; background-image: radial-gradient(var(--login-border) .75px, transparent .75px); background-size: 18px 18px; pointer-events: none; }
.login-intro-inner { position: relative; z-index: 1; width: min(100%, 736px); display: flex; flex-direction: column; }
.login-brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 45% 55% 58% 42% / 52% 42% 58% 48%; color: var(--login-fg); background: var(--login-pink); font: 700 20px/1 "Gaegu", cursive; transform: rotate(-8deg); }
.login-hero { margin: auto 0; padding: 80px 0 64px; }
.login-eyebrow { margin: 0 0 20px; display: flex; align-items: center; gap: 9px; color: var(--login-muted); font: 700 12px/1.5 var(--font); letter-spacing: .08em; text-transform: uppercase; }
.login-eyebrow::before { content: ""; width: 27px; height: 1px; background: var(--login-fg); }
.login-intro h1 { max-width: 10ch; margin: 0; font: 700 clamp(53px, 6.4vw, 109px)/.98 "Gaegu", cursive; letter-spacing: -.035em; }
.login-intro .login-hero > p:last-child { max-width: 496px; margin-top: 28px; color: var(--login-muted); font-size: clamp(16px, 1.4vw, 18px); line-height: 1.65; }
.login-character { position: absolute; left: clamp(-88px, -5vw, -48px); bottom: clamp(-256px, -15vw, -192px); width: clamp(464px, 42vw, 624px); user-select: none; pointer-events: none; }
.login-panel { min-width: 0; min-height: 100dvh; padding: clamp(32px, 6vw, 88px); display: grid; place-items: center; background: #fff; }
.login-card { width: min(100%, 432px); }
.login-mobile-brand { display: none; }
.login-card h2 { margin: 0; font: 700 clamp(32px, 3.2vw, 44px)/1.08 "Gaegu", cursive; letter-spacing: -.025em; }
.login-description { margin: 14px 0 40px; color: var(--login-muted); line-height: 1.6; }
.login-field { margin-bottom: 18px; display: grid; gap: 9px; }
.login-field label { color: var(--login-fg); font-size: 16px; font-weight: 700; }
.login-field input { min-height: 56px !important; padding: 0 16px !important; border: 1px solid transparent !important; border-radius: 9px !important; color: var(--login-fg) !important; background: #f7f8f9 !important; font-size: 16px; }
.login-field input:hover { border-color: var(--login-border) !important; }
.login-field input:focus { border-color: var(--login-accent) !important; background: #fff !important; box-shadow: 0 0 0 3px rgb(184 63 135 / .13) !important; }
.login-field.has-error input { border-color: var(--login-fg) !important; background: #fff !important; }
.login-field-message { display: none; color: var(--login-fg); font-size: 12px; line-height: 1.5; }
.login-field.has-error .login-field-message { display: block; }
.login-input-wrap { position: relative; }
.login-input-wrap input { padding-right: 56px !important; }
.login-reveal { position: absolute; top: 7px; right: 7px; width: 42px; height: 42px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 6px; color: var(--login-muted); background: transparent; cursor: pointer; }
.login-reveal:hover { color: var(--login-fg); background: var(--login-border); }
.login-reveal svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.login-reveal:focus-visible, .login-button:focus-visible, .login-skip:focus-visible { outline: 3px solid var(--login-accent); outline-offset: 3px; }
.login-button { width: 100%; min-height: 58px; margin-top: 10px; border: 0; border-radius: 9px; color: #fff; background: var(--login-accent); box-shadow: 0 10px 24px rgb(184 63 135 / .22); font-size: 16px; font-weight: 700; cursor: pointer; transition: transform .2s, box-shadow .2s, filter .2s; }
.login-button:hover { transform: translateY(-2px); filter: saturate(.88); box-shadow: 0 14px 29px rgb(184 63 135 / .28); }
.login-button:active { transform: translateY(1px); box-shadow: none; }
.login-button:disabled { color: #fff; background: var(--login-accent); cursor: wait; filter: saturate(.55); box-shadow: none; }
.login-button-label { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.login-button.is-loading .login-button-label::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: login-spin .7s linear infinite; }
.login-form-status { min-height: 24px; margin: 16px 0 0; color: var(--login-fg); font-size: 12px; line-height: 1.5; }
.login-form-status:empty { min-height: 0; margin-top: 0; }
.login-form-status.is-error { color: var(--danger); }
.login-support { margin-top: 24px; display: flex; justify-content: space-between; gap: 16px; color: var(--login-muted); font-size: 12px; line-height: 1.5; }
@keyframes login-spin { to { transform: rotate(1turn); } }

/* Branded application surface shared with the login experience. */
.app-shell { background-color: var(--page); background-image: radial-gradient(var(--border) .7px, transparent .7px); background-size: 20px 20px; }
.site-header { position: sticky; top: 0; z-index: 2; height: 72px; background: rgb(255 255 255 / .94); backdrop-filter: blur(14px); }
.brand { font-size: 18px; }
.brand img { width: 38px; height: 38px; border-radius: 45% 55% 58% 42% / 52% 42% 58% 48%; transform: rotate(-5deg); }
.role { border-radius: 5px; background: var(--primary-weak); color: var(--primary-weak-text); }
.nav-link { min-height: 40px; display: inline-flex; align-items: center; }
.nav-button, .text-button { min-height: 40px; }

.app-shell main { padding-top: 72px; }
.app-shell h1, .app-shell h2, .dialog h2 { font-family: var(--display); }
.app-shell h1 { font-size: clamp(48px, 6vw, 72px); line-height: .98; letter-spacing: -.035em; }
.app-shell h2, .dialog h2 { font-size: 30px; line-height: 1.05; letter-spacing: -.02em; }
.page-intro { position: relative; margin-bottom: 48px; padding-right: min(28vw, 300px); }
.page-intro::after { content: ""; position: absolute; right: 3%; bottom: -22px; width: clamp(130px, 18vw, 220px); aspect-ratio: 1; border-radius: 50%; background: var(--primary-weak); opacity: .72; z-index: -1; }
.page-intro > p:last-child, .page-heading > div > p:last-child { margin-top: 16px; color: var(--muted); }
.page-eyebrow { margin: 0 0 14px !important; display: flex; align-items: center; gap: 9px; color: var(--muted) !important; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.page-eyebrow::before { content: ""; width: 27px; height: 1px; background: var(--foreground); }
.page-heading { margin-bottom: 48px; align-items: end; }
.back-link { margin-bottom: 32px; color: var(--body); }

.button-primary, button.button-primary, .button-secondary { min-height: 46px; padding-inline: 18px; border-radius: 9px; transition: transform .2s, box-shadow .2s, background-color .2s, border-color .2s; }
.button-primary, button.button-primary { border-color: var(--primary); background: var(--primary); box-shadow: 0 8px 20px rgb(184 63 135 / .16); }
.button-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgb(184 63 135 / .22); }
.button-secondary:hover { transform: translateY(-1px); border-color: #cbd1d8; background: #fff; }

.notice { min-height: 70px; margin-top: -32px; padding: 10px 18px 10px 12px; display: flex; align-items: center; gap: 12px; border-color: #f3c9e2; border-radius: 12px; color: var(--foreground); background: #fff4fa; }
.notice::before { content: ""; width: 48px; height: 48px; flex: none; background: url("/assets/characters/complete.svg") center/contain no-repeat; }
.status-panel { grid-template-columns: 64px minmax(0, 1fr) auto; padding: 22px 26px; border-radius: 14px; background: #fff; }
.status-character { width: 64px; height: 64px; border-radius: 20px; }
.status-panel h2 { font-size: 26px; }
.status-detail { grid-column: 2 / -1; }

.project-section { position: relative; margin-bottom: 20px; padding: 30px 32px 10px; overflow: hidden; border-radius: 14px; background: #fff; }
.project-section::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--character, #ef9dce); }
.project-section h2 { margin-bottom: 20px; font-size: 32px; }
.document-row, .upload-file-row { min-height: 70px; padding-block: 14px; }
.document-name { font-weight: 600; }
.document-actions .button-secondary { min-height: 38px; padding-inline: 14px; }
.empty-illustrated { min-height: 180px !important; flex-direction: column; justify-content: center !important; gap: 12px !important; border-top: 0 !important; }
.empty-illustrated img { width: 112px; height: 112px; }

.table-wrap { border-radius: 14px; background: #fff; box-shadow: 0 18px 50px rgb(32 39 51 / .04); }
th { padding-block: 14px; background: #fafbfc; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
td { padding-block: 20px; }
tbody tr:hover { background: #fcfdff; }
.project-name { font-size: 17px; }
.table-empty { min-height: 250px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; }
.table-empty img { width: 128px; height: 128px; }
.admin-footer-actions { margin-top: 28px; }

.form-section, .upload-section, .uploads { border-radius: 14px; background: #fff; box-shadow: 0 18px 50px rgb(32 39 51 / .035); }
.form-section h2, .upload-section h2, .uploads h2 { font-size: 32px; }
input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]), select { min-height: 52px; padding-inline: 15px; border-color: transparent; border-radius: 9px; background: var(--page); }
input:not([type="checkbox"]):not([type="file"]):hover { border-color: var(--border); }
input:not([type="checkbox"]):not([type="file"]):focus { border-color: var(--primary); background: #fff; }
.file-picker { min-height: 112px; border-color: transparent; background: var(--page); }
.file-picker-icon { color: var(--foreground); background: #f8d8eb; }

.empty-state { width: 100%; min-height: 440px; margin: 0; padding: clamp(40px, 7vw, 80px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .65fr); align-items: center; gap: 48px; overflow: hidden; border-radius: 20px; background: #fff; text-align: left; }
.empty-state h2 { font-size: clamp(44px, 5vw, 64px); }
.empty-state p:not(.page-eyebrow) { margin: 18px 0 0; }
.empty-state > img { width: min(100%, 300px); justify-self: center; }

.dialog { border-radius: 20px; box-shadow: 0 28px 80px rgb(32 39 51 / .2); }
.dialog-header { background-color: var(--surface); background-image: radial-gradient(var(--border) .7px, transparent .7px); background-size: 18px 18px; }
.dialog-close { background: #fff; }

.message-character::before { background: #f4c2c5; }
.message-character img { box-shadow: 0 24px 70px rgb(216 57 69 / .12); }
.message-state { border-radius: 20px; }

.document { min-height: 100dvh; background: var(--canvas); }
.document main { width: min(100% - 40px, 740px); padding: 56px 0 104px; line-height: 1.75; }
.document main > a { display: inline-flex; margin-bottom: 40px; color: var(--primary-weak-text); font-size: 14px; font-weight: 600; text-decoration: none; }
.document main > a:hover { text-decoration: underline; text-underline-offset: 4px; }
.document h1 { margin: 44px 0 24px; font: 700 clamp(46px, 7vw, 68px)/1 var(--display); }
.document h2 { margin: 44px 0 16px; font: 700 36px/1.05 var(--display); }
.document h3 { margin: 34px 0 12px; font: 700 28px/1.1 var(--display); }
.document :is(h1, h2, h3) { scroll-margin-top: 24px; }
.document p, .document ul, .document ol { margin: 0 0 22px; color: var(--body); }
.document img { max-width: 100%; height: auto; border-radius: 14px; }
.document table { margin: 28px 0; }
.document pre { overflow: auto; margin: 28px 0; padding: 20px; border-radius: 14px; background: var(--surface); font-family: var(--mono); }
.document :not(pre) > code { padding: 3px 6px; border-radius: 6px; color: var(--primary-weak-text); background: var(--primary-weak); }
.document a { color: var(--primary-weak-text); text-underline-offset: 3px; }

@media (max-width: 800px) {
  .nav-inner, main { width: min(100% - 32px, 1120px); }
  nav { gap: 12px; }
  .role { display: none; }
  main { padding: 40px 0 72px; }
  .app-shell h1 { font-size: 52px; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 22px; margin-bottom: 32px; }
  .page-heading .actions { justify-content: flex-start; }
  .actions { flex-wrap: wrap; }
  .admin-footer-actions .button-primary { width: 100%; }
  .dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
  .dialog-header { padding: 22px 20px 18px; }
  .dialog form { padding: 22px 20px 24px; }
  .dialog-actions > * { flex: 1; }
  .project-section, .form-section, .uploads { padding: 24px 20px; border-radius: 14px; }
  .project-section-header { align-items: stretch; flex-direction: column; }
  .document-toolbar > * { flex: 1 1 140px; }
  .document-toolbar-separator { display: none; }
  .document-file { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
  .document-file .document-actions { width: 100%; grid-column: 2; flex-wrap: wrap; }
  .document-inline-editor input { width: 100% !important; }
  .status-panel { grid-template-columns: 52px minmax(0, 1fr); padding: 20px; border-radius: 14px; }
  .status-character { width: 52px; height: 52px; }
  .status-panel > .status { grid-column: 2; }
  .status-detail { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .viewer-share-columns { grid-template-columns: 1fr; }
  .viewer-share-page { width: 100%; padding: 20px; transform: translateX(-50%); }
  .viewer-share-list { min-height: 280px; max-height: 55vh; }
  .field-wide { grid-column: auto; }
  .form-actions .button-primary { width: 100%; }
  .input-action { grid-template-columns: 1fr; }
  .directory-options { grid-template-columns: 1fr; }
  .directory-toolbar { grid-template-columns: 1fr; }
  .upload-section { padding: 24px 20px; border-radius: 14px; }
  .upload-section form { grid-template-columns: 1fr; align-items: stretch; }
  .upload-complete { align-items: stretch; flex-direction: column; }
  .upload-section label:has(input[type="checkbox"]), .upload-section button { justify-self: stretch; }
  .uploads-header { align-items: stretch; flex-direction: column; }
  .upload-tree-actions { justify-content: flex-end; }
  .upload-folder-children { padding-left: 14px; }
  .file-picker { min-height: 148px; grid-template-columns: 40px minmax(0, 1fr); }
  .file-picker-button { grid-column: 1 / -1; width: 100%; }
  .document-row { align-items: stretch; flex-direction: column; }
  .document-actions { width: 100%; }
  .document-actions a { flex: 1; }
  .notice { margin-top: -8px; }
  .login { display: block; }
  .login-intro { display: none; }
  .login-panel { min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom)); }
  .login-mobile-brand { margin-bottom: clamp(48px, 12vh, 80px); display: grid; }
  .login-card h2 { max-width: 9ch; }
  .login-support { align-items: flex-start; flex-direction: column; gap: 6px; }
  .page-intro { padding-right: 0; }
  .page-intro::after { display: none; }
  .empty-state { min-height: 520px; padding: 42px 28px 0; display: flex; align-items: stretch; flex-direction: column; gap: 36px; }
  .empty-state > img { width: min(82vw, 280px); margin: auto auto -18%; }
  .empty-illustrated { min-height: 160px !important; }
  .message-state { min-height: calc(100dvh - 136px); padding: 48px 28px 0; display: flex; align-items: stretch; flex-direction: column; gap: 40px; border: 0; border-radius: 0; }
  .message-state h1 { font-size: clamp(48px, 15vw, 68px); }
  .message-copy > p:not(.message-eyebrow) { margin-top: 18px; font-size: 16px; }
  .message-action { width: 100%; margin-top: 28px; }
  .message-character { width: min(82vw, 310px); margin: auto auto -32%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  .dialog, .dialog::backdrop { transition-duration: .01ms !important; }
  .login-button.is-loading .login-button-label::before { animation: none; border-right-color: currentColor; }
}

@media print {
  body > header, .document main > a, .skip-link { display: none; }
  main, .document main { width: auto; max-width: none; padding: 0; }
  table { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
  pre, img { max-width: 100%; break-inside: avoid; }
}
