/* Calculus Suffragiorum — Mehrheitsrechner */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--rule);
}

.panel-title,
.denarii-toggle {
  font-family: var(--display);
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.panel-title { font-size: 17px; letter-spacing: 0.18em; }

.denarii-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- Zeilenraster ---------- */

.row {
  display: grid;
  grid-template-columns: 44px 56px 1fr 190px 190px;
  gap: 10px;
  align-items: center;
}

.row--head {
  padding: 12px 4px 8px;
  font-family: var(--display);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

.row--faction {
  padding: 7px 4px;
  border-bottom: 1px solid var(--rule-faint);
  cursor: grab;
  transition: opacity 120ms ease, background-color 120ms ease;
}

.row--faction.is-inactive { opacity: 0.42; }
.row--faction.is-dragging { background: rgba(180, 140, 70, 0.22); cursor: grabbing; }

.cell-check,
.cell-icon { display: flex; align-items: center; justify-content: center; }

.cell-icon img {
  width: 44px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

.cell-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.faction-name {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.faction-sub { font-size: 14px; font-style: italic; color: var(--ink-faint); }

/* ---------- Eingabefelder ---------- */

input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  background: rgba(255, 252, 244, 0.85);
  border: 1px solid rgba(120, 88, 40, 0.45);
  border-radius: 2px;
  outline: none;
  transition: border-color 120ms ease, background-color 120ms ease;
}

input[type="text"]:focus { border-color: var(--brass); background: #fffdf7; }
input[type="text"]:disabled { opacity: 0.35; cursor: not-allowed; }
input[type="text"]::placeholder { color: rgba(60, 42, 20, 0.35); }

input[type="checkbox"] {
  width: 19px;
  height: 19px;
  accent-color: var(--brass);
  cursor: pointer;
}

.denarii-toggle input[type="checkbox"] { width: 18px; height: 18px; }

/* Denarii-Spalte wird mitgedimmt, wenn der Schalter aus ist. */
.denarii-off .col-denarii,
.denarii-off .js-denarii { opacity: 0.35; }

.panel-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-top: 14px;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.panel-foot b { font-weight: 700; }

/* ---------- Diagramm ---------- */

.chart {
  width: min(1080px, 100%);
  padding: 26px 26px 18px;
  border: 1px solid rgba(180, 140, 70, 0.35);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(28, 20, 10, 0.72), rgba(20, 14, 7, 0.8));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.chart[hidden] { display: none; }

.chart h2 {
  margin: 0 0 6px;
  text-align: center;
  font-family: var(--display);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--gold);
}

.chart-stage { position: relative; width: 100%; }

#pie { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }

#pie path {
  stroke: rgba(20, 14, 7, 0.85);
  stroke-width: 2;
  cursor: grab;
  transition: opacity 120ms ease;
}

#pie path.is-dimmed { opacity: 0.55; }

.majority-line {
  stroke: #f2e4c4;
  stroke-width: 3;
  stroke-dasharray: 10 8;
  opacity: 0.85;
}

.labels { position: absolute; inset: 0; pointer-events: none; }

.labels span {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(14px, 1.7vw, 26px);
  color: #1a1207;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
}

.totals {
  position: absolute;
  left: 50%;
  top: 78%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.totals-value {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 3.6vw, 58px);
  color: var(--cream);
  line-height: 1;
}

.totals-caption {
  margin-top: 8px;
  font-family: var(--display);
  font-size: clamp(11px, 1.3vw, 20px);
  letter-spacing: 0.3em;
  color: var(--gold);
}

.verdict {
  margin: 0;
  padding-top: 6px;
  text-align: center;
  font-style: italic;
  font-size: 17px;
  color: #d8c49a;
}

.chart-hint {
  margin: 0;
  padding-top: 8px;
  text-align: center;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--gold-dim);
}

@media (max-width: 820px) {
  .row { grid-template-columns: 36px 48px 1fr; row-gap: 8px; }
  .row--head { display: none; }
  .row--faction .js-votes { grid-column: 3 / 4; }
  .row--faction .js-denarii { grid-column: 3 / 4; }
  .panel-foot { flex-direction: column; gap: 6px; }
}

@media (max-width: 520px) {
  .chart { padding-left: 14px; padding-right: 14px; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}
