:root {
  color-scheme: light;
  --paper: #f7f6f1;
  --card: #fffefa;
  --ink: #23241f;
  --muted: #60625a;
  --line: #dcdcd1;
  --soft: #efeee6;
  --accent: #d84028;
  --art: #e94b31;
  --on-ink: #fffefa;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151614;
  --card: #20211e;
  --ink: #f1efe7;
  --muted: #b1b2a6;
  --line: #393b33;
  --soft: #2b2d26;
  --accent: #ff846b;
  --art: #c73f2b;
  --on-ink: #171813;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font-size: 16px; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; text-underline-offset: 4px; }
a:hover { color: var(--accent); }
p, h1, h2, h3 { margin: 0; }
.shell { width: min(1200px, calc(100% - 80px)); margin-inline: auto; }
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; min-height: 88px; border-bottom: 1px solid var(--line); }
.account, .header-nav { display: flex; align-items: center; gap: 14px; min-width: 0; }
.account { font-size: .92rem; }
#account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-nav { justify-content: end; }
.header-nav a { font-size: .92rem; text-decoration: none; white-space: nowrap; }
.wordmark { font: 1000 2.65rem/.9 system-ui, sans-serif; letter-spacing: -.11em; text-decoration: none; padding-right: .1em; }
.wordmark span, h1 span { color: var(--accent); }
.outline, .primary, .text-button, .filters button { min-height: 42px; border-radius: 7px; padding: 8px 13px; font-weight: 650; border: 1px solid var(--line); white-space: nowrap; }
.outline, .filters button { background: transparent; }
.outline:hover, .filters button:hover { background: var(--soft); border-color: var(--muted); }
.text-button { background: transparent; border-color: transparent; padding-inline: 5px; }
.text-button:hover { color: var(--accent); }
.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.primary:hover { background: var(--accent); color: #171813; border-color: var(--accent); }
:root:not([data-theme="dark"]) .primary:hover { color: white; background: #be3622; border-color: #be3622; }
.theme { font-size: 1.3rem; width: 42px; padding: 0; }
.hero { display: grid; grid-template-columns: 1.25fr .75fr; min-height: 310px; padding: 28px 0; border-bottom: 1px solid var(--line); gap: 24px; }
.intro { display: grid; align-content: center; padding: 16px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: .92rem; font-weight: 650; letter-spacing: .1em; }
.brand span { width: 20px; height: 2px; background: var(--accent); }
h1 { font-size: clamp(3rem, 6.6vw, 6.6rem); font-weight: 900; letter-spacing: -.09em; line-height: 1.11; }
.hero h1 { margin: 15px 0 16px; }
.hero-copy { color: var(--muted); font-size: clamp(.98rem, 1.6vw, 1.1rem); }
.art { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 244px; border-radius: 10px; background-color: var(--art); background-image: linear-gradient(#fff3 1px, transparent 1px), linear-gradient(90deg, #fff3 1px, transparent 1px); background-size: 26px 26px; background-position: center; color: #26251f; }
.stamp { display: grid; place-content: center; width: 174px; height: 174px; border-radius: 100%; background: #f8efdb; box-shadow: 8px 10px #2d231f; transform: rotate(-9deg); font: 1000 6.4rem/.85 system-ui, sans-serif; letter-spacing: -.13em; padding-right: .14em; border: 1px solid #302921; }
.stamp span { display: inline; position: absolute; bottom: 32px; right: 18px; color: #d84028; font-size: 3.5rem; }
.spark { position: absolute; right: 6%; top: 8%; color: #fcf3df; font-size: clamp(1.6rem, 3.3vw, 3.1rem); }
.catalog { padding: 28px 0 48px; }
.catalog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); letter-spacing: -.05em; }
.search { display: flex; align-items: center; gap: 6px; width: min(285px, 50%); border: 1px solid var(--line); border-radius: 7px; background: var(--card); padding-inline: 10px; }
.search span { font-size: 1.45rem; }
.search input { min-width: 0; width: 100%; min-height: 44px; background: transparent; border: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 16px; }
.filters button { font-size: .88rem; min-height: 36px; }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 13px; row-gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.card:hover { border-color: var(--muted); }
.app-icon { display: grid; place-items: center; width: 51px; height: 51px; border-radius: 11px; background: #e9e7d9; color: #2b2d25; overflow: hidden; font-size: 1.42rem; font-weight: 800; }
.app-icon img { width: 100%; height: 100%; object-fit: contain; }
.app-icon.achievement { background: #d9e6a9; }
.app-icon.flight { background: #dae6f3; color: #29445d; }
.app-icon.lottery { background: #f9d6c8; }
.app-icon.deepseek { background: #dddffb; color: #363d88; }
.card h3, .admin-row h2 { font-size: 1rem; font-weight: 800; overflow-wrap: anywhere; }
.card p, .muted, .status, .admin-row p { color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.card p { font-size: .9rem; margin-top: 5px; }
.card-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 7px; align-self: end; border-top: 1px solid var(--line); padding-top: 10px; }
.card-actions span { color: var(--muted); font-size: .83rem; overflow-wrap: anywhere; }
.card-actions button { min-height: 36px; font-size: .86rem; padding-block: 5px; }
.footer { border-top: 1px solid var(--line); padding: 24px 0 35px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .86rem; }
.admin { padding: 32px 0 60px; }
.admin h1 { font-size: clamp(2.5rem, 6vw, 4.8rem); margin: 10px 0 20px; }
.back { font-size: .92rem; }
.admin-list { display: grid; gap: 8px; }
.admin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); background: var(--card); padding: 12px; border-radius: 9px; }
.admin-row p { font-size: .86rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.danger { color: var(--accent); }
dialog { width: min(460px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 21px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
dialog.edit-dialog { width: min(650px, calc(100% - 24px)); }
dialog::backdrop { background: #10110e9e; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-head + p { margin-top: 8px; }
.close { font-size: 1.45rem; line-height: 1; }
.form { display: grid; gap: 12px; margin-top: 12px; }
.form label { display: grid; gap: 5px; min-width: 0; font-size: .92rem; font-weight: 650; }
.form input:not([type="checkbox"]), .form select, .form textarea { width: 100%; padding: 8px; min-width: 0; min-height: 41px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-size: 1rem; }
.form textarea { resize: vertical; }
.form-grid, .inline-field { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.inline-field { grid-template-columns: minmax(0, 1fr) auto; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }
.form .check { display: flex; align-items: center; }
input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--accent); }
.user-picker { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.user-picker .filters { margin-bottom: 4px; max-height: 82px; overflow: auto; }
.user-picker .filters:empty { margin: 0; }
#user-results { display: grid; margin-top: 8px; }
#user-results label { min-height: 37px; padding: 3px 4px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#user-results label:hover { background: var(--soft); }
#user-results input { flex: none; }
.user-pagination, .user-page-buttons { display: flex; align-items: center; gap: 6px; }
.user-pagination { justify-content: space-between; flex-wrap: wrap; margin-top: 8px; font-size: .86rem; }
.user-page-buttons button { min-height: 36px; padding: 4px 8px; }
.user-page-buttons button:disabled { cursor: default; }
.status.error { color: var(--accent); }
.save { justify-self: end; }
@media (max-width: 900px) {
  .shell { width: calc(100% - 48px); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .shell { width: calc(100% - 28px); }
  .top { min-height: 64px; gap: 7px; }
  .header-nav, .account { gap: 6px; }
  .header-nav a, .account button { font-size: .8rem; }
  .account .outline { padding-inline: 6px; }
  .wordmark { font-size: 2rem; }
  .hero { min-height: 0; grid-template-columns: minmax(0, 1fr) 98px; padding: 18px 0; gap: 8px; }
  .intro { padding: 7px 0; }
  .brand { font-size: .8rem; letter-spacing: .03em; }
  .brand span { width: 12px; }
  .hero h1 { font-size: clamp(2.25rem, 8.6vw, 3.2rem); margin: 9px 0; letter-spacing: -.1em; }
  .hero-copy { font-size: .88rem; }
  .art { min-height: 104px; background-size: 15px 15px; }
  .stamp { width: 64px; height: 64px; font-size: 2.2rem; box-shadow: 3px 4px #2d231f; }
  .stamp span { font-size: 1.2rem; right: 8px; bottom: 13px; }
  .spark { right: 3px; top: 1px; font-size: 1rem; }
  .catalog { padding-top: 18px; }
  .cards { grid-template-columns: 1fr; }
  .card { padding: 11px; row-gap: 8px; }
  .card-actions { padding-top: 7px; }
  .admin-row { grid-template-columns: auto minmax(0, 1fr); }
  .row-actions { grid-column: 2; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 355px) {
  .header-nav a[href="/portal-about/"] { display: none; }
}
