  * { box-sizing: border-box; margin: 0; padding: 0; }
  .hidden { display: none; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    padding: 16px;
    max-width: 480px;
    margin: 0 auto;
  }
  h1 { font-size: 20px; margin-bottom: 4px; }
  .subtitle { font-size: 12px; color: #888; margin-bottom: 20px; }

  button {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    cursor: pointer;
  }
  button:disabled { background: #333; color: #666; }
  button:active:not(:disabled) { background: #1d4ed8; }

  .archive-warning {
    margin: 6px 0;
    padding: 8px 10px;
    border-radius: 4px;
    background: #3a2a12;
    color: #fbbf24;
    font-size: 12px;
    line-height: 1.4;
  }
  .phase {
    font-size: 13px;
    color: #aaa;
    text-align: center;
    margin: 12px 0;
    min-height: 18px;
  }

  .live-indicator {
    position: relative;
    height: 3px;
    border-radius: 2px;
    background: #161616;
    overflow: hidden;
    margin: -6px 0 12px;
    display: none;
  }
  .live-indicator.active { display: block; }
  .live-indicator-bar {
    position: absolute;
    top: 0;
    left: -40%;
    height: 100%;
    width: 40%;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #2563eb, transparent);
    animation: live-sweep 1.3s ease-in-out infinite;
  }
  @keyframes live-sweep {
    0%   { left: -40%; }
    100% { left: 100%; }
  }

  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
  }
  .card {
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
  }
  .card-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .card-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
  }
  .card-unit { font-size: 12px; color: #888; font-weight: 400; }
  .card-value--sm { font-size: 16px; }

  .card-desc {
    display: none;
    font-size: 11px;
    color: #aaa;
    line-height: 1.4;
    margin-top: 4px;
  }
  .card.showing-desc .card-value { display: none; }
  .card.showing-desc .card-desc { display: block; }

  .stability-block {
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 12px;
    margin-top: 14px;
  }
  .stability-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .stability-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .stability-composite {
    font-size: 20px;
    font-weight: 700;
  }
  .stability-composite.s-good { color: #4ade80; }
  .stability-composite.s-fair { color: #fbbf24; }
  .stability-composite.s-poor { color: #f87171; }
  .stability-inputs {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    font-size: 11px;
    color: #aaa;
  }
  .stability-caveat {
    font-size: 10px;
    color: #808080;
    margin-top: 8px;
    line-height: 1.4;
  }

  .log {
    margin-top: 20px;
    font-size: 11px;
    color: #808080;
    font-family: monospace;
    white-space: pre-wrap;
    max-height: 160px;
    overflow-y: auto;
    background: #111;
    padding: 8px;
    border-radius: 6px;
    display: none;
  }
  .log.visible { display: block; }

  /* Real <button> elements; the resets keep the original link-like look. */
  .toggle-log {
    font-size: 11px;
    color: #808080;
    text-align: center;
    margin-top: 10px;
    text-decoration: underline;
    cursor: pointer;
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
  }
  .toggle-log:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
  }

  .toggle-log-row {
    display: flex;
    justify-content: center;
    gap: 16px;
  }

  .protocol-note {
    font-size: 10px;
    color: #808080;
    margin-top: 20px;
    line-height: 1.4;
    white-space: pre-line;
  }

  .adv-settings {
    margin-top: 16px;
    font-size: 12px;
  }
  .adv-settings summary {
    cursor: pointer;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
  }
  .adv-settings-body {
    margin-top: 12px;
    padding: 12px;
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
  }
  .adv-settings-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    color: #ccc;
  }
  .adv-settings-field input {
    width: 90px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 6px 8px;
    font-size: 13px;
  }
  .adv-settings-field select {
    width: auto;
    max-width: 140px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 6px 8px;
    font-size: 13px;
    margin-bottom: 0;
  }
  .adv-settings-note {
    font-size: 10px;
    color: #808080;
    line-height: 1.4;
    margin-top: 4px;
  }

  .site-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #2a2a2a;
  }
  .site-footer-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    justify-content: center;
    font-size: 12px;
  }
  .site-footer-tools a {
    color: #9ab8f5;
    text-decoration: none;
  }
  .site-footer-tools a:hover { text-decoration: underline; }
  .site-footer-institut {
    text-align: center;
    font-size: 11px;
    color: #808080;
    margin-top: 12px;
  }
  .site-footer-institut a { color: #808080; }
  .site-footer-coffee {
    text-align: center;
    margin-top: 14px;
  }
  .site-footer-coffee a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    background: #2a1a05;
    color: #fbbf24;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
  }
  .site-footer-coffee a:hover { background: #3a2508; }

  select {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    background: #161616;
    color: #e0e0e0;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    margin-bottom: 10px;
  }

  .elapsed {
    font-size: 13px;
    color: #4ade80;
    text-align: center;
    margin: 8px 0;
    font-variant-numeric: tabular-nums;
  }

  .drop-events {
    margin-top: 16px;
  }
  .drop-events-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
  }
  .drop-event {
    font-size: 12px;
    color: #f87171;
    background: #1a0e0e;
    border: 1px solid #3f1d1d;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
  }
  .drop-event.ongoing {
    color: #fbbf24;
    background: #1a1608;
    border-color: #3f2f1d;
  }
  .no-drops {
    font-size: 12px;
    color: #4ade80;
  }

  .history-block {
    margin-top: 16px;
  }
  .history-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
  }
  .history-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  /* Applied to real <button> elements now, so the resets below keep the
     original link-like appearance while restoring keyboard operability. */
  .history-clear {
    font-size: 11px;
    color: #808080;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
  }
  .history-clear:focus-visible,
  .clickable:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
  }
  .history-row {
    font-size: 12px;
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .history-row-date {
    color: #ccc;
  }
  .history-row-meta {
    color: #888;
    font-size: 11px;
  }
  .history-row-score {
    font-weight: 700;
    font-size: 14px;
  }
  .history-row-score.s-good { color: #4ade80; }
  .history-row-score.s-fair { color: #fbbf24; }
  .history-row-score.s-poor { color: #f87171; }

  .chart-block {
    margin-top: 16px;
  }
  .chart-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
  }
  .chart-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .chart-title-row .chart-title { margin-bottom: 6px; }
  .chart-legend {
    display: flex;
    gap: 10px;
    font-size: 10px;
    color: #aaa;
    text-transform: none;
    letter-spacing: normal;
  }
  .chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .chart-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
  }
  .chart-legend-dot--down { background: #3b82f6; }
  .chart-legend-dot--up { background: #f59e0b; }
  .chart-legend-dot--ping { background: #a0a0a0; }
  .chart-canvas {
    width: 100%;
    height: 100px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    display: block;
  }
  .chart-canvas-tall {
    height: 150px;
  }

  .dashboard-panel {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 14px;
    margin-top: 16px;
  }
  .dashboard-panel > button { margin-top: 0; }
  .dashboard-panel .chart-block:first-of-type { margin-top: 14px; }

  .chart-explanation {
    font-size: 10px;
    color: #808080;
    line-height: 1.4;
    margin-top: 6px;
  }

  .history-header-links {
    display: flex;
    gap: 14px;
  }
  .history-header-links .history-clear {
    cursor: pointer;
  }

  .adv-settings-checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #ccc;
  }
  .adv-settings-checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }
  .adv-settings-textarea-field {
    margin-bottom: 10px;
  }
  .adv-settings-textarea-field > span {
    display: block;
    color: #ccc;
    margin-bottom: 6px;
  }
  .adv-settings-textarea-field textarea {
    width: 100%;
    min-height: 92px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 8px;
    font-size: 12px;
    font-family: monospace;
    resize: vertical;
  }
