:root {
  color-scheme: light;
  --bg: #f2e9da;
  --surface: #fffaf1;
  --ink: #23291f;
  --muted: #58584b;
  --line: #ded3c0;
  --accent: #354d37;
  --accent-ink: #fffaf0;
  --soft-green: #e7ebdc;
  --radius: 22px;
  --player-height: 92px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding: 16px 0 calc(var(--player-height) + 24px); }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid #827140; outline-offset: 4px;
}
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.07; letter-spacing: -.042em; }
p { line-height: 1.5; color: var(--muted); }
.brand { display: flex; align-items: center; gap: .68rem; font-weight: 780; letter-spacing: -.04em; text-decoration: none; line-height: 1.1; }
.brand-mark {
  display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-content: center;
  border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 22px;
}
.outline, .primary {
  display: inline-flex; gap: .55rem; align-items: center; justify-content: center; border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px; background: transparent; color: var(--ink); line-height: 1.2;
  text-decoration: none; font-weight: 680;
}
.outline:not(:disabled):hover { background: #f2e9d8; }
.primary { padding: 11px 17px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:not(:disabled):hover { background: #263d2b; }
label { display: grid; gap: 6px; color: var(--ink); font-size: .88rem; font-weight: 670; }
label span { color: var(--muted); font-weight: 450; }
input:not([type=checkbox], [type=range]), textarea, select {
  color: var(--ink); background: #faf4e9; width: 100%; padding: 11px 12px;
  border-radius: 10px; border: 1px solid #c9bba3;
}
input::placeholder, textarea::placeholder { color: #71695a; }
textarea { resize: vertical; }
select { width: fit-content; max-width: 100%; }
.lyrics { white-space: pre-wrap; overflow-wrap: anywhere; }
dialog {
  width: min(calc(100% - 28px), 515px); padding: 28px; border: 1px solid #a99679;
  border-radius: 18px; background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: #292b2090; }
dialog h2 { padding-right: 45px; font-size: 2rem; margin-bottom: 14px; }
dialog form, .provider-list { display: grid; gap: 12px; margin-block: 12px; }
dialog form button { justify-self: start; }
.close { position: absolute; right: 12px; top: 12px; padding: 6px 11px; }
.check { display: flex; align-items: start; }
.check input { accent-color: var(--accent); flex: 0 0 auto; margin: .25em .35em 0 0; }
.locale-selector { position: relative; font-size: .85rem; }
.locale-selector summary { white-space: nowrap; font-weight: 640; }
.locale-selector div {
  position: absolute; z-index: 4; inset-inline-end: 0; top: calc(100% + .55rem); min-width: max-content;
  padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 9px 24px #38362216;
}
.locale-selector a { display: block; padding: .55rem .65rem; border-radius: 7px; text-decoration: none; }
.locale-selector a[aria-current], .locale-selector a:hover { background: var(--soft-green); color: var(--accent); }

.music-app { min-height: 100vh; background: radial-gradient(ellipse at 68% 0, #fcf7ed 0, transparent 70%); }
.app-shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 18px; max-width: 1560px; margin-inline: auto; padding: 17px 18px calc(var(--player-height) + 36px); }
.rail {
  position: sticky; top: 17px; display: flex; flex-direction: column; align-self: start;
  min-height: calc(100vh - var(--player-height) - 48px); padding: 20px 13px;
  border: 1px solid #e6ddcd; border-radius: var(--radius); background: #faf5ea;
}
.rail .brand { margin: 0 3px 28px; font-size: 1rem; }
.app-nav { display: grid; gap: 5px; }
.app-nav a {
  display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 8px 11px;
  border-radius: 12px; color: #494a3d; font-size: .87rem; font-weight: 680; text-decoration: none;
}
.app-nav a:hover { background: #f0eadd; }
.app-nav a[aria-current] { background: #e3e9d9; color: #293d2a; }
.nav-icon { position: relative; flex: 0 0 22px; display: grid; height: 22px; place-items: center; font-size: 21px; line-height: 1; }
.icon-home::before { content: ''; width: 11px; height: 9px; margin-top: 6px; border: 1.6px solid currentColor; border-top: 0; border-radius: 0 0 2px 2px; }
.icon-home::after { content: ''; position: absolute; top: 4px; width: 11px; height: 11px; border: 1.6px solid currentColor; border-right: 0; border-bottom: 0; transform: rotate(45deg); }
.icon-library::before { content: ''; width: 15px; height: 14px; border: solid currentColor; border-width: 0 1.6px; background: linear-gradient(90deg, transparent 47%, currentColor 47% 60%, transparent 60%); }
.icon-notes::before { content: ''; position: absolute; inset: 2px; border: 1px solid currentColor; border-radius: 50%; }
.icon-notes { font-size: 14px; }
.rail-create {
  margin-top: 25px; padding: 11px 6px; border-top: 1px solid var(--line); color: var(--accent);
  font-weight: 720; font-size: .86rem; text-decoration: none;
}
.rail-create:hover, .app-footer a:hover { text-decoration: underline; }
.workspace-bar { position: relative; display: flex; min-height: 62px; align-items: start; gap: 12px; padding-block: 5px 12px; }
.workspace-actions { display: flex; align-items: center; justify-content: flex-end; gap: 13px; margin-inline-start: auto; flex: 0 0 auto; }
.workspace-actions .outline { font-size: .82rem; padding: 8px 13px; }
.notice { color: #42523d; font-size: .78rem; padding: 7px 10px; background: #e9ebdd; border-radius: 10px; max-width: 47ch; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, .47fr); gap: 17px; align-items: start; }
.views, .studio { min-width: 0; }
.app-view { scroll-margin-top: 15px; }
.view-title { margin: 6px 0 18px; font-size: clamp(2.1rem, 3.8vw, 3.7rem); overflow-wrap: anywhere; }

.hero {
  position: relative; isolation: isolate; display: flex; align-items: center; min-height: clamp(350px, 31vw, 460px);
  border: 1px solid #e6d6ba; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(ellipse at 78% 53%, #fff8df 2%, #f5e3bf 53%, transparent 77%), linear-gradient(128deg, #fcf3df, #eedab3);
}
.hero::before {
  content: ''; position: absolute; z-index: -1; inset: 0;
  background: radial-gradient(circle at 8% 12%, #fff9ec 0 2px, transparent 3px),
    radial-gradient(circle at 58% 13%, #fffcf0 0 3px, transparent 4px),
    radial-gradient(circle at 91% 18%, #fff9ec 0 2px, transparent 3px),
    radial-gradient(circle at 61% 85%, #fdf2d9 0 2px, transparent 3px),
    radial-gradient(circle at 28% 87%, #fff9eb 0 2px, transparent 3px);
}
.hero-copy { position: relative; z-index: 1; width: 58%; padding: clamp(21px, 3vw, 46px); padding-inline-end: 0; }
.hero h1 { font-family: Georgia, 'Times New Roman', serif; font-weight: 500; font-size: clamp(2.55rem, 4.05vw, 4.45rem); line-height: .96; }
.hero h1 { overflow-wrap: break-word; hyphens: auto; }
.hero h1 em { font-weight: inherit; color: var(--accent); }
.hero p { max-width: 30ch; margin-block: 19px 22px; font-size: clamp(.88rem, 1.1vw, 1.03rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hero-art {
  position: absolute; inset: 0 0 0 auto; display: grid; place-items: center; width: 44%;
  perspective: 900px;
}
.hero-art::before {
  content: ''; position: absolute; inset: auto 8% 12% 1%; height: 13%; border-radius: 50%;
  background: #7d54184a; filter: blur(21px);
}
.hero-art img { position: relative; width: 105%; height: auto; max-width: 510px; margin-inline-start: -2%; transform-origin: 50% 62%; pointer-events: none; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .hero-art img { transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)); transition: transform 190ms ease-out; }
}

.featured { padding-top: 21px; }
.section-title h2, .studio-card h2 { font-size: clamp(1.05rem, 1.5vw, 1.32rem); }
.featured .section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.featured .section-title a { font-size: .82rem; color: var(--accent); font-weight: 700; }
.sample-cover { aspect-ratio: 1; background: #e5d4ae url('https://masakra207.github.io/koledownik/scena-zimowa.jpg') center / cover no-repeat; }
.track-row {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 10px;
  border: 1px solid #e5dac8; border-radius: 15px; background: var(--surface);
}
.track-row .sample-cover { width: 54px; border-radius: 9px; }
.track-info { min-width: 0; display: grid; gap: 4px; line-height: 1.2; }
.track-info strong, .track-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-info span { font-size: .77rem; color: var(--muted); }
.track-play {
  display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px;
  padding: 0; border: 0; border-radius: 50%; color: #fff8e9; background: var(--accent);
}
.track-play:not(:disabled):hover { background: #25412d; }
.play-icon { display: block; width: 0; height: 0; margin-left: 2px; border: 6px solid transparent; border-right: 0; border-left: 10px solid currentColor; }
.is-playing .play-icon { width: 10px; height: 12px; margin: 0; border: solid currentColor; border-width: 0 3px; }
.album {
  display: grid; grid-template-columns: minmax(100px, 190px) minmax(0, 1fr); gap: 22px; align-items: center;
  padding: clamp(16px, 3vw, 35px); border: 1px solid var(--line); border-radius: var(--radius); background: #f5e6ca;
}
.album .sample-cover { width: 100%; border-radius: 13px; }
.album h1 { font-size: clamp(1.45rem, 3.3vw, 3.3rem); }
.album p { margin-block: 10px 15px; }
.app-footer { margin-top: 24px; padding: 12px 0; font-size: .78rem; color: var(--muted); }
.app-footer div { display: flex; flex-wrap: wrap; gap: 8px 15px; }

.studio { display: grid; gap: 14px; }
.studio-card {
  min-width: 0; padding: 17px; border: 1px solid #e5dbca; border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 8px 25px #3d331a0a;
}
.composer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.composer-head p { font-size: .82rem; margin-top: 4px; }
.composer-mark {
  display: grid; flex: 0 0 37px; width: 37px; height: 37px; place-items: center;
  border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: 21px;
}
.panel-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; margin-bottom: 12px; }
.panel-top p { overflow-wrap: anywhere; font-size: .76rem; }
.balance { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 12px; background: var(--soft-green); color: var(--accent); font-size: .74rem; font-weight: 650; }
.balance span:first-child { font-size: 1.08rem; font-weight: 800; }
.studio-form, .draft { display: grid; gap: 12px; }
.studio-form button, .draft button { justify-self: start; font-size: .82rem; }
.studio-form label, .draft label { min-width: 0; }
.song-options { padding: 7px 0; }
.song-options summary, .orders summary { color: var(--accent); font-size: .84rem; font-weight: 700; }
.song-options label { margin-top: 10px; }
.brief-hint, #generator-unavailable, #song-status, #buy-notes, .feedback, .composer-offer { font-size: .83rem; }
#buy-notes, .feedback, #draft-result { padding: 9px 11px; border-radius: 9px; background: var(--soft-green); }
#buy-notes a, .composer-offer a { font-weight: 730; }
#generator-unavailable, .feedback { margin-bottom: 12px; }
#draft-result { font-size: .86rem; }
.composer-offer { margin-top: 12px; }
#logout { margin-top: 12px; font-size: .78rem; }
.inspirations { display: grid; gap: 3px; }
.inspirations h2 { margin-bottom: 6px; }
.inspirations button {
  display: grid; grid-template-columns: 33px minmax(0, 1fr) 16px; align-items: center; gap: 9px; text-align: start;
  padding: 5px 0; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: .81rem;
}
.inspirations button:hover { background: #f5eddf; }
.idea-icon { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; background: #e6ecdc; color: #304733; font-size: 1.05rem; }
[data-inspiration="first"] .idea-icon { background: #f5e4bd; color: #6a4b20; }
[data-inspiration="trip"] .idea-icon { background: #f1dfd4; color: #703b2c; }

.pricing .section-title { margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.card { display: flex; flex-direction: column; min-width: 0; padding: 17px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.card.is-main { border-color: #839276; background: #f0f3e7; }
.card h3 { font-size: 1.04rem; }
.card strong { font-size: clamp(1.32rem, 2.4vw, 2.2rem); letter-spacing: -.045em; margin-top: 10px; }
.card p { margin: .2rem 0 1rem; font-size: .82rem; }
.card button { margin-top: auto; font-size: .8rem; }
.library { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); overflow: hidden; }
.library > p { padding: 14px; }
#library-gate .outline { margin: 0 14px 14px; }
.song-list { padding: 0; margin: 0; list-style: none; }
.song-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 12px; align-items: start; }
.song-item + .song-item { border-top: 1px solid var(--line); }
.song-item .track-play { width: 36px; height: 36px; }
.song-item > span { grid-column: 1 / -1; overflow-wrap: anywhere; }
.song-item summary { padding-block: .42rem; font-weight: 700; overflow-wrap: anywhere; }
.song-item p, .song-item button, .song-item img { margin-top: 8px; }
.song-item .track-play { margin-top: 0; }
.song-item img { display: block; width: min(165px, 100%); border-radius: 10px; }
.song-item details .outline { margin: 8px 6px 0 0; font-size: .83rem; }
.orders { margin-top: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.orders p, .orders li { margin-top: 8px; overflow-wrap: anywhere; }
.orders .outline { margin-left: 6px; font-size: .83rem; }

.now-playing {
  position: fixed; z-index: 5; inset: auto 0 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(185px, 450px) minmax(0, 1fr);
  align-items: center; gap: 12px; min-height: var(--player-height); padding: 8px 24px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid #48614b; background: #243a2a; color: #fff8e8; box-shadow: 0 -4px 24px #322c1e19;
}
.player-track { display: flex; gap: 11px; align-items: center; }
.player-track img { width: 50px; height: 50px; object-fit: cover; border-radius: 9px; }
.now-playing .track-info span { color: #e6ddcb; }
.player-transport { display: grid; gap: 2px; justify-items: center; }
.transport-buttons, .player-progress { display: flex; align-items: center; justify-content: center; gap: 10px; }
.transport-buttons button:not(.track-play), .player-extra button {
  position: relative; width: 40px; height: 38px; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 50%;
}
.transport-buttons button:not(.track-play) > span { font-size: 22px; }
.transport-buttons small { font-size: .59rem; }
.now-playing .track-play { color: #253a2a; background: #f7e9c9; }
.now-playing .track-play:not(:disabled):hover { background: #fff6e3; }
.now-playing button:not(.track-play):not(:disabled):hover { background: #3d5341; }
.now-playing :focus-visible { outline-color: #f4d791; }
.player-progress { width: 100%; font-size: .7rem; font-variant-numeric: tabular-nums; color: #e7e1d3; }
.player-progress input { flex: 1; width: 100%; min-width: 0; height: 23px; margin: 0; cursor: pointer; accent-color: #f9d99a; }
.player-extra { justify-self: end; }
.speaker-icon { display: inline-block; width: 16px; height: 15px; background: currentColor; clip-path: polygon(0 33%, 28% 33%, 68% 0, 68% 100%, 28% 67%, 0 67%); }
.player-extra [aria-pressed="true"]::after { content: '×'; position: absolute; top: 9px; right: 9px; }
#player-error { position: absolute; bottom: calc(100% + 6px); left: 14px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: .82rem; }

.shell { width: min(1196px, calc(100% - 36px)); margin-inline: auto; }
.top, footer, nav { display: flex; align-items: center; }
.top { justify-content: space-between; min-height: 75px; border-bottom: 1px solid var(--line); gap: 14px; }
nav { gap: 15px; }
footer { justify-content: space-between; gap: 10px; padding-block: 18px; }
.policy { max-width: 745px; padding: 35px 0 56px; }
.policy h1 { font-size: clamp(2.2rem, 6vw, 4rem); margin-bottom: 20px; }
.policy h2 { font-size: clamp(1.2rem, 3.2vw, 2.05rem); margin-top: 26px; }
.policy p { max-width: 68ch; margin-top: .5rem; }

@media (max-width: 1160px) and (min-width: 821px) {
  .app-shell { grid-template-columns: 143px minmax(0, 1fr); gap: 12px; padding-inline: 12px; }
  .rail { padding-inline: 8px; }
  .rail .brand { font-size: .86rem; }
  .rail .brand-mark { flex-basis: 30px; width: 30px; height: 30px; border-radius: 9px; }
  .app-nav a { gap: 7px; padding-inline: 7px; font-size: .8rem; }
  .workspace-grid { gap: 12px; }
  .hero-copy { width: 62%; }
}
@media (max-width: 950px) and (min-width: 821px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr) minmax(236px, .6fr); }
  .hero { display: block; min-height: 0; }
  .hero-copy { width: 100%; padding: 17px; }
  .hero h1 { font-size: 2.65rem; }
  .hero-art { position: relative; width: min(100%, 295px); margin: -20px 0 -5px auto; }
  .hero-art img { width: 100%; margin: 0; }
}
@media (max-width: 820px) {
  :root { --player-height: 130px; }
  .app-shell { display: block; padding: 13px 13px calc(var(--player-height) + 20px + env(safe-area-inset-bottom)); }
  .rail { position: static; display: contents; min-height: 0; }
  .rail .brand { width: fit-content; max-width: 65%; margin: 0 0 11px; }
  .rail-create { display: none; }
  .app-nav {
    position: fixed; z-index: 7; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    inset: auto 0 0; min-height: calc(58px + env(safe-area-inset-bottom)); gap: 2px; padding: 3px 9px env(safe-area-inset-bottom);
    background: #fcf6eb; border-top: 1px solid var(--line);
  }
  .app-nav a { display: grid; justify-items: center; align-content: center; gap: 2px; padding: 3px; text-align: center; font-size: clamp(.65rem, 2.3vw, .78rem); }
  .workspace-bar { min-height: 0; padding-top: 0; align-items: center; }
  .notice { margin: 0; }
  .workspace-actions { gap: 8px; }
  .workspace-actions .outline { padding: 6px 8px; font-size: .72rem; }
  .locale-selector { font-size: .74rem; }
  .workspace-grid { display: flex; flex-direction: column; gap: 16px; }
  .workspace-grid > * { width: 100%; }
  .views { display: contents; }
  .app-footer { order: 2; margin-top: 0; padding-block: 6px; }
  .hero { min-height: 334px; }
  .hero h1 { font-size: clamp(2.45rem, 7vw, 3.8rem); }
  .hero-copy { padding: 20px; padding-inline-end: 0; }
  .now-playing {
    bottom: calc(58px + env(safe-area-inset-bottom)); min-height: 68px;
    grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 7px 11px 2px;
  }
  .player-track { height: 38px; }
  .player-track img { width: 37px; height: 37px; }
  .player-track strong { font-size: .83rem; }
  .player-track span { font-size: .68rem; }
  .player-transport { display: contents; }
  .transport-buttons { grid-column: 2; grid-row: 1; }
  .transport-buttons button:not(.track-play), .player-extra { display: none; }
  .transport-buttons .track-play { width: 37px; height: 37px; }
  .player-progress { grid-column: 1 / -1; grid-row: 2; gap: 6px; }
  .player-progress input { height: 16px; }
}
@media (max-width: 520px) {
  .workspace-bar { flex-wrap: wrap-reverse; gap: 6px; }
  .notice { max-width: none; width: 100%; padding-block: 5px; }
  .hero { align-items: start; min-height: 0; display: grid; }
  .hero-copy { width: 100%; padding: 18px 17px 0; }
  .hero p { margin-block: 10px 12px; }
  .hero-art { position: relative; justify-self: end; width: min(68%, 290px); margin: -19px 4px -3px 0; }
  .hero-art img { width: 100%; margin: 0; }
  .hero .primary { font-size: .82rem; }
  .featured { padding-top: 12px; }
  .studio-card { padding: 13px; }
  .album { grid-template-columns: 1fr; }
  .album .sample-cover { max-width: 190px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
