:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #60706b;
  --paper: #f7f4ef;
  --surface: #ffffff;
  --line: #d9ded8;
  --mint: #92d8c4;
  --green: #2f7d6d;
  --coral: #e9806e;
  --gold: #e7bb63;
  --blue: #5d8cc9;
  --shadow: 0 24px 70px rgba(30, 44, 39, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 8%, rgba(146, 216, 196, 0.36), transparent 26rem),
    linear-gradient(145deg, #f7f4ef 0%, #ecf6f0 44%, #f8ece8 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  margin: 14px 0 26px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 38px rgba(40, 54, 47, 0.1);
  backdrop-filter: blur(18px);
}

.brand,
.profile-chip,
.auth-actions,
.hero-actions,
.transport,
.panel-title,
.rating-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, var(--green), transparent 62%),
    conic-gradient(from 180deg, var(--mint), var(--gold), var(--coral), var(--blue), var(--mint));
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.62);
}

nav {
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

nav a:hover {
  color: var(--green);
}

.auth-actions,
.hero-actions,
.transport {
  gap: 10px;
}

.profile-chip {
  gap: 12px;
}

#profileInitials {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

#profileInitials:hover {
  opacity: 0.92;
}

.solid-button,
.ghost-button,
.icon-button,
.rating-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.solid-button {
  background: var(--ink);
  color: white;
  box-shadow: 0 12px 28px rgba(23, 32, 29, 0.18);
}

.ghost-button,
.icon-button,
.rating-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  margin: 0;
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
}

.text-button:hover {
  transform: none;
  text-decoration: none;
}

.solid-button:hover,
.ghost-button:hover,
.icon-button:hover,
.rating-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.62fr);
  align-items: center;
  min-height: 500px;
  gap: 44px;
  padding: 34px 0 46px;
}

.hero-copy {
  max-width: 710px;
}

.page-title {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: 4rem;
  line-height: 0.98;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: 4.85rem;
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 3.2rem;
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.hero-copy p:not(.eyebrow),
.section-heading p,
#trackSubtitle,
.form-footer p,
.auth-note {
  color: var(--muted);
  line-height: 1.65;
}

.sound-orbit {
  position: relative;
  width: min(38vw, 420px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.28)),
    radial-gradient(circle at 35% 32%, rgba(255, 255, 255, 0.95), transparent 28%),
    conic-gradient(from 120deg, rgba(146, 216, 196, 0.88), rgba(231, 187, 99, 0.86), rgba(233, 128, 110, 0.72), rgba(93, 140, 201, 0.78), rgba(146, 216, 196, 0.88));
  box-shadow: var(--shadow);
  animation: breathe 7s ease-in-out infinite;
}

.sound-orbit span,
.pulse-core {
  position: absolute;
  inset: 14%;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
}

.sound-orbit span:nth-child(2) {
  inset: 27%;
}

.sound-orbit span:nth-child(3) {
  inset: 40%;
}

.pulse-core {
  inset: 46%;
  border: 0;
  background: white;
  box-shadow: 0 0 42px rgba(255, 255, 255, 0.88);
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.985) rotate(-2deg);
  }
  50% {
    transform: scale(1.025) rotate(3deg);
  }
}

.workspace {
  margin: 28px 0;
  padding: 44px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 18px;
}

.feature-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: 1.04rem;
}

