/* CP8-P1/S5 — Studio draft-library page styles.
   Self-contained: no framework, no build step, no CDN, no web font.
   All colours are literals so the page never depends on a remote theme. */

:root {
  color-scheme: light;
  --bg: #fcfaf6;
  --bg2: #f3efe7;
  --panel: #ffffff;
  --line: rgba(44, 36, 28, 0.16);
  --line-strong: rgba(44, 36, 28, 0.26);
  --text: #211d18;
  --muted: #5b554d;
  --accent: #8a5a1f;
  --accent-hover: #76501f;
  --primary-text: #fcfaf6;
  --faint: #6b645b;
  --hover-tint: rgba(138,90,31,.05);
  --serif: "Songti SC", "Noto Serif SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --danger: #9a2f22;
  --notice: #2f5d3a;
  --warn-bg: #fdf6e9;
  --focus: #8a5a1f;
  --error-bg: #fdf0ee;
  --error-line: #e2b0a6;
  --notice-bg: #eef6ef;
  --notice-line: #b6d3bc;
  --radius: 5px;
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #100e0b; --bg2: #16130f; --panel: #191611; --line: rgba(235,228,210,.12); --line-strong: rgba(235,228,210,.24); --text: #f2ede1; --muted: #b0a793; --faint: #9b907d; --accent: #c89b5a; --accent-hover: #d5ad74; --primary-text: #20170c; --hover-tint: rgba(200,155,90,.05); --focus: #c89b5a; --danger: #efb4a2; --notice: #b4d1b6; --warn-bg: #221c13; --error-bg: #251a16; --error-line: #725144; --notice-bg: #192119; --notice-line: #48634a; }

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 10;
  background: var(--panel);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
}

/* -- top bar ------------------------------------------------------------------ */
.topbar { background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar-inner { width: 100%; max-width: 1190px; min-height: 76px; margin: 0 auto; padding: 12px 36px; display: flex; align-items: center; gap: 36px; }
.brand { display: inline-flex; flex: none; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-logo { display: block; width: 24px; height: 24px; flex: none; }
.brand-name { font-size: 17px; font-weight: 650; letter-spacing: .2px; }
.personal-nav { display: flex; align-self: stretch; align-items: center; gap: 28px; }
.personal-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; text-decoration: none; white-space: nowrap; }
.personal-nav a:hover, .personal-nav a[aria-current="page"] { color: var(--accent); }
.personal-nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.session { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; max-width: 100%; margin-left: auto; }
.session-state { color: var(--muted); overflow-wrap: anywhere; min-width: 0; max-width: 100%; }

/* -- layout ------------------------------------------------------------------- */
.layout {
  max-width: 1190px;
  margin: 0 auto;
  padding: 36px 36px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.workspace-welcome { padding-block: 0 8px; }
.workspace-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.workspace-welcome h1 { margin: 0; font: 600 30px/1.45 var(--serif); overflow-wrap: anywhere; }
.workspace-nav, .compatibility-control { display: none !important; }
.workspace-content { display: flex; flex-direction: column; gap: 16px; }
.workspace-address { overflow-wrap: anywhere; }
#creator-create-panel { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
#creator-create-panel h3 { margin: 0 0 10px; font-size: 19px; }
#creator-setup-form .field { flex: 1 1 240px; min-width: 0; }
#creator-url-preview { padding: 12px; border-radius: 6px; background: var(--bg); min-height: 44px; }
#workspace-title, section[id], h2[id] { scroll-margin-top: 24px; }
summary { cursor: pointer; min-height: 44px; padding-block: 10px; }
details > .hint { margin-top: 10px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card-warn { background: var(--warn-bg); border-color: #e4c98a; }
.card-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.card-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card h2 { margin: 0 0 6px; font-size: 16px; font-weight: 650; }

.hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.state { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.state.subtle { color: var(--faint); }
.state.error { color: var(--danger); }
.state.ok { color: var(--notice); }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.field-grow { flex: 1 1 260px; }
.field-label { font-size: 12px; color: var(--muted); }
input[type="text"], select, input[type="file"] {
  font: inherit;
  color: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  max-width: 100%;
}
input[type="text"]:disabled, select:disabled { background: var(--bg2); color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font: inherit;
  padding: 8px 14px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: var(--primary-text); }
.btn-quiet { background: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* -- banners ------------------------------------------------------------------ */
.banner { border-radius: var(--radius); padding: 12px 14px; border: 1px solid var(--line-strong); }
.banner-error { background: var(--error-bg); border-color: var(--error-line); }
.banner-notice { background: var(--notice-bg); border-color: var(--notice-line); }
.banner-title { margin: 0 0 4px; font-weight: 650; }
.banner-body { margin: 0; }
.banner-meta { margin: 6px 0 0; color: var(--muted); font-size: 12px; word-break: break-all; }
.banner-actions { margin-top: 10px; }

/* -- library ------------------------------------------------------------------ */
.library { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.library-item { display: grid; grid-template-columns: 64px minmax(0,1fr) auto auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.library-cover { width: 64px; height: 82px; display: flex; align-items: center; justify-content: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; color: var(--muted); font-size: 12px; }
.library-cover img { width: 100%; height: 100%; object-fit: contain; }
.library-status { color: var(--muted); font-size: 13px; }
.library-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.works-panel { padding: 0; border: 0; background: transparent; }
#creator-context { padding: 0; border: 0; background: transparent; }
#creator-context > .card-head:has(#creator-create-another[hidden]) { display: none; }
#workspace-favorites { padding: 0; border: 0; background: transparent; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: 14px; text-decoration: none; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.library-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.library-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 16px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.library-meta { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* -- mapping / ids ------------------------------------------------------------ */
.map { margin-top: 12px; font-size: 13px; }
.map table { border-collapse: collapse; width: 100%; }
.map th, .map td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.map .bad { color: var(--danger); }
.map .good { color: var(--notice); }

.ids { margin: 8px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; }
.ids dt { color: var(--muted); }
.state:empty, .hint:empty { display: none; }
.account-sync-bar { max-width: 1190px; margin: 0 auto; padding: 16px 36px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.account-sync-bar p { flex: 1 1 320px; margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
body[data-account-blocked="true"] #creator-context, body[data-account-blocked="true"] #workspace-content,
body[data-account-blocked="true"] #workspace-favorites, body[data-account-blocked="true"] #incoming-favorite-panel { display: none !important; }
.ids dd { margin: 0; overflow-wrap: anywhere; }

@media (min-width: 561px) and (max-width: 700px) {
  .topbar-inner { flex-wrap: wrap; gap: 0 20px; padding-inline: 24px; }
  .personal-nav { order: 3; width: 100%; }
}

@media (max-width: 560px) {
  .topbar-inner { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0 12px; padding: 8px 16px 0; }
  .brand { font-size: 16px; }
  .brand-logo { width: 22px; height: 22px; }
  .personal-nav { grid-column: 1 / -1; grid-row: 2; gap: 28px; }
  .session { grid-column: 2; grid-row: 1; }
  .session .btn { padding-inline: 10px; font-size: 13px; }
  .layout { padding: 24px 16px 48px; }
  .account-sync-bar { padding-inline: 16px; }
  .library-item { grid-template-columns: 52px minmax(0,1fr); gap: 8px 12px; }
  .library-cover { grid-row: span 2; width: 52px; height: 70px; }
  .library-status { grid-column: 2; }
  .library-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .library-actions .btn { flex: 1; }
  .card { padding: 14px; }
  .field { min-width: 100%; }
  #creator-setup-form .field { flex-basis: 100%; }
  .workspace-welcome h1 { font-size: 28px; }
}
