:root[data-theme="day"] {
  color-scheme: light;
  --ink: #302838;
  --muted: #867d83;
  --paper: #f7f3ec;
  --line: #e3dcd4;
  --gold: #a97945;
  --plum: #332738;
  --mill-ink: #27211c;
  --mill-muted: #776b5c;
  --mill-line: #dfd3c1;
  --mill-paper: #fbf7ef;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f0edf7;
  --muted: #b6b0c4;
  --paper: #15141c;
  --line: #393645;
  --gold: #e1bb83;
  --plum: #342a42;
  --mill-ink: #f0edf5;
  --mill-muted: #bbb4c4;
  --mill-line: #45404d;
  --mill-paper: #211e28;
}

.theme-toggle {
  flex: none;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #d8d1c8;
  border-radius: 999px;
  background: #fffdf9;
  color: #302838;
  font: 600 12px/1.2 Arial, sans-serif;
  white-space: nowrap;
}
.theme-toggle:hover { border-color: #a97945; }
html[data-theme="dark"] .theme-toggle {
  color: #f0edf7;
  background: #292632;
  border-color: #4a4657;
}
.theme-toggle-float {
  position: fixed;
  z-index: 50;
  top: 14px;
  right: 14px;
  box-shadow: 0 4px 18px #0002;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: #111019 !important;
  color: #f0edf7;
}
html[data-theme="dark"] body {
  --bg: #111019;
  --paper: #1b1923;
  --ink: #f0edf7;
  --brand: #7166c4;
  --accent: #ef75a5;
  --muted: #b6b0c4;
  --line: #393645;
  --lime: #f078a5;
  --purple: #2b283b;
  --orange: #392531;
}
html[data-theme="dark"] :is(.club, .chess-page, .chess-console, .console-panel) { color: #f0edf7; }
html[data-theme="dark"] :is(.club nav, .atelier-nav, .mill-nav) { border-color: #393645; }
html[data-theme="dark"] :is(.nav-caption, .club-hero p, .game-heading p, .atelier-heading > div > p:last-child) { color: #b6b0c4; }
html[data-theme="dark"] :is(.game-card, .panel, .console-panel, .history, .room-row, .chess-console section) {
  color: #f0edf7;
  background: #1b1923;
  border-color: #393645;
}
html[data-theme="dark"] :is(.game-card p, .room-row small, .rules p, .board-hint, .muted) { color: #b6b0c4; }
html[data-theme="dark"] :is(.rules, .room-row, footer) { border-color: #393645; }
html[data-theme="dark"] :is(.room-row a, .primary, #chat-form button) { background: #554a91; color: #fff; }
html[data-theme="dark"] :is(input, select, textarea, .mill-field input, .mill-field select, .mill-invite-row input) {
  color: #f0edf7;
  background: #282631;
  border-color: #4a4657;
}
html[data-theme="dark"] :is(.secondary, .tabs, .tabs button.active, .section-top button, .mill-secondary, .mill-tabs) {
  color: #ece8f5;
  background: #302d3b;
  border-color: #4a4657;
}
html[data-theme="dark"] .tabs button { color: #c7c1d3; }
html[data-theme="dark"] .tabs button.active { background: #494358; }
html[data-theme="dark"] .game-art { filter: brightness(.78); }
html[data-theme="dark"] :is(.toast, .mill-notice) { background: #302b3b; color: #fff; }

html[data-theme="dark"] body:not(.mill-body) .topbar {
  background: #191722eF;
  border-color: #393645;
}
html[data-theme="dark"] :is(aside, .sidecard, .stat, .day, .task, .search, .samplepage, .note, .pdf-page, .fileicon, .answers button, .authcard, #modalbody) {
  color: #f0edf7;
  background-color: #1b1923;
  border-color: #393645;
}
html[data-theme="dark"] :is(nav button, .textbtn, .feedback-meta, .pill, .tag, .footer, .pdf-controls span) { color: #c2bdd0; }
html[data-theme="dark"] nav button:hover,
html[data-theme="dark"] nav button.active { background: #302b42; color: #f7f4ff; }
html[data-theme="dark"] :is(.game:nth-child(1), .game:nth-child(2), .game:nth-child(3)) { background: #272333; }
html[data-theme="dark"] :is(.form input, .form select, .form textarea, .rolewrap select) {
  background: #24222e;
  border-color: #454153;
  color: #f0edf7;
}
html[data-theme="dark"] :is(dialog, dialog.feedback-dialog) {
  color: #f0edf7;
  background: #1c1a24;
}
html[data-theme="dark"] .close { color: #f0edf7; background: #302c3c; }
html[data-theme="dark"] #toast { background: #554a91; }
html[data-theme="dark"] .feedback-attachment { background: #24212f; border-color: #504863; }
html[data-theme="dark"] .feedback-category label:has(input:checked) { background: #302b42; border-color: #7166a3; }
html[data-theme="dark"] .feedback-badge { background: #302b42; color: #e2dcf2; }

html[data-theme="day"] body.mill-body {
  color: #27211c !important;
  background: #f4f0e8 !important;
}
html[data-theme="day"] .mill-nav { color: #30271f; border-color: #dfd3c1; }
html[data-theme="day"] .mill-nav > a:first-child,
html[data-theme="day"] .mill-brand { color: #44362c; }
html[data-theme="day"] .mill-brand span,
html[data-theme="day"] .mill-nav #account-badge { color: #786c5f; }
html[data-theme="day"] .mill-heading { color: #30271f; }
html[data-theme="day"] .mill-heading > div:first-child > p:last-child { color: #776b5c; }
html[data-theme="day"] .mill-rules { color: #3e3329; background: #fffaf2; border-color: #d9c9b1; }
html[data-theme="day"] .mill-rules p { color: #776b5c; }
html[data-theme="day"] .mill-footer { color: #776b5c; border-color: #dfd3c1; }
html[data-theme="day"] .theme-toggle { color: #302838; }

html[data-theme="dark"] body.mill-body { color: #f0edf5 !important; background: #111019 !important; }
html[data-theme="dark"] .mill-nav,
html[data-theme="dark"] .mill-heading { color: #f0edf5; }
html[data-theme="dark"] .mill-nav > a:first-child,
html[data-theme="dark"] .mill-brand { color: #eee8f5; }
html[data-theme="dark"] .mill-brand span,
html[data-theme="dark"] .mill-nav #account-badge,
html[data-theme="dark"] .mill-heading > div:first-child > p:last-child { color: #bcb5c7; }
html[data-theme="dark"] .mill-nav,
html[data-theme="dark"] .mill-footer { border-color: #393645; }
.mill-nav { grid-template-columns: 1fr auto 1fr auto; }
html[data-theme="dark"] .mill-panel,
html[data-theme="dark"] .chat { color: #f0edf5 !important; background: #211e28 !important; border-color: #45404d !important; }
html[data-theme="dark"] :is(.mill-tabs, .mill-tabs button.active, .mill-secondary, .mill-quiet) {
  color: #eee9f4;
  background: #302d3b;
  border-color: #4a4657;
}
html[data-theme="dark"] .mill-tabs button { color: #cbc5d4; }
html[data-theme="dark"] .mill-field,
html[data-theme="dark"] .mill-panel h2,
html[data-theme="dark"] .mill-panel h3 { color: #f0edf5; }
html[data-theme="dark"] :is(.mill-history #history p, .mill-room) { color: #c4bdcc; border-color: #403b49; }
html[data-theme="dark"] .mill-room a { color: #e3c58e; }
html[data-theme="dark"] .mill-rules { color: #eee8f5; background: #1b1923; border-color: #393645; }
html[data-theme="dark"] .mill-rules p { color: #bcb5c7; }
html[data-theme="dark"] .mill-quiet { background: #302d3b; }

.public-feedback-fab {
  position: fixed;
  z-index: 60;
  right: 22px;
  bottom: 22px;
  min-height: 48px;
  padding: 12px 17px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: #5a4cb8;
  box-shadow: 0 8px 24px #160e3d40;
  font: 700 13px/1.2 Arial, sans-serif;
}
.public-feedback-fab:hover { background: #493c9d; }
dialog.public-feedback-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 27px;
  border: 1px solid #e3dcd4;
  border-radius: 20px;
  color: #302838;
  background: #fffcf7;
  box-shadow: 0 25px 100px #09062940;
}
dialog.public-feedback-dialog::backdrop { background: #09062977; backdrop-filter: blur(3px); }
.public-feedback-dialog h2 { margin: 4px 34px 7px 0; font: 700 24px Manrope, sans-serif; }
.public-feedback-dialog p { color: #867d83; font-size: 13px; line-height: 1.6; }
.public-feedback-form { display: grid; gap: 13px; margin-top: 18px; }
.public-feedback-form label { display: grid; gap: 6px; color: #514b5d; font-size: 12px; font-weight: 600; }
.public-feedback-form input, .public-feedback-form textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #ddd7e3;
  border-radius: 9px; color: #302838; background: white; font: 14px Arial, sans-serif;
}
.public-feedback-form textarea { min-height: 112px; resize: vertical; }
.public-feedback-form small { font-size: 11px; font-weight: 400; color: #867d83; }
.public-feedback-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 3px; }
.public-feedback-actions button { min-height: 42px; padding: 10px 15px; border: 0; border-radius: 9px; background: #332738; color: white; font-weight: 700; }
.public-feedback-actions button.secondary { border: 1px solid #ddd7e3; background: transparent; color: #514b5d; }
.public-feedback-alert { color: #a22e54 !important; font-weight: 700; }
.public-feedback-trap { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
html[data-theme="dark"] dialog.public-feedback-dialog { color: #f0edf7; background: #1c1a24; border-color: #454153; }
.public-feedback-dialog > .close {
  float: right;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #eeeafd;
  color: #302838;
  font-size: 21px;
  line-height: 1;
}
html[data-theme="dark"] .public-feedback-dialog > .close { color: #eeeafd; background: #302d3b; }
html[data-theme="dark"] .public-feedback-dialog p,
html[data-theme="dark"] .public-feedback-form small { color: #b6b0c4; }
html[data-theme="dark"] .public-feedback-form label { color: #e1ddeb; }
html[data-theme="dark"] .public-feedback-form input,
html[data-theme="dark"] .public-feedback-form textarea { color: #f0edf7; background: #24222e; border-color: #454153; }
html[data-theme="dark"] .public-feedback-actions button { background: #6256a7; }
html[data-theme="dark"] .public-feedback-actions button.secondary { background: transparent; color: #e1ddeb; border-color: #454153; }
@media (max-width: 700px) {
  .theme-toggle { min-height: 34px; padding: 7px 10px; font-size: 11px; }
  .club nav { gap: 10px; }
  .club nav .theme-toggle { padding-inline: 9px; }
  .mill-nav { grid-template-columns: auto 1fr auto; }
  .atelier-nav { gap: 10px; }
  .public-feedback-fab { right: 14px; bottom: 14px; min-height: 44px; padding: 10px 14px; }
  dialog.public-feedback-dialog { padding: 21px; }
}

.public-feedback-attachment {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed #cfc4e8;
  border-radius: 13px;
  background: #f7f4fc;
}
.public-feedback-attachment > strong { font-size: 13px; }
.public-feedback-attachment > strong small { margin-left: 4px; }
.public-feedback-attachment > p { margin: 0; }
.public-feedback-attachment input[type="file"] { min-height: 38px; padding: 7px; font-size: 12px; }
.public-feedback-capture-row { display: flex; flex-wrap: wrap; gap: 8px; }
.public-feedback-capture-row button { min-height: 40px; padding: 9px 12px; border: 1px solid #d9d1e9; border-radius: 9px; background: #fff; color: #453b5b; font-weight: 700; }
.public-feedback-capture-row button:disabled { opacity: .55; cursor: wait; }
.public-feedback-preview img { display: block; max-width: 100%; max-height: 245px; object-fit: contain; border: 1px solid #ddd7e3; border-radius: 9px; background: white; }
.public-feedback-preview-info { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 8px; color: #514b5d; font-size: 12px; }
.public-feedback-preview-info button { min-height: 34px; padding: 7px 10px; border: 1px solid #ddd7e3; border-radius: 8px; background: transparent; color: inherit; }
.public-feedback-attachment-status { margin: 0; color: #514b5d; font-size: 12px; }
.public-feedback-attachment-status.is-error { color: #a22e54; font-weight: 700; }
dialog.public-feedback-dialog.public-feedback-capturing { visibility: hidden; }
dialog.public-feedback-dialog.public-feedback-capturing::backdrop { visibility: hidden; background: transparent; backdrop-filter: none; }
html[data-theme="dark"] .public-feedback-attachment { background: #24222e; border-color: #554d71; }
html[data-theme="dark"] .public-feedback-capture-row button,
html[data-theme="dark"] .public-feedback-preview-info button { color: #e1ddeb; background: #302d3b; border-color: #514b64; }
html[data-theme="dark"] .public-feedback-preview-info { color: #e1ddeb; }
html[data-theme="dark"] .public-feedback-preview img { border-color: #514b64; }