.feature-card p,
.compact-panel p,
.session-row small {
  color: var(--muted);
  line-height: 1.58;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.content-page {
  display: grid;
  gap: 30px;
  padding-bottom: 32px;
}

.policy-copy {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.policy-copy h2 {
  margin-top: 24px;
}

.policy-copy ul {
  padding-left: 1.3rem;
}

.policy-copy li {
  margin-bottom: 0.75rem;
}

.intake-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.intake-grid .span-3 {
  grid-column: 1 / -1;
}

fieldset,
.panel,
.player-panel,
.feedback-panel,
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
}

.intake-grid .span-3 {
  grid-column: 1 / -1;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.scale-help {
  margin: 0 0 12px;
  color: #5f6b67;
  font-size: 0.95rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 18px;
}

legend {
  padding: 0 8px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  color: #2f3c38;
  font-weight: 700;
}

label.checkbox-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin: 16px 0;
}

label.checkbox-field input[type="checkbox"] {
  width: auto;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd7d2;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

#sessionTitleInput {
  border-radius: 0;
  width: 100%;
  border: 0;
  border-bottom: 1.5px dotted rgba(47, 60, 56, 0.42);
  background: transparent;
  color: var(--ink);
  font-size: clamp(1.4rem, 2vw, 2rem);
  font-weight: 800;
  padding: 0 0 4px;
  margin: 0;
  outline: none;
  transition: border-color 180ms ease, opacity 180ms ease, background 180ms ease, border-radius 180ms ease;
}

#sessionTitleInput:focus {
  box-shadow: none;
  border-bottom-color: transparent;
  background: rgba(0, 0, 0, 0.04);
  transition: border-color 180ms ease, background 180ms ease, border-radius 180ms ease;
}

#sessionTitleInput:hover {
  transition: border-color 180ms ease, background 180ms ease, border-radius 180ms ease;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.04);
}

.session-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

#sessionTitleInput {
  flex: 1;
  min-width: 0;
}

#sessionTitleInput::placeholder {
  color: rgba(47, 60, 56, 0.42);
}

.session-title-success {
  opacity: 0;
  transform: translateX(8px);
  color: var(--green);
  font-size: 1.5rem;
  transition: opacity 220ms ease, transform 220ms ease;
}

.session-title-success.visible {
  opacity: 1;
  transform: translateX(0);
}

.improve-button {
  width: 150px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 125, 109, 0.12);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--green);
}

.range-readout,
.status-pill {
  display: inline-flex;
  width: max-content;
  align-items: center;
  border-radius: 999px;
  background: #eaf5f1;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 5px 10px;
}

.form-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 6px;
}

.studio-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel,
.player-panel,
.feedback-panel {
  padding: 20px;
}

.panel-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

pre {
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  color: #31423d;
  line-height: 1.58;
}

.player-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 28px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 245, 0.92));
  box-shadow: 0 28px 60px rgba(34, 48, 42, 0.12);
  /* Use a compact vertical size that fits the embedded iframe and text.
     Removed square aspect-ratio to avoid overly tall panels. */
  min-height: 420px;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.player-body {
  display: grid;
  gap: 18px;
  align-content: stretch;
}

.player-visualizer-shell {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(24, 36, 30, 0.98), rgba(26, 45, 38, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  min-height: 240px;
}

.player-visualizer-shell canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Ensure the iframe container reserves enough space for the embedded player. */
.player-iframe-shell {
  min-height: 360px;
  border-radius: 28px;
  overflow: hidden; /* clip the iframe corners */
  position: relative;
}

.player-placeholder {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.86);
}

.player-placeholder-card {
  width: min(100%, 520px);
  padding: 28px;
  border-radius: 28px;
  background: white;
  box-shadow: 0 24px 50px rgba(17, 34, 28, 0.08);
  text-align: center;
  border: 1px solid rgba(34, 48, 42, 0.08);
}

.player-placeholder-card h3 {
  margin: 14px 0 10px;
}

.player-placeholder-card p {
  margin: 0;
  color: var(--muted);
}

.timeNoticeDiv {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 18px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(146, 216, 196, 0.14);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.3;
  justify-content: center;
  animation: float-soft 6s ease-in-out infinite;
}

.timeNoticeLabel {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}


/* Round the iframe itself for browsers that render iframe backgrounds */
#playerIframe {
  border-radius: 28px;
  width: 100%;
  height: 100%;
  border: 0;
}

#playerIframe.hidden {
  display: none;
}

.history-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 245, 0.92));
  box-shadow: 0 28px 60px rgba(34, 48, 42, 0.12);
}

.history-list {
  display: grid;
  gap: 12px;
}

.version-item {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 20px;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.94);
  color: inherit;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.version-item:hover,
.version-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(47, 125, 109, 0.16);
}

.version-item.active {
  border-color: var(--green);
  background: rgba(146, 216, 196, 0.16);
}

