/* Shifra's independent daylight palette — not a workplace dashboard theme.
   Team photography, card colors, secret roles and finale retain their own styles. */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7ef;
  --panel: #ffffff;
  --edge: #cdd9cb;
  --text: #22352b;
  --muted: #52675e;
  --mint: #155f4b;
  --red: #a52c42;
  --blue: #2363ad;
  --neutral: #dbc999;
  --danger: #222c40;
}
html[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}
html[data-theme="light"] body::before {
  background-image:
    radial-gradient(ellipse at 95% 10%, #f9d5cc5c, transparent 52%),
    radial-gradient(ellipse at 5% 35%, #bddfc677, transparent 55%),
    linear-gradient(#f4f7efea, #f4f7eff8), var(--nature-forest);
}
html[data-theme="light"] .topbar { border-color: var(--edge); }
html[data-theme="light"] .brand-mark {
  background: var(--mint);
  color: #ffffff;
  box-shadow: 0 6px 22px #155f4b24;
}
html[data-theme="light"] .home h1,
html[data-theme="light"] .home h1 span { text-shadow: none; }
html[data-theme="light"] .icon-button,
html[data-theme="light"] .secondary,
html[data-theme="light"] .tab,
html[data-theme="light"] .segmented button {
  background: #edf3ea;
  color: var(--text);
  border-color: var(--edge);
}
html[data-theme="light"] .play-panel,
html[data-theme="light"] .team-panel,
html[data-theme="light"] .turn-panel,
html[data-theme="light"] .clue-form {
  background: linear-gradient(145deg, #ffffffed, #f4f8f2ee);
  border-color: var(--edge);
  box-shadow: inset 0 1px 0 #ffffff, 0 12px 38px #1d392c17;
}
html[data-theme="light"] .tabs { background: #e9f0e7; }
html[data-theme="light"] .tabs button { color: var(--muted); }
html[data-theme="light"] .tabs button[aria-selected="true"] {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 2px 8px #1d392c16;
}
html[data-theme="light"] input,
html[data-theme="light"] select {
  background: #ffffff;
  color: var(--text);
  border-color: #b6c9bb;
}
html[data-theme="light"] input::placeholder { color: #64796d; }
html[data-theme="light"] .segmented button[aria-pressed="true"] {
  background: #def0e5;
  color: var(--mint);
  border-color: var(--mint);
}
html[data-theme="light"] .primary,
html[data-theme="light"] .card-confirm {
  background: var(--mint);
  color: #ffffff;
}
html[data-theme="light"] .card-confirm {
  border-color: #d7f0e2;
  box-shadow: 0 4px 12px #1d392c27;
}
html[data-theme="light"] .card-confirm:hover { background: #0e513f; }
html[data-theme="light"] .clue-chip b {
  background: var(--mint);
  color: #ffffff;
}
html[data-theme="light"] .player-badge { background: #e6eee5; }
html[data-theme="light"] .score { background-color: #ffffff; }
html[data-theme="light"] .score.red,
html[data-theme="light"] .score.blue,
html[data-theme="light"] .score.red.active,
html[data-theme="light"] .score.blue.active { color: #ffffff; }
html[data-theme="light"] .score.red small,
html[data-theme="light"] .score.blue small { color: #e4eaf3; }
html[data-theme="light"] .score.active { box-shadow: 0 0 0 2px var(--mint); }
html[data-theme="light"] .turn-panel span { color: var(--muted); }
html[data-theme="light"] .room-code,
html[data-theme="light"] .clue-chip { color: var(--mint); }
html[data-theme="light"] .secret-notice,
html[data-theme="light"] .suggestion-strip,
html[data-theme="light"] .turn-notice {
  color: var(--text);
  background: #e6f2e9;
  border-color: #a7ceb8;
}
html[data-theme="light"] .suggestion-title,
html[data-theme="light"] .home-stats b,
html[data-theme="light"] .turn-clock { color: var(--mint) !important; }
html[data-theme="light"] .suggestion-row {
  background: #ffffff;
  border: 1px solid var(--edge);
}
html[data-theme="light"] .suggestion-row b { color: var(--text); }
html[data-theme="light"] .history li.history-entry {
  background: linear-gradient(110deg, #ffffff, #f1f7f1);
  border-color: var(--edge);
  border-right-color: var(--entry-color);
}
html[data-theme="light"] .history-icon {
  background: #e9f0e8;
  border-color: var(--edge);
}
html[data-theme="light"] .history-body strong { color: var(--text); }
html[data-theme="light"] .history-result {
  background: #edf3ea;
  color: var(--muted);
  border-color: var(--edge);
}
html[data-theme="light"] .history-count { color: #ffffff; }
html[data-theme="light"] .turn-clock.urgent {
  color: #a52c42 !important;
  border-color: #d6919f;
  background: #fce9eb;
}
html[data-theme="light"] .history-result.result-danger {
  background: #fde8e9;
  color: #9a2335;
  border-color: #dc9da7;
}
html[data-theme="light"] .history li.history-empty {
  background: #eef4ed;
  border-color: var(--edge);
}
html[data-theme="light"] .lobby-settings {
  background: #ffffffd9;
  border-color: var(--edge);
}
html[data-theme="light"] .offline-banner {
  background: #fff2d2;
  color: #77501b;
}
html[data-theme="light"] .form-error { color: #a52c42; }
html[data-theme="light"] .home-board-scene {
  background:
    radial-gradient(ellipse at 100% 0%, #ffd5d850, transparent 65%),
    radial-gradient(ellipse at 0 100%, #c5e0ff70, transparent 60%),
    #f2f6ee;
  border-color: var(--edge);
  box-shadow: inset 0 1px 0 #ffffff, 0 14px 32px #1d392c1a;
}
html[data-theme="light"] .home-board-heading { color: var(--text); }
html[data-theme="light"] .home .play-panel {
  border-color: var(--edge);
  box-shadow: inset 0 1px 0 #fff, 0 18px 45px #1d392c1b;
}
html[data-theme="light"] .winner {
  background: #eaf6ed;
  border-color: #b6d7c2;
}
html[data-theme="light"] dialog {
  background: #ffffff;
  color: var(--text);
  border-color: var(--edge);
}
html[data-theme="light"] dialog::backdrop { background: #1b302a99; }
html[data-theme="light"] #toast {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 8px 28px #1d392c35;
}
html[data-theme="light"] .tag.red { color: var(--red); border-color: #a52c4280; }
html[data-theme="light"] .tag.blue { color: var(--blue); border-color: #2363ad80; }
/* Keep team photos and card imagery dark enough for their existing word labels.
   The actual red/blue card labels remain bright, independently of the light UI. */
html[data-theme="light"] .card.red .card-label,
html[data-theme="light"] .card.red .symbol-label,
html[data-theme="light"] .home .mini-card.red .mini-card-label {
  background: #ff8594;
  color: #3d1020;
}
html[data-theme="light"] .card.blue .card-label,
html[data-theme="light"] .card.blue .symbol-label,
html[data-theme="light"] .home .mini-card.blue .mini-card-label {
  background: #86b5ff;
  color: #102441;
}
/* Preserve the full-screen dark danger/victory cinematics regardless of theme. */
html[data-theme="light"] .round-finale { background: #000; color: #fff; }
html[data-theme="light"] .round-finale h2 { color: #fff; }
html[data-theme="light"] .round-finale .primary { background: #a6f3cb; color: #132b23; }
html[data-theme="light"] .round-finale .secondary { background: #27334b; color: #fff; }
html[data-theme="light"] :is(button,a,input,select):focus-visible {
  outline-color: var(--mint);
}
html[data-theme="light"] .card-inspect-icon { background: #081323a6; color: #fff; }
/* Independent header control: available on home, lobby and game board. */
.theme-toggle { display: inline-grid; place-items: center; flex: 0 0 42px; }
.theme-toggle .theme-icon { width: 21px; height: 21px; stroke: currentColor; fill: none; }
.theme-toggle .theme-moon { display: none; }
html[data-theme="light"] .theme-toggle .theme-sun { display: none; }
html[data-theme="light"] .theme-toggle .theme-moon { display: block; }
@media (max-width: 620px) {
  .header-actions { gap: 8px; }
  .theme-toggle { flex-basis: 40px; width: 40px; height: 40px; }
}

/* Unified application chrome. Dimensions include borders and padding. */
.unified-header,.unified-footer-root{
 --chrome-bg:#f7f9f6;--chrome-surface:#fff;--chrome-border:#dbe5de;
 --chrome-text:#183c32;--chrome-muted:#52655d;
 --chrome-hover:#eaf3ef;--chrome-hover-border:#b9cbc0;--chrome-hover-text:#087566;
 box-sizing:border-box;background:var(--chrome-bg);color:var(--chrome-text);font-family:"Cairo",Tahoma,Arial,sans-serif;
}
html[data-theme="dark"] :is(.unified-header,.unified-footer-root){
 --chrome-bg:#101d19;--chrome-surface:#172923;--chrome-border:#304b40;
 --chrome-text:#edf4ee;--chrome-muted:#b8c9bf;
 --chrome-hover:#20382f;--chrome-hover-border:#46695b;--chrome-hover-text:#70d4b5;
}
header.unified-header{
 background:transparent!important;
 border-bottom-color:transparent!important;
 display:block;position:sticky;top:0;z-index:40;width:100%;height:76px;
 min-height:76px;max-height:76px;margin:0;padding:0;border:0;
 border-bottom:1px solid var(--chrome-border);box-shadow:none;
}
header.unified-header .unified-header-row.unified-header-row{
 display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
 grid-template-rows:42px;align-content:center;align-items:center;gap:0 20px;
 width:100%;height:75px;min-height:0;max-height:75px;
 margin:0 auto;padding:0;box-sizing:border-box;direction:rtl;
}
header.unified-header .unified-header-row.unified-header-row > :is(.unified-brand,.grades-site-logo){
 grid-column:1;grid-row:1;justify-self:start;display:inline-flex;align-items:center;
 justify-content:flex-start;gap:13px;min-width:0;direction:ltr;white-space:nowrap;
 margin:0;padding:0;color:var(--chrome-text);font-size:20px;font-weight:800;
 line-height:1.5;letter-spacing:-.5px;text-decoration:none;
}
header.unified-header .unified-header-row.unified-header-row > :is(.unified-brand,.grades-site-logo) :is(img,.brand-mark){
 display:block;width:35px;height:35px;min-width:35px;flex:0 0 35px;object-fit:contain;
 margin:0;transform:none;box-shadow:none;
}
header.unified-header .unified-header-row.unified-header-row > .unified-site-name{
 grid-column:2;grid-row:1;justify-self:center;min-width:0;max-width:100%;
 margin:0;padding:0;border:0;background:none;direction:rtl;text-align:center;
 font-size:13px;font-weight:700;line-height:18px;letter-spacing:0;color:var(--chrome-muted);
 white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
header.unified-header .unified-header-row.unified-header-row > .unified-site-name :is(span,b){font-size:inherit;font-weight:inherit;line-height:inherit}
.unified-header .unified-site-name::before,.unified-header .unified-site-name::after{content:none}
.unified-header .brand-name-mobile,.unified-header .header-title-mobile{display:none}
.unified-header .brand-name-desktop,.unified-header .header-title-full{display:inline}
header.unified-header .unified-header-row.unified-header-row > :is(.unified-tools,.header-tools){
 grid-column:3;grid-row:1;justify-self:end;display:flex;align-items:center;justify-content:flex-end;
 flex-wrap:nowrap;gap:9px;min-width:0;max-width:none;width:auto;margin:0;padding:0;position:static;
}
.unified-header :is(.unified-tools,.header-tools) .nav{display:flex;align-items:center;gap:9px}
.unified-header :is(.unified-tools,.header-tools) .header-action-frame{
 background:color-mix(in srgb,var(--chrome-surface) 76%,transparent);
 -webkit-backdrop-filter:blur(7px);backdrop-filter:blur(7px);
 display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;
 width:42px;height:42px;min-width:42px;min-height:42px;flex:0 0 42px;
 margin:0;padding:0;position:static;inset:auto;border-radius:50%;
 border:1px solid var(--chrome-border);background:var(--chrome-surface);color:var(--chrome-text);
 box-shadow:none;text-decoration:none;line-height:1;cursor:pointer;transform:none;filter:none;
}
.unified-header :is(.unified-tools,.header-tools) .header-action-frame:hover{
 background:var(--chrome-hover);border-color:var(--chrome-hover-border);color:var(--chrome-hover-text);
 transform:none;filter:none;
}
.unified-header :is(.unified-tools,.header-tools) .header-action-frame:focus-visible{outline:3px solid var(--chrome-hover-text);outline-offset:3px}
.unified-header :is(.unified-tools,.header-tools) .header-action-frame > svg{width:21px;height:21px;flex:none}
.unified-header .header-action-frame[hidden]{display:none!important}
.unified-header .icon-sun{display:block}.unified-header .icon-moon{display:none}
html[data-theme="light"] .unified-header .icon-sun{display:none}
html[data-theme="light"] .unified-header .icon-moon{display:block}
html[data-theme="dark"] .unified-header .icon-sun{display:block}
html[data-theme="dark"] .unified-header .icon-moon{display:none}
.unified-header .shell-compact-icon{display:none}
footer.unified-footer-root{
 display:block;position:static;width:100%;height:64px;min-height:64px;max-height:64px;
 margin:0;padding:0;border:0;border-top:1px solid var(--chrome-border);box-shadow:none;
 font-size:12px;line-height:18px;text-align:right;
}
.unified-footer-root .unified-footer-row{
 display:flex;align-items:center;justify-content:flex-start;flex-wrap:nowrap;gap:16px;
 width:100%;height:63px;min-height:0;margin:0 auto;
 padding:12px 0;box-sizing:border-box;direction:rtl;color:var(--chrome-muted);
 font-size:12px;line-height:18px;text-align:right;
}
.unified-footer-root .unified-footer-row > *{min-width:0;font-size:inherit;line-height:inherit}
.unified-footer-root .unified-footer-row > .unified-privacy{
 margin-inline-start:auto;margin-inline-end:0;flex:0 0 auto;white-space:nowrap;
 text-align:left;font-size:12px;color:var(--chrome-hover-text);
}
.homepage-section-nav,.shell-section-nav{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:24px;width:100%;margin:0 auto;padding:12px 0;font-size:13px}
.grades-workspace .sidebar{top:92px}
@media(max-width:760px){
 header.unified-header{height:64px;min-height:64px;max-height:64px}
 header.unified-header .unified-header-row.unified-header-row{
  grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:38px;
  align-content:center;gap:6px;height:63px;max-height:63px;padding:0;
 }
 header.unified-header .unified-header-row.unified-header-row > :is(.unified-brand,.grades-site-logo){font-size:clamp(14px,4vw,18px);gap:11px;flex:0 0 auto;min-width:max-content}
 header.unified-header .unified-header-row.unified-header-row > :is(.unified-brand,.grades-site-logo) :is(img,.brand-mark){width:30px;height:30px;min-width:30px;flex-basis:30px}
 header.unified-header .unified-header-row.unified-header-row > .unified-site-name{grid-column:2;grid-row:1;justify-self:stretch;min-width:0;width:100%;font-size:clamp(10px,2.8vw,12px);line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}
 header.unified-header .unified-header-row.unified-header-row > :is(.unified-tools,.header-tools){grid-column:3;grid-row:1;justify-self:end;gap:6px;max-width:none;min-width:max-content;display:flex}
 .unified-header :is(.unified-tools,.header-tools) .header-action-frame{width:38px;height:38px;min-width:38px;min-height:38px;flex-basis:38px}
 header.unified-header .unified-header-row.unified-header-row > .header-tools form{display:contents}
 .unified-header .shell-compact-control{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;min-width:38px;min-height:38px;padding:0}
 .unified-header .shell-control-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .unified-header .shell-compact-icon{display:block;width:21px;height:21px}
 .unified-header .connection{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .unified-header .brand-name-desktop,.unified-header .header-title-full{display:none}
 .unified-header .brand-name-mobile,.unified-header .header-title-mobile{display:inline}
 .unified-footer-root .unified-footer-row{gap:10px;font-size:11px}
 .unified-footer-root .unified-footer-row > .unified-privacy{font-size:11px}
 .grades-workspace .sidebar{top:76px}
}
@media(max-width:375px){header.unified-header .unified-header-row.unified-header-row > .unified-site-name{font-size:11px}}
@media print{header.unified-header,footer.unified-footer-root,.homepage-section-nav,.shell-section-nav{display:none!important}}

/* Canvas geometry is shared with each application's actual content rules above. */
header.unified-header,footer.unified-footer-root{max-width:none}
.chrome-canvas-track{display:block;height:100%;min-width:0;margin:0 auto;padding-block:0}
.chrome-layout-track{display:flex;align-items:stretch;justify-content:center;width:100%;height:100%;margin:0;padding-block:0;box-sizing:border-box}
.chrome-canvas-track.chrome-matrix-frame{border-left:1px solid transparent;border-right:1px solid transparent}
@media(min-width:761px){
 .unified-header .chrome-xl-frame .unified-header-row{column-gap:8px}
 .unified-header .chrome-xl-frame .unified-header-row > .unified-brand{font-size:16px;gap:7px}
 .unified-header .chrome-xl-frame .unified-header-row > .unified-brand img{width:30px;height:30px;min-width:30px;flex-basis:30px}
 .unified-header .chrome-xl-frame .unified-header-row > .unified-site-name{font-size:12px}
}


/* Codenames: preserve the desktop grid and use a single flex row on mobile. */
header.unified-header .chrome-shifra-frame {
  width: 100%;
  max-width: 1200px;
  min-width: 0;
  box-sizing: border-box;
}
header.unified-header .unified-header-row.unified-header-row {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: 42px;
  grid-template-areas: "brand title tools";
  column-gap: 20px;
}
header.unified-header .unified-header-row.unified-header-row > .unified-brand {
  grid-area: brand;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  min-width: 0;
  max-width: 100%;
  gap: 9px;
  font-size: 17px;
  line-height: 1.2;
}
header.unified-header .unified-header-row.unified-header-row > .unified-brand .brand-mark {
  width: 35px;
  height: 35px;
  min-width: 35px;
  flex: 0 0 35px;
  font-size: 19px;
  line-height: 1;
  border-radius: 11px;
}
header.unified-header .unified-header-row.unified-header-row > .unified-brand > span:not(.brand-mark) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
header.unified-header .unified-header-row.unified-header-row > .unified-site-name {
  grid-area: title;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: max-content;
  max-width: 240px;
}
header.unified-header .unified-header-row.unified-header-row > .unified-tools {
  grid-area: tools;
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  min-width: max-content;
  gap: 9px;
}
@media (max-width: 760px) {
  header.unified-header .unified-header-row.unified-header-row {
    display: flex;
    flex-flow: row nowrap;
    direction: rtl;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 63px;
    max-height: 63px;
    padding: 0 12px;
    box-sizing: border-box;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-brand {
    display: inline-flex;
    order: 1;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
    gap: 6px;
    font-size: clamp(12px, 3.6vw, 15px);
    line-height: 1.15;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-brand .brand-mark {
    width: 28px;
    height: 28px;
    min-width: 28px;
    flex: 0 0 28px;
    font-size: 19px;
    line-height: 1;
    border-radius: 9px;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-brand > span:not(.brand-mark) {
    white-space: nowrap;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-site-name {
    order: 2;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 90px;
    font-size: 11px;
    line-height: 16px;
    white-space: nowrap;
    text-align: center;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-tools {
    order: 3;
    display: flex;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    max-width: none;
    gap: 4px;
    justify-self: auto;
    margin-inline-start: 0;
  }
  .unified-header :is(.unified-tools, .header-tools) .header-action-frame {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    flex: 0 0 34px;
  }
}
@media (max-width: 390px) {
  header.unified-header .unified-header-row.unified-header-row {
    gap: 5px;
    padding-inline: 9px;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-brand {
    gap: 4px;
    font-size: 12px;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-site-name {
    max-width: 58px;
    font-size: 10px;
  }
  header.unified-header .unified-header-row.unified-header-row > .unified-tools {
    gap: 3px;
  }
  .unified-header :is(.unified-tools, .header-tools) .header-action-frame {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    flex-basis: 32px;
  }
}


/* Codenames chrome: natural-flow header and fully transparent action controls. */
:root {
  --chrome-header-height: 76px;
}
header.unified-header {
  position: static !important;
  top: auto !important;
  inset: auto !important;
  z-index: auto !important;
  height: var(--chrome-header-height) !important;
  min-height: var(--chrome-header-height) !important;
  max-height: var(--chrome-header-height) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
header.unified-header::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background: color-mix(in srgb, var(--chrome-border) 78%, transparent);
  pointer-events: none;
}
.shell {
  padding-top: 0 !important;
}

/* Keep every header action icon unfilled in both themes. */
.unified-header :is(.unified-tools,.header-tools) .header-action-frame {
  background: transparent !important;
  border-color: color-mix(in srgb, var(--chrome-border) 70%, transparent) !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.unified-header :is(.unified-tools,.header-tools) .header-action-frame:hover {
  background: transparent !important;
  border-color: var(--chrome-hover-border) !important;
  color: var(--chrome-hover-text);
}

/* The footer remains transparent and keeps its separator. */
footer.unified-footer-root {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.unified-footer-root .unified-footer-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0 auto;
  padding: 14px 0 18px;
  background: transparent;
  text-align: center;
}
.unified-footer-root .unified-footer-row > .unified-privacy {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  padding: 8px 0 0;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--chrome-border) 78%, transparent);
  background: transparent;
  text-align: center;
}
@media (max-width: 760px) {
  :root {
    --chrome-header-height: 64px;
  }
}
