/* index.css — Chart Calculator */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #1a1a2e;
  color: white;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-title h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-title p {
  font-size: 0.78rem;
  opacity: 0.55;
  margin-top: 0.25rem;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  font-size: 0.82rem;
}

.header-auth-email {
  color: rgba(255,255,255,0.7);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-auth a, .header-auth button {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.header-auth a:hover, .header-auth button:hover {
  background: rgba(255,255,255,0.22);
}

#subBtn {
  background: #e49836;
  border-color: #e49836;
  color: white;
  font-weight: 600;
}
#subBtn:hover { background: #c8821e; }

#unsubBtn {
  background: rgba(255,255,255,0.06);
  font-size: 0.72rem;
  opacity: 0.7;
}

/* ── Layout ── */
main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Card ── */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin-bottom: 1.25rem;
  font-weight: 600;
}

/* ── Form ── */
.form-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row-main {
  grid-template-columns: 1fr 1fr;
}

.form-row-optional {
  grid-template-columns: 1fr 1fr 2fr;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 0.35rem;
}

.field label .tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 400;
  color: #aaa;
  background: #f2f2f2;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
}

input[type="date"],
input[type="time"],
input[type="number"],
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  font-size: 0.9rem;
  color: #1a1a1a;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

/* Restore native date/time picker arrows */
input[type="date"],
input[type="time"] {
  appearance: auto;
  -webkit-appearance: auto;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.14);
}

input::placeholder {
  color: #bbb;
}

.form-actions {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

button[type="submit"] {
  background: #1a1a2e;
  color: white;
  border: none;
  padding: 0.65rem 1.75rem;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  letter-spacing: 0.01em;
}

button[type="submit"]:hover:not(:disabled) {
  background: #2d2d50;
}

button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Save chart button ── */
#saveChartBtn {
  background: #2e7d32;
  color: white;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.01em;
  display: none;
}

#saveChartBtn:hover {
  background: #1b5e20;
}

#saveChartBtn.guest {
  background: #bdbdbd;
  color: #fff;
  cursor: pointer;
}

#saveChartBtn.guest:hover {
  background: #9e9e9e;
}

/* ── Export dropdown ── */
.export-wrap {
  position: relative;
  display: inline-block;
}

#exportMenuBtn {
  background: #0f3460;
  color: white;
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.01em;
}
#exportMenuBtn:hover { background: #163a6e; }

.export-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  overflow: hidden;
  z-index: 100;
  min-width: 190px;
}
.export-menu.open { display: block; }

.export-menu button {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1a1a2e;
  text-align: left;
  transition: background 0.12s;
}
.export-menu button:hover { background: #f0f4ff; }
.export-menu button span {
  font-weight: 400;
  color: #777;
  font-size: 0.76rem;
}

/* ── City autocomplete ── */
.city-autocomplete {
  position: relative;
}

.city-autocomplete input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  font-size: 0.9rem;
  color: #1a1a1a;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.city-autocomplete input[type="text"]:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.14);
}

#cityDropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d5d5d5;
  border-top: none;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

#cityDropdown .city-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

#cityDropdown .city-item:last-child {
  border-bottom: none;
}

#cityDropdown .city-item:hover,
#cityDropdown .city-item.active {
  background: #f0f4fa;
}

#cityDropdown .city-main {
  font-size: 0.88rem;
  font-weight: 500;
  color: #1a1a1a;
}

#cityDropdown .city-sub {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.1rem;
}

#cityInfo {
  font-size: 0.75rem;
  color: #4a6fa5;
  margin-top: 0.3rem;
  min-height: 1em;
}

/* ── Topocentric checkbox ── */
#topoRow {
  display: none;
  margin-bottom: 0.75rem;
}

.topo-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #444;
  cursor: pointer;
  user-select: none;
}

.topo-label input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  cursor: pointer;
  accent-color: #4a6fa5;
}

.topo-warning {
  display: inline;
  font-size: 0.72rem;
  color: #b56a00;
  margin-left: 0.25rem;
}

/* ── Language selector in form ── */
.lang-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.lang-wrap label {
  font-size: 0.78rem;
  color: #666;
  white-space: nowrap;
}

.lang-wrap select {
  width: auto;
  padding: 0.55rem 2rem 0.55rem 0.65rem;
  font-size: 0.85rem;
}

/* ── Status messages ── */
#status {
  display: none;
  font-size: 0.84rem;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
}

#status.loading {
  color: #555;
}

#status.error {
  color: #a52020;
  background: #fff3f3;
  border: 1px solid #f0c0c0;
}

