:root {
  color-scheme: light;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  color: #201a2e;
  background: #f8f7fb;
  --muted: #635b73;
  --purple: #6338c4;
  --purple-dark: #4d279e;
  --line: #e9e5ef;
  --shadow: 0 3px 12px #28194d08;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .file-label:focus-within { outline: 2px solid var(--purple); outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; font-weight: 750; letter-spacing: -.06em; }
h2 { font-size: 1.12rem; letter-spacing: -.02em; }
h3 { font-size: .9rem; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1336px; min-height: 68px; margin: auto; padding: 0 32px; display: flex; justify-content: space-between; align-items: center; }
.brand, .nav-link { display: inline-flex; align-items: center; gap: 10px; }
.brand { font-weight: 750; letter-spacing: -.03em; }
.brand b { color: var(--purple); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #6138bb; color: #fff; }
.brand-mark svg { width: 25px; height: 25px; }
.nav-link { padding: 8px 12px; border-radius: 8px; color: var(--purple-dark); font-size: .85rem; font-weight: 700; background: #f2ecff; }
.nav-link svg { width: 17px; height: 17px; }
#app { width: min(100%, 1336px); margin: 0 auto; flex: 1; padding: 32px 32px 52px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; position: relative; isolation: isolate; overflow: hidden; padding: 31px 34px 32px; border-radius: 20px; border: 1px solid #e7dcfa; background: linear-gradient(105deg, #f0e8fc, #f6efff 60%, #e9ddfb); }
.hero-art { position: absolute; z-index: -1; right: 2%; top: 0; width: min(44%, 465px); height: 100%; color: #8c62d4; opacity: .22; }
.hero-art svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.4; }
.eyebrow { display: flex; align-items: center; gap: 7px; font-size: .68rem; letter-spacing: .15em; color: var(--purple-dark); font-weight: 750; margin-bottom: 11px; }
.eyebrow .icon { width: 15px; height: 15px; }
.hero p, .edit-head p, .detail-title p { color: var(--muted); margin-top: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 10px 14px; min-height: 42px; font-size: .84rem; font-weight: 700; white-space: nowrap; }
.primary { color: white; background: var(--purple); box-shadow: 0 3px 7px #6338c42a; }
.primary:hover { background: var(--purple-dark); }
.primary:disabled { opacity: .6; cursor: wait; }
.secondary { background: white; border-color: #ded8e9; }
.secondary:hover { background: #f6f0ff; }
.library { margin-top: 31px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title h2 { font-size: 1.45rem; }
.count { border: 1px solid #e8dff7; background: #f1eafb; color: #59359f; border-radius: 100px; padding: 3px 9px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.search, .filter { display: flex; align-items: center; gap: 8px; min-height: 42px; padding-left: 12px; border: 1px solid #ded8e9; background: white; border-radius: 9px; color: var(--muted); }
.search { width: min(340px, 100%); }
.search input, .filter select { width: 100%; min-width: 0; min-height: 40px; padding: 0 10px 0 0; border: 0; background: transparent; border-radius: 8px; font-size: .85rem; }
.filter select { padding-right: 8px; }
.sort { margin-left: auto; }
.table-wrap, .panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .88rem; }
th { background: #f7f5fb; color: #60566e; font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
th, td { padding: 10px 16px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: 17px; }
td:first-child { width: 31%; }
td:nth-child(2) { width: 23%; }
td:last-child { width: 45px; padding-left: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfaff; }
.game-link { display: flex; align-items: center; gap: 13px; width: fit-content; border-radius: 7px; }
.game-link:hover strong { color: var(--purple); }
.game-link strong { font-weight: 700; }
.cover { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 9px; overflow: hidden; background: #f2edf9; color: #7657a4; border: 1px solid #eae2f4; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border-radius: 7px; border: 1px solid; padding: 4px 8px; font-size: .73rem; font-weight: 700; line-height: 1.25; }
.badge .icon { width: 14px; height: 14px; }
.badge.test { color: #a1382e; background: #fff1ee; border-color: #f7c5bb; }
.badge.art { color: #863395; background: #fceffc; border-color: #efc9f1; }
.badge.design { color: #6134b7; background: #f2ebff; border-color: #dfcff8; }
.badge.idea { color: #8c5608; background: #fff6e3; border-color: #f1dbac; }
.summary, .muted { color: var(--muted); }
.row-arrow { display: grid; place-items: center; width: 32px; height: 32px; color: var(--purple); border-radius: 8px; }
.row-arrow:hover { background: #f1eafb; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.empty h1 { margin-bottom: 12px; }
.back { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 18px; color: var(--purple-dark); font-size: .85rem; font-weight: 700; }
.back:hover { text-decoration: underline; }
.detail-head { display: flex; gap: 24px; align-items: center; padding: 24px; background: linear-gradient(110deg, #fff, #fbf8ff); }
.large-cover { width: 153px; height: 153px; border-radius: 14px; }
.large-cover .icon { width: 45px; height: 45px; }
.detail-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.detail-title h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.detail-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 11px; }
.latest-version { max-width: 100%; white-space: normal; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.panel-heading { border-bottom: 1px solid var(--line); padding: 16px 22px; }
.metadata { padding: 21px 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 19px 16px; }
dt { margin-bottom: 5px; font-size: .79rem; font-weight: 700; }
dd, .description p, .hook p { font-size: .9rem; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }
.level { display: flex; gap: 4px; padding-top: 5px; }
.level i { width: 12px; height: 12px; border: 1px solid #db796b; border-radius: 2px; }
.level .filled { background: #d15d4c; }
.description { margin: 0 22px; padding: 18px 0 23px; border-top: 1px solid var(--line); }
.description p { margin-top: 6px; white-space: pre-wrap; }
.highlights-body { padding: 16px; display: grid; gap: 10px; }
.hook { padding: 12px; background: #faf7ff; border: 1px solid #eee7fa; border-radius: 9px; }
.hook span { color: #6338a8; font-size: .65rem; font-weight: 750; letter-spacing: .09em; }
.hook p { margin-top: 3px; }
.edit-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 21px; }
.edit-head h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.form-actions { display: flex; gap: 8px; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.form-fields { display: grid; gap: 15px; padding: 20px 22px; }
.field { min-width: 0; display: grid; gap: 5px; }
.field > span { font-size: .81rem; font-weight: 700; }
.field input:not([type=file]), .field textarea, .field select { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #ded8e9; border-radius: 7px; background: white; font-size: .88rem; }
.field textarea { resize: vertical; }
.char-count { text-align: right; color: var(--muted); font-size: .72rem; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.upload { position: relative; padding: 16px; display: grid; justify-items: center; gap: 6px; background: #faf7ff; border: 1px dashed #ccb9e8; border-radius: 9px; }
.upload small { color: var(--muted); }
.file-label, .text-button { position: relative; display: inline-flex; gap: 6px; align-items: center; padding: 4px; border: 0; border-radius: 4px; background: transparent; font-size: .83rem; font-weight: 700; color: var(--purple-dark); cursor: pointer; }
.file-label input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.error { color: #9f3327; margin-top: 14px; }
.error:empty { display: none; }
.footer { width: min(100%, 1336px); margin: auto; display: flex; justify-content: space-between; gap: 8px; padding: 15px 32px 22px; color: var(--muted); font-size: .75rem; }
#toast { position: fixed; bottom: 20px; right: 20px; z-index: 3; max-width: calc(100% - 40px); background: #32224d; color: white; border-radius: 10px; font-size: .85rem; padding: 12px 16px; opacity: 0; pointer-events: none; transition: opacity .15s; }
#toast.visible { opacity: 1; }
@media (max-width: 850px) {
  .detail-grid { grid-template-columns: 1fr; }
  .hero { padding: 25px; }
  td, th { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 620px) {
  .top-inner, .footer { padding-left: 16px; padding-right: 16px; }
  #app { padding: 20px 16px 34px; }
  .hero, .edit-head { flex-wrap: wrap; }
  .hero-art { width: 60%; right: -8%; }
  .toolbar { flex-wrap: wrap; }
  .search { width: 100%; }
  td.summary, th:nth-child(3) { display: none; }
  td:first-child { width: 55%; }
  td:nth-child(2) { width: auto; }
  td:last-child { width: 32px; padding-right: 4px; }
  th:first-child, td:first-child { padding-left: 9px; }
  .cover { width: 37px; height: 37px; }
  .game-link { gap: 7px; font-size: .79rem; }
  .badge { font-size: .67rem; padding: 4px 5px; }
  .detail-head { display: grid; grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 13px; }
  .detail-head > .button { grid-column: 1 / -1; justify-self: start; }
  .large-cover { width: 78px; height: 78px; }
  .metadata { grid-template-columns: repeat(2, 1fr); }
  .edit-grid { grid-template-columns: 1fr; }
}

.session-actions { margin-left: auto; margin-right: 10px; }
.login-panel { width: min(100%, 440px); margin: clamp(18px, 8vh, 85px) auto 0; }
.login-panel p { color: var(--muted); font-size: .9rem; }
.login-panel [role="alert"]:not(:empty) { color: #9f3327; }

.delete-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.danger { color: #a1342c; border-color: #e9b6b1; background: white; }
.danger:hover { background: #fff1ee; }
.danger:disabled { opacity: .6; cursor: wait; }

.trash-list { margin: 0; padding: 0; list-style: none; }
.trash-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; }
.trash-list li + li { border-top: 1px solid var(--line); }
.trash-error { margin: 14px 22px; }

@media (max-width: 420px) {
  .top-inner { flex-wrap: wrap; gap: 8px; padding-block: 8px; }
  .brand { flex-basis: 100%; }
  .session-actions { margin: 0; }
}
