:root {
  --ink: #1f1b16;
  --ink-soft: #3b332c;
  --accent: #1f3a2d;
  --glass: rgba(255,255,255,.8);
  --stroke: rgba(31,27,22,.12);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: #e3d3bd; }
body {
  margin: 0; min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto;
  font-family: "Sora", sans-serif; font-size: 14px; color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #f4ede2 0%, #e3d3bd 45%, #bfa98b 100%);
}
.top-links { padding: max(10px, env(safe-area-inset-top)) 18px 6px; font-size: 12px; }
.top-links a { color: inherit; text-decoration: none; font-weight: 600; }
.page { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 8px 14px; }
.app-card {
  width: min(390px, 100%); padding: 18px; text-align: center;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 22px;
  box-shadow: 0 16px 40px rgba(31,27,22,.16);
  display: grid; justify-items: center; gap: 10px;
}
.brand-kicker { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); }
.logo-button { border: 0; background: transparent; padding: 0; cursor: pointer; line-height: 0; }
.logo-button img { width: 80px; height: auto; display: block; }
.tagline { font: 14px/1.3 "Fraunces", serif; color: var(--ink-soft); margin: 0 0 2px; }
.visualizer { width: 100%; margin: 0; padding: 10px 12px; border-radius: 14px; background: #182c22; color: #f9f5ee; text-align: left; }
.visualizer-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; }
#visualizer-toggle { min-height: 32px; padding: 5px 8px; border: 1px solid #718275; border-radius: 7px; color: inherit; background: transparent; cursor: pointer; font: inherit; }
#visualizer { display: block; width: 100%; height: 62px; margin-top: 4px; }
#visualizer[hidden] { display: none; }
#audio-status { margin: 6px 0 0; font-size: 10px; line-height: 1.4; color: #d7dfd7; }
.mode-card { width: 100%; text-align: left; background: rgba(255,255,255,.6); border: 1px solid var(--stroke); border-radius: 14px; padding: 10px 12px; }
.card-title { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
select { width: 100%; min-width: 0; min-height: 40px; padding: 8px; border: 1px solid var(--stroke); border-radius: 9px; background: #faf8f4; color: var(--ink); font: 600 14px "Sora", sans-serif; cursor: pointer; }
.now-playing { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.now-label { text-transform: uppercase; font-size: 9px; letter-spacing: .08em; }
.now-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .4; }
.is-playing .now-dot { opacity: 1; }
.controls { display: flex; justify-content: center; gap: 10px; margin: 0; }
.control-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 104px; padding: 8px 14px; border: 1px solid var(--stroke); border-radius: 11px; cursor: pointer; font: 600 12px "Sora", sans-serif; }
.control-button img { width: 24px; height: 24px; object-fit: contain; }
.control-button.primary { background: var(--accent); color: white; }
.control-button.secondary { background: #f9f5ee; color: var(--ink); }
.control-button.secondary img { filter: brightness(.25); }
.hidden { display: none; }
.studybud-brainsync-link { justify-self: center; margin: 6px 64px max(12px, env(safe-area-inset-bottom)); min-height: 36px; display: flex; align-items: center; padding: 8px 16px; border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255,255,255,.65); color: var(--ink); text-decoration: none; font-size: 12px; font-weight: 600; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #6d8b68; outline-offset: 3px; }
#visualizer-toggle:focus-visible { outline-color: #d5b67b; }
@media (max-height: 680px) {
  .app-card { padding: 12px; gap: 7px; }
  .logo-button img { width: 56px; }
  .tagline { font-size: 12px; }
  #visualizer { height: 42px; }
  .visualizer, .mode-card { padding: 8px 10px; }
  .page { padding-top: 4px; padding-bottom: 4px; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .app-card { width: min(650px, 100%); grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); column-gap: 18px; }
  .brand-kicker { grid-column: 1; grid-row: 1; }
  .logo-button { grid-column: 1; grid-row: 2 / 4; }
  .tagline { grid-column: 1; grid-row: 4; }
  .visualizer { grid-column: 2; grid-row: 1 / 4; }
  .mode-card { grid-column: 2; grid-row: 4 / 7; }
  .now-playing { grid-column: 1; grid-row: 5; }
  .controls { grid-column: 1; grid-row: 6; gap: 6px; }
  .control-button { min-width: 84px; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media (max-height: 360px) and (min-width: 600px) {
  .top-links { padding-top: 6px; padding-bottom: 2px; }
  .app-card { gap: 4px 14px; padding: 8px 12px; }
  .logo-button img { width: 42px; }
  .tagline { font-size: 11px; }
  #visualizer { height: 32px; }
  .studybud-brainsync-link { margin-top: 2px; margin-bottom: 6px; min-height: 32px; padding: 6px 12px; }
}

/* Keep the complete interface at 90% of its previous visual size. */
.app-card { transform: scale(.9); transform-origin: center; }
.top-links a { display: inline-block; transform: scale(.9); transform-origin: left center; }
a.studybud-brainsync-link {
  transform: scale(.9); transform-origin: center;
  display: inline-flex; justify-content: center; align-items: center;
  min-width: 104px; line-height: 1.2; white-space: nowrap;
  border: 1px solid #b8aa95; border-radius: 10px;
  background: #f9f5ee; color: #1f1b16;
  box-shadow: 0 3px 8px rgba(31,27,22,.1);
  text-decoration: none; cursor: pointer;
}
a.studybud-brainsync-link:hover { background: #fffdf8; border-color: #81745f; }