/* ── Date locked ── */
#birthdate[readonly] {
  background: #f5f5f5;
  color: #555;
  cursor: not-allowed;
}

#dateResetLink {
  float: right;
  font-size: 0.7rem;
  font-weight: 400;
  color: #4a6fa5;
  text-decoration: none;
}

#dateResetLink:hover { text-decoration: underline; }

/* ── Login modal ── */
#loginModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#loginModal.open, #upgradeModal.open { display: flex; }
#upgradeModal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; }

.modal-box {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  padding: 2rem 2rem 1.5rem;
  max-width: 320px;
  width: 90%;
  text-align: center;
}

.modal-box h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 0.55rem;
}

.modal-box p {
  font-size: 0.84rem;
  color: #666;
  margin-bottom: 1.4rem;
  line-height: 1.5;
}

.modal-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.modal-btns a {
  display: block;
  padding: 0.6rem 1.25rem;
  border-radius: 5px;
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.modal-btn-primary   { background: #1a1a2e; color: white; }
.modal-btn-primary:hover   { background: #2d2d50; }
.modal-btn-secondary { background: #e8eaf0; color: #1a1a2e; }
.modal-btn-secondary:hover { background: #d5d8e8; }

.modal-close {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: #aaa;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.modal-close:hover { color: #666; }

/* ── Results ── */
#results {
  display: none;
}

#results.visible {
  display: block;
}

#results.recalculating {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.15s;
}

.results-toolbar {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.toggle-btn {
  background: none;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  color: #666;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.toggle-btn:hover {
  border-color: #4a6fa5;
  color: #4a6fa5;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 280px 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* ── Collapsible detail columns ── */
.col-extra {
  display: none;
}

.details-open .col-extra {
  display: table-cell;
}

/* ── Chart card ── */
.chart-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.chart-card-header {
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.chart-card-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.01em;
}

.chart-card-header .julday {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  font-family: monospace;
}

.personality-header { background: #1a1a2e; }
.design-header      { background: #7d1c1c; }

/* ── Planet table ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

thead th {
  text-align: left;
  padding: 0.45rem 0.85rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #888;
  background: #f8f9fa;
  border-bottom: 1px solid #ececec;
}

thead th:not(:first-child) {
  text-align: center;
}

tbody tr {
  border-bottom: 1px solid #f2f2f2;
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafbfc;
}

tbody td {
  padding: 0.5rem 0.85rem;
  vertical-align: middle;
}

tbody td:not(:first-child) {
  text-align: center;
}

/* Planet cell */
.planet-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.planet-symbol {
  width: 1.3rem;
  height: 1.3rem;
  flex-shrink: 0;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}
.planet-symbol svg { display: block; }

.planet-name {
  font-weight: 500;
  white-space: nowrap;
}

.planet-link {
  cursor: pointer;
}
.planet-link:hover .planet-symbol,
.planet-link:hover .planet-name {
  color: var(--accent);
  text-decoration: underline;
}

.retro {
  font-size: 0.68rem;
  color: #b03030;
  font-weight: 600;
  background: #fff0ee;
  border: 1px solid #f5c8c8;
  border-radius: 3px;
  padding: 0.05rem 0.28rem;
  letter-spacing: 0;
}

/* Exalted / detriment markers */
.mark-exalted {
  font-size: 0.62rem;
  color: #1a8c1a;
  line-height: 1;
  vertical-align: middle;
}

.mark-detriment {
  font-size: 0.62rem;
  color: #cc2222;
  line-height: 1;
  vertical-align: middle;
}

/* Line name below gate number */

.gate-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
}

/* Gate cell */
.gate-num {
  font-weight: 700;
  font-size: 0.95rem;
}

.gate-dot {
  color: #ccc;
  font-weight: 300;
  margin: 0 0.05rem;
}

.gate-line {
  font-weight: 400;
  color: #888;
}

.gate-link {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 3px;
  padding: 0.1rem 0.25rem;
  transition: background 0.12s;
}

.gate-link:hover {
  background: #eef2fa;
}

/* Color · Tone · Base cell */
.ctb {
  font-family: monospace;
  font-size: 0.8rem;
  color: #666;
  letter-spacing: 0.05em;
}

/* Longitude cell */
.lon-cell {
  font-family: monospace;
  font-size: 0.76rem;
  color: #bbb;
}

/* ── Open-in section ── */
#openInSection {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.open-in-label {
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
}
.open-in-btn {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  background: #1a1a2e;
  color: white;
  font-size: 0.78rem;
  text-decoration: none;
  transition: background 0.15s;
}
.open-in-btn:hover { background: #2e2e5e; }

/* ── Chart summary ── */
.chart-summary {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 8px rgba(0,0,0,0.04);
  padding: 0.9rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
  align-items: baseline;
}

.summary-item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.25rem 0;
}

.summary-chart-name {
  width: 100%;
  padding-bottom: 0.4rem;
  margin-bottom: 0.1rem;
  border-bottom: 1px solid #eee;
}
.summary-chart-name .summary-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a2e;
}

.summary-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #aaa;
  flex-shrink: 0;
}

.summary-value {
  font-weight: 500;
  color: #1a1a1a;
  font-size: 0.85rem;
}

.detail-link {
  cursor: pointer;
  border-radius: 3px;
  padding: 0.05rem 0.2rem;
  transition: background 0.12s, color 0.12s;
}

.detail-link:hover {
  background: #eef2fa;
  color: #4a6fa5;
}

.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  border-radius: 3px;
  padding: 0.05rem 0.2rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: #666;
  transition: background 0.12s, color 0.12s;
}

.channel-chip:hover {
  background: #eef2fa;
  color: #4a6fa5;
}

.channel-sep {
  color: #ccc;
  margin: 0 0.1rem;
}

/* ── Bodygraph ── */
.bodygraph-wrapper {
  display: flex;
  flex-direction: column;
}

#bodygraph-container svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Date/Time Drum Spinner ── */
.dt-hidden { display: none !important; }

.dt-spinner {
  display: flex;
  align-items: center;
  gap: 0;
  background: #1a1a2e;
  border-radius: 10px;
  padding: 0 0.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
  user-select: none;
  -webkit-user-select: none;
}

.dt-group {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.dt-vdiv {
  width: 1px;
  background: rgba(255,255,255,0.1);
  align-self: stretch;
  margin: 0.7rem 0.35rem;
  flex-shrink: 0;
}

/* Each drum column */
.dt-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.35rem 0.35rem;
  cursor: ns-resize;
  -webkit-tap-highlight-color: transparent;
  border-radius: 6px;
  transition: background 0.12s;
  overflow: hidden;
  touch-action: none;
}
.dt-col:hover { background: rgba(255,255,255,0.07); }

/* Gradient fade top + bottom — drum-roll affordance */
.dt-col::before, .dt-col::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 38%;
  pointer-events: none;
  z-index: 1;
}
.dt-col::before {
  top: 0;
  background: linear-gradient(to bottom, #1a1a2e 0%, transparent 100%);
}
.dt-col::after {
  bottom: 0;
  background: linear-gradient(to top, #1a1a2e 0%, transparent 100%);
}

/* Large number display */
.dt-val {
  font-size: 2.25rem;
  font-weight: 700;
  color: white;
  line-height: 1;
  text-align: center;
  padding: 0.3rem 0.2rem;
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
  cursor: text;
  position: relative;
  z-index: 0;
}

/* Inline keyboard-edit input (shown on click) */
.dt-edit {
  font-size: 2.25rem;
  font-weight: 700;
  color: white;
  line-height: 1;
  text-align: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  outline: none;
  width: 100%;
  padding: 0.3rem 0.2rem;
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 2;
  -moz-appearance: textfield;
}
.dt-edit::-webkit-outer-spin-button,
.dt-edit::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Small label below each drum */
.dt-col-lbl {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.55);
  text-align: center;
  margin-top: 0.2rem;
  line-height: 1;
}

/* Year: wider (4 digits) */
#spY .dt-val, #spY .dt-edit { min-width: 4ch; }
/* Month abbreviation: needs a bit more width */
#spMo .dt-val { min-width: 3ch; }

/* Separator dot / colon */
.dt-sep {
  color: rgba(255,255,255,0.25);
  font-size: 1.5rem;
  font-weight: 300;
  padding: 0 0.05rem;
  flex-shrink: 0;
  /* push sep up to align with numbers, compensating for the label below each col */
  margin-bottom: 1.1rem;
}

@media (max-width: 520px) {
  .dt-val    { font-size: 1.9rem; }
  .dt-edit   { font-size: 1.9rem; }
    .dt-col    { padding: 0.55rem 0.28rem 0.3rem; }
  .dt-sep    { font-size: 1.2rem; padding: 0 0.02rem; margin-bottom: 0.95rem; }
}

@media (max-width: 400px) {
  .dt-val    { font-size: 1.7rem; padding: 0.25rem 0.1rem; }
  .dt-edit   { font-size: 1.7rem; }
    .dt-col    { padding: 0.45rem 0.2rem 0.25rem; }
  .dt-sep    { font-size: 1.1rem; margin-bottom: 0.8rem; }
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .form-row-main {
    grid-template-columns: 1fr;
  }

  /* chart-summary unter Bodygraph + Tabellen */
  #results.visible {
    display: flex;
    flex-direction: column;
  }
  .results-grid  { order: 1; }
  .chart-summary { order: 2; }

  /* Normalansicht: Tabellen nehmen nur so viel Platz wie nötig, Bodygraph füllt den Rest */
  .results-grid {
    grid-template-columns: auto 1fr auto;
    gap: 0.4rem;
    align-items: stretch;
  }

  /* Beide Ansichten: thead + card-header ausblenden */
  .results-grid .chart-card thead              { display: none; }
  .results-grid .chart-card .chart-card-header { display: none; }

  /* Tabelle füllt die Karte (die durch den Grid auf Bodygraph-Höhe gestreckt wird) */
  .results-grid .chart-card table { height: 100%; }

  /* Design-Tabelle: roter Hintergrund, weiße Schrift */
  .results-grid .chart-card:first-child {
    background: #7d1c1c;
  }
  .results-grid .chart-card:first-child td,
  .results-grid .chart-card:first-child .planet-symbol {
    color: rgba(255,255,255,0.92);
  }
  .results-grid .chart-card:first-child .gate-dot {
    color: rgba(255,255,255,0.3);
  }
  .results-grid .chart-card:first-child tbody tr {
    border-bottom-color: rgba(255,255,255,0.08);
  }

  /* Personality-Tabelle: dunkler Hintergrund, weiße Schrift */
  .results-grid .chart-card:last-child {
    background: #1a1a2e;
  }
  .results-grid .chart-card:last-child td,
  .results-grid .chart-card:last-child .planet-symbol {
    color: rgba(255,255,255,0.92);
  }
  .results-grid .chart-card:last-child .gate-dot {
    color: rgba(255,255,255,0.3);
  }
  .results-grid .chart-card:last-child tbody tr {
    border-bottom-color: rgba(255,255,255,0.08);
  }

  /* Details-Ansicht: Bodygraph oben (volle Breite), Tabellen nebeneinander */
  .details-open .results-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .details-open .bodygraph-wrapper {
    grid-column: 1 / -1;
    order: -1;
    max-width: 280px;
    margin: 0 auto;
  }
}

@media (max-width: 820px) {
  header { padding: 0.9rem 1.25rem; }
  .header-auth-email { display: none; }
}

@media (max-width: 480px) {
  header { padding: 0.7rem 1rem; }
  main { padding: 1.25rem 1rem; }
  .card { padding: 1.25rem; }
  .chart-summary { padding: 0.75rem 1rem; }

  /* Beide Ansichten: kompakt */
  table { font-size: 0.72rem; }
  .planet-name   { display: none; }
  .retro         { display: none; }
  .julday        { display: none; }
  .planet-cell   { gap: 0; justify-content: center; }
  .planet-symbol { width: 1rem; height: 1rem; color: rgba(255,255,255,0.92); }
  .gate-cell     { gap: 0; }
  .gate-link     { padding: 0; }

  /* Normalansicht: sehr enge Zellen */
  #results:not(.details-open) tbody td { padding: 0.28rem 0.3rem; }

  /* Details-Ansicht: CTB sichtbar, Longitude + Mark-Cell weg, Gate kompakt */
  .details-open tbody td              { padding: 0.3rem 0.2rem; }
  .details-open .ctb                  { display: table-cell !important; letter-spacing: 0; }
  .details-open .lon-cell             { display: none !important; }
  .details-open .mark-cell            { display: none !important; }
  .details-open .gate-link            { padding: 0; }
  .details-open .gate-num             { font-size: 0.8rem; }
  .details-open .gate-dot             { margin: 0; }
  .details-open .gate-line            { font-size: 0.8rem; }
  .details-open th[data-i18n="th_planet"]        { font-size: 0; letter-spacing: 0; }
  .details-open th[data-i18n="th_planet"]::after { content: 'P'; font-size: 0.65rem; letter-spacing: 0.07em; }
  .details-open th[data-i18n="th_clr_tone_base"]        { font-size: 0; letter-spacing: 0; }
  .details-open th[data-i18n="th_clr_tone_base"]::after { content: 'C-T-B'; font-size: 0.65rem; letter-spacing: 0.07em; }

  .summary-profile-item { flex-basis: 100%; }
}
