/* dream-rave.css */
*, *::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-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-btn {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.15s;
  flex-shrink: 0;
}
.back-btn:hover { color: white; }

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

.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); }

/* ── Layout ── */
main {
  max-width: 1100px;
  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;
}

/* ── Selector ── */
.dr-selector-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 400px;
}

.dr-group-select {
  font-size: 0.78rem;
  color: #888;
  padding: 0.3rem 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  background: white;
}

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: auto;
  -webkit-appearance: auto;
}
select:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74,111,165,0.14);
}

/* ── Status ── */
#drStatus {
  font-size: 0.85rem;
  color: #888;
  text-align: center;
  padding: 1rem 0;
  min-height: 1rem;
}

/* ── Main grid: table | bodygraph | table ── */
.dr-main-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.dr-bodygraph-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  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.75rem;
  min-width: 0;
  overflow: hidden;
}

#drBodygraph {
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

#drBodygraph svg {
  width: 100%;
  height: auto;
  display: block;
}

.dr-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: #888;
  flex-wrap: wrap;
  justify-content: center;
}
.dr-legend-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
}

.dr-table-col {
  display: flex;
  flex-direction: column;
  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.75rem 0.5rem 0.5rem;
  min-width: 130px;
}

.dr-table-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
}
.dr-p-color { color: #1a1a2e; }
.dr-d-color { color: #8b0000; }

/* ── Planet table ── */
.dr-planet-table-wrap { width: 100%; }

.dr-planet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.dr-planet-table th {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
  font-weight: 600;
  padding: 0.2rem 0.25rem;
  border-bottom: 1px solid #eee;
  text-align: center;
}

.dr-planet-table td {
  padding: 0.15rem 0.25rem;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
  text-align: center;
}

.dr-pt-planet { text-align: left !important; }
.dr-pt-sym { width: 1.2rem; height: 1.2rem; display: inline-flex; align-items: center; justify-content: center; }
.dr-pt-sym svg { display: block; }
.dr-pt-gate { font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; font-weight: 600; white-space: nowrap; }
.dr-pt-gate-p { color: #1a1a2e; }
.dr-pt-gate-d { color: #8b0000; }
.dr-pt-dot    { color: #bbb; }
.dr-pt-retro  { font-size: 0.65rem; color: #999; margin-left: 0.1rem; }

tr.dr-sleep-row-p { background: rgba(26,26,46,0.07); }
tr.dr-sleep-row-d { background: rgba(139,0,0,0.07); }

.ed-mark      { font-size: 0.65rem; font-weight: 700; margin-left: 0.1rem; }
.ed-exalted   { color: #2e7d32; }
.ed-detriment { color: #c75000; }

/* ── Info card ── */
.dr-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #ececec;
}
.dr-overview-item { text-align: center; }
.dr-overview-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  margin-bottom: 0.2rem;
}
.dr-overview-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1a1a1a;
}

.dr-section { margin-bottom: 1rem; }
.dr-section:last-child { margin-bottom: 0; }
.dr-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  margin-bottom: 0.4rem;
}
.dr-count {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  background: #f0f2f5;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.35rem;
  color: #555;
}

.dr-channel-chip {
  display: inline-block;
  font-size: 0.82rem;
  background: #f5f7fa;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  margin: 0.1rem;
  color: #555;
  cursor: pointer;
}
.dr-channel-chip:hover { background: #eaeef5; border-color: #4a6fa5; color: #1a1a2e; }

/* ── Section heading (Dream Rave / Normal Chart labels) ── */
.dr-section-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin-bottom: 0.75rem;
  margin-top: 0.25rem;
}

.dr-normal-bg-col { max-width: 400px; margin: 0 auto; }
#normalBodygraph { width: 100%; min-height: 0; overflow: hidden; }
#normalBodygraph svg { width: 100%; height: auto; display: block; }

/* ── Lock Overlay ── */
#lockOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(240,242,245,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lock-card {
  background: white;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  max-width: 420px;
  width: 90%;
}
.lock-icon  { font-size: 2.5rem; margin-bottom: 1rem; }
.lock-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; color: #1a1a2e; }
.lock-body  { font-size: 0.88rem; color: #555; margin-bottom: 1.5rem; line-height: 1.6; }
.lock-btn-sub {
  display: inline-block;
  background: #2e7d32;
  color: white;
  padding: 0.65rem 1.75rem;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
}
.lock-hint { margin-top: 0.85rem; font-size: 0.82rem; color: #aaa; }

/* ── Responsive ── */
@media (max-width: 900px) {
  header { padding: 0.9rem 1.25rem; }
  .header-auth-email { display: none; }
}

@media (max-width: 700px) {
  .dr-main-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dr-bodygraph-col { order: -1; grid-column: 1 / -1; }
  .dr-table-col { min-width: unset; }
  .dr-overview { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  header { padding: 0.7rem 1rem; }
  main   { padding: 1.25rem 1rem; }
  .card  { padding: 1.25rem; }
  .dr-overview { grid-template-columns: 1fr; }
}
