/* Web app shell: the desktop's look (header, drawer nav, cards, buttons) on the web pages.
   Loaded after desktop-theme.css, so these rules win. Uses the same tokens. */
html { background: #F5F4EE; }
html.body--dark { background: #262624; }

.app-header {
  position: relative; height: 58px; padding: 0 24px; gap: 10px;
  background: var(--cc-bg); color: var(--cc-text); border-bottom: 1px solid var(--cc-line);
}
.app-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--cc-accent), transparent 55%); opacity: .85;
}
.cc-brandlink { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cc-text); }
.cc-brand { font-family: "Source Serif 4", Georgia, serif; font-size: 19px; font-weight: 600; }
.cc-icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--cc-muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.cc-icon-btn:hover { background: var(--cc-hover); color: var(--cc-text); }

.sidebar { width: 224px; padding: 24px 0; border-right: 1px solid var(--cc-line); background: var(--cc-bg); }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; min-height: 38px; margin: 1px 12px; padding: 4px 12px;
  border-radius: 8px; border-left: 0; color: var(--cc-muted); font-size: 14.5px; font-weight: 500;
}
.sidebar-link:hover { background: var(--cc-hover); color: var(--cc-text); }
.sidebar-link.active { background: var(--cc-accent-soft); color: var(--cc-text); font-weight: 600; }
.sidebar-link.active .material-symbols-outlined { color: var(--cc-accent); }
.sidebar-link.cc-soon { cursor: default; opacity: .75; }
.sidebar-link .material-symbols-outlined { font-size: 20px; color: inherit; }
.sidebar-link .tag { margin-left: auto; }

.app-body { min-height: calc(100vh - 58px); }
.app-main { padding: 36px 44px 64px; }
.app-main-inner { max-width: 1240px; }

.app-main .h1 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 32px; line-height: 1.2; letter-spacing: -.01em; }
.app-main .h2 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 20px; line-height: 1.3; letter-spacing: 0; }
.app-main .lead { font-size: 14.5px; color: var(--cc-muted); max-width: none; }
.app-main .eyebrow { color: var(--cc-muted); }
.app-main .textlink { color: var(--cc-accent); }

.panel {
  background: var(--cc-card); border: 1px solid var(--cc-line); border-radius: 14px; padding: 22px 24px;
  box-shadow: 0 1px 2px rgba(20,20,20,.04), 0 6px 18px rgba(20,20,20,.035);
}
body.body--dark .panel { box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 6px 18px rgba(0,0,0,.18); }
.panel-accent { border-left: 3px solid var(--cc-accent); }
.panel-title { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cc-muted); }

.app-main .field { background: var(--cc-card); border: 1px solid var(--cc-line); border-radius: 10px; color: var(--cc-text); }
.app-main .field:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 2px; }
.btn { border-radius: 12px; font-weight: 600; }
.btn-primary { background: var(--cc-accent); border-color: var(--cc-accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--cc-accent); filter: brightness(1.06); }
.btn-ghost { border-color: var(--cc-line); color: var(--cc-text); background: transparent; }
.btn-ghost:hover { background: var(--cc-hover); color: var(--cc-text); border-color: var(--cc-line); }

.progress-track { background: var(--cc-track); border-radius: 6px; height: 8px; }
.progress-fill { background: var(--cc-accent); border-radius: 6px; }
.rule-row { border-top: 1px solid var(--cc-line); }
.swatch-bad { background: var(--cc-bad); }
.swatch-good { background: var(--cc-good); }
.result-win { color: var(--cc-good); }
.result-loss { color: var(--cc-bad); }
.result-draw { color: var(--cc-muted); }

.data-table th, .data-table td { border-bottom-color: var(--cc-line); }
.data-table th { color: var(--cc-muted); }
.data-table tbody tr:hover { background: var(--cc-hover); }

.app-footer { border-top: 1px solid var(--cc-line); }

@media (max-width: 900px) {
  .app-main { padding: 28px 22px 56px; }
}
@media (max-width: 600px) {
  .app-main { padding: 18px 14px 40px; }
  .app-header { padding: 0 12px; }
}

/* Helpers for the desktop's NiceGUI rows/columns (ui.row / ui.column / ui.space). */
.cc-row { display: flex; align-items: center; flex-wrap: nowrap; width: 100%; }
.cc-col { display: flex; flex-direction: column; }
.cc-space { flex: 1 1 auto; }
.cc-gap-2 { gap: 8px; } .cc-gap-3 { gap: 12px; } .cc-gap-4 { gap: 16px; }
.cc-section-title { margin: 28px 0 12px; }
.cc-weakness-link { color: inherit; text-decoration: none; }
.cc-weakness-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.cc-flat-btn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 12px;
  color: var(--cc-accent); font-weight: 600; text-decoration: none; }
.cc-flat-btn:hover { background: var(--cc-accent-soft); }
.cc-card .cc-chip .material-symbols-outlined { font-size: 14px; }

/* A hidden view must stay hidden: .view (display: block) came later in style.css and won. */
.view.hidden, .hidden { display: none !important; }

/* Weakness detail page */
.cc-gap-1 { gap: 4px; } .cc-gap-5 { gap: 20px; } .cc-gap-6 { gap: 24px; } .cc-gap-8 { gap: 32px; }
.cc-wrap { flex-wrap: wrap; } .cc-top { align-items: flex-start; } .cc-stretch { align-items: stretch; }
.cc-strong { font-weight: 600; } .cc-self-start { align-self: flex-start; }
.cc-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-backlink { color: var(--cc-accent); text-decoration: none; }
.cc-empty { align-items: center; text-align: center; padding: 48px 24px; }
.cc-examples { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(336px, 1fr)); }
.cc-small-board { width: min(290px, calc(100vw - 96px)); height: min(290px, calc(100vw - 96px)); align-self: center; flex-shrink: 0; }
@media (max-width: 900px) {
  .cc-stack { flex-direction: column; } .cc-stack > * { width: 100%; flex: none !important; }
}