.version-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.version-row strong {
  display: block;
  font-size: 1rem;
}

.version-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.version-item small {
  color: var(--muted);
  display: block;
}

.version-item .status-pill {
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eaf5f1;
  color: var(--green);
  border-radius: 999px;
  white-space: nowrap;
}

.progress-block {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.progress-block span {
  color: var(--muted);
  font-size: 0.92rem;
  min-width: 42px;
  text-align: center;
}

.progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(47, 125, 109, 0.12);
  cursor: pointer;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--gold), var(--coral));
  transition: width 120ms ease;
}

.transport-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.transport-row button {
  min-width: 90px;
  font-size: 0.95rem;
}

.transport-row .solid-button {
  min-width: 110px;
}

.transport-row .ghost-button {
  background: rgba(255, 255, 255, 0.92);
}

.player-panel .ghost-button:hover,
.player-panel .solid-button:hover {
  transform: translateY(-1px);
}

.feedback-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.rating-row {
  gap: 12px;
}

.rating-button.active {
  border-color: var(--green);
  background: #e5f5ef;
  color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 125, 109, 0.1);
}

.history {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.sessions-list {
  display: grid;
  gap: 12px;
}

.session-row-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 18px;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.session-row-wrapper:hover {
  border-color: rgba(47, 125, 109, 0.4);
  box-shadow: 0 16px 36px rgba(30, 44, 39, 0.1);
  transform: translateY(-1px);
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: 1;
}

.delete-session-button {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--coral);
  border-color: var(--coral);
}

.delete-session-button:hover {
  background: rgba(233, 128, 110, 0.08);
  border-color: var(--coral);
}

.session-row span:first-child {
  display: grid;
  gap: 5px;
}

.page-actions {
  margin-top: 22px;
}

.compact-panel {
  max-width: 760px;
}

.form-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 10px;
  margin-bottom: 10px;
}

.form-message[data-tone="error"] {
  color: #b54d40;
}

.muted-link {
  opacity: 0.72;
}

.history-item {
  padding: 16px;
  animation: riseIn 260ms ease both;
}

.history-item p {
  margin-bottom: 6px;
  color: var(--muted);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

dialog {
  width: min(440px, calc(100% - 30px));
  border: 0;
  border-radius: 22px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(23, 32, 29, 0.36);
  backdrop-filter: blur(8px);
}

.auth-card {
  position: relative;
  padding: 28px;
  background: var(--surface);
}

label.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 24px;
  padding-right: 12px;
  flex-wrap: nowrap;
}

label.checkbox-field .checkbox-copy {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.925rem;
}

label.checkbox-field a {
  color: var(--green);
}

label.checkbox-field a:hover {
  text-decoration: underline;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

.hidden {
  display: none;
}

.site-footer {
  margin: 32px auto 18px;
  padding: 24px 22px;
  border-top: 1px solid rgba(47, 125, 109, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
}

.footer-section {
  flex: 1 1 200px;
  min-width: 160px;
}

.footer-brand {
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--ink);
}

.footer-heading {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: flex-start;
}

.footer-nav a {
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-nav a:hover {
  color: var(--ink);
}

.footer-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  .footer-inner {
    gap: 16px;
  }

  .footer-section {
    min-width: 100%;
  }

  .footer-nav {
    gap: 8px 14px;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .hero,
  .studio-layout,
  .intake-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 4.1rem;
  }

  .page-title {
    font-size: 3rem;
  }

  h2 {
    font-size: 2.65rem;
  }

  .sound-orbit {
    width: min(76vw, 360px);
  }

  .workspace {
    padding: 28px 18px;
  }

  .form-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar {
    top: 8px;
    border-radius: 18px;
  }

  .auth-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .hero {
    min-height: auto;
    padding-top: 32px;
  }

  h1 {
    font-size: 3.15rem;
    line-height: 1;
  }

  h2 {
    font-size: 2.25rem;
  }

  .hero-actions,
  .transport,
  .rating-row {
    align-items: stretch;
    flex-direction: column;
  }

  .session-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .solid-button,
  .ghost-button,
  .icon-button,
  .rating-button {
    width: 100%;
  }
}
