:root {
  --bg: #090a0d;
  --panel: #12151b;
  --panel2: #181c24;
  --line: #2e3340;
  --text: #f4f0e8;
  --muted: #9da6b4;
  --gold: #d1ae63;
  --gold-glow: rgba(209, 174, 99, 0.25);
  --blue: #8ea6cf;
  --green: #4ade80;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 50% 0%, #1a202c 0%, #090a0d 50%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* Header & Brand */
header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 20px 20px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.brand-block {
  flex: 1;
}

.eyebrow {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 600;
}

h1 {
  margin: 6px 0 10px;
  font-size: clamp(30px, 5.5vw, 48px);
  letter-spacing: -0.01em;
  color: #fff;
}

.hero-quote {
  margin: 4px 0 6px;
  font-size: clamp(16px, 2.4vw, 20px);
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.hero-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  border: 1px solid #474d5b;
  border-radius: 999px;
  padding: 6px 14px;
  color: #d8dce4;
  background: #0d1015;
  font-size: 12px;
  white-space: nowrap;
}

.silent-mode-pill {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(209, 174, 99, 0.1);
}

/* Main Layout */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px 80px;
}

.panel {
  background: linear-gradient(180deg, rgba(20, 23, 30, 0.98), rgba(12, 14, 19, 0.98));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  margin: 18px 0;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.mode-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(209, 174, 99, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold);
}

h2 {
  margin: 0 0 10px;
  font-size: clamp(20px, 3.5vw, 26px);
  color: #f7f5f0;
}

h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: #e5e9f0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 10px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 6px;
  font-weight: 500;
}

/* Form Controls */
textarea, input, select {
  width: 100%;
  background: #080a0e;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(142, 166, 207, 0.2);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Buttons */
button {
  background: #1c212b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s;
}

button:hover:not(:disabled) {
  border-color: var(--gold);
  background: #242b38;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(135deg, #7a5e2a, #b38d47);
  border-color: #d1ae63;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(209, 174, 99, 0.25);
}

.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #8a6c32, #c49d52);
  border-color: #f0cb7b;
}

.cta-btn {
  width: 100%;
  font-size: 15px;
  padding: 13px 20px;
  margin-top: 12px;
}

.secondary-btn {
  width: 100%;
  background: #242934;
  margin-top: 12px;
}

/* Dual Mode Start Grid */
.start-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  margin: 18px 0;
}

.start-card {
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel2);
  display: flex;
  flex-direction: column;
}

.mode-silent-card {
  border-color: rgba(209, 174, 99, 0.45);
  background: linear-gradient(155deg, #1b202c, #10141c);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(209, 174, 99, 0.15);
}

.mode-tag {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.start-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.start-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 auto;
}

.start-card textarea {
  margin-top: 10px;
}

/* Rows and Groups */
.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row input {
  flex: 1;
}

.wrap {
  flex-wrap: wrap;
}

.between {
  justify-content: space-between;
  align-items: flex-start;
}

/* Card Presentation: text-black-v1 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.card {
  position: relative;
  background: #060709;
  border: 1px solid #3a3f4d;
  border-radius: 16px;
  padding: 20px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(209, 174, 99, 0.6);
  transform: translateY(-2px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.85;
}

.card .role {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
}

.card .layer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.card h3 {
  font-size: 24px;
  margin: 20px 0 6px;
  letter-spacing: 0.02em;
  color: #fff;
}

.card .person {
  color: #cfd4dc;
  font-size: 14px;
  min-height: 1.4em;
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.tag {
  font-size: 11px;
  border: 1px solid #3c424f;
  border-radius: 999px;
  padding: 3px 9px;
  color: #c7cbd2;
  background: rgba(255, 255, 255, 0.02);
}

.card p {
  font-size: 13.5px;
  line-height: 1.7;
  color: #dcd8cf;
  margin: 8px 0 18px;
}

.card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #1c1f26;
  text-align: right;
  color: #727986;
  font-size: 10px;
  letter-spacing: 0.22em;
}

.skin-text-black-v1.no-artwork {
  background: linear-gradient(155deg, #090a0e 0%, #030405 85%);
}

/* Reading & Interpretations */
.reading-block {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

.hero-reading {
  border-left: 4px solid var(--gold);
  background: linear-gradient(90deg, rgba(209, 174, 99, 0.08), var(--panel2));
}

.reading-highlight {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  margin: 0;
}

.preline {
  white-space: pre-line;
  line-height: 1.75;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

/* Collapsible Details */
details {
  background: #0d1015;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
}

summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 14px;
  font-weight: 500;
  user-select: none;
}

summary:hover {
  text-decoration: underline;
}

.advanced-box {
  background: rgba(13, 16, 21, 0.6);
  border: 1px solid #252a36;
}

.advanced-content {
  padding-top: 12px;
}

.role-row, .note-row {
  border-bottom: 1px solid #282c35;
  padding: 8px 0;
  font-size: 13.5px;
}

.role-row:last-child, .note-row:last-child {
  border-bottom: none;
}

/* Action Seeds & Reflection */
.seed-pill {
  display: inline-block;
  background: rgba(209, 174, 99, 0.12);
  border: 1px solid rgba(209, 174, 99, 0.4);
  border-radius: 8px;
  padding: 6px 12px;
  margin: 4px;
  font-size: 13px;
  color: #e8d7ad;
}

.reflection-q {
  background: rgba(142, 166, 207, 0.08);
  border-left: 3px solid var(--blue);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13.5px;
  color: #d1d9e6;
  border-radius: 0 6px 6px 0;
}

/* Divine Intervention */
.divine-card {
  margin-top: 14px;
  border-left: 4px solid var(--gold);
  padding: 14px 16px;
  background: #17140c;
  border-radius: 8px;
}

.silence {
  margin-top: 14px;
  color: #c5c9d0;
  font-style: italic;
  padding: 12px;
  background: #12141a;
  border-radius: 8px;
}

/* Share and History */
.share-box {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.share-cta {
  background: linear-gradient(135deg, #1b3d30, #2c5947);
  border-color: #438269;
  color: #d8f3e5;
  font-weight: 600;
}

.share-cta:hover:not(:disabled) {
  background: linear-gradient(135deg, #244d3d, #376f59);
  border-color: #5bb391;
}

.status-msg {
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
}

.import-export-row {
  margin-top: 12px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #06070a;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 10px;
  color: #c8ccd4;
  font-size: 12px;
}

/* Footer */
footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

.footer-sub {
  font-size: 11px;
  color: #646b77;
  margin-top: 4px;
}

/* Responsive Media Queries (Testing 1440, 1024, 768, 390) */
@media (max-width: 860px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  .start-grid {
    grid-template-columns: 1fr;
  }
  .grid2 {
    grid-template-columns: 1fr;
  }
  .between {
    flex-direction: column;
    gap: 12px;
  }
  .action-buttons {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .cards {
    grid-template-columns: 1fr;
  }
  .row:not(.wrap) {
    flex-direction: column;
    align-items: stretch;
  }
  .row input {
    width: 100%;
  }
  button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
