:root { color-scheme: light; --paper: #f3eddf; --ink: #292d29; --muted: #666c5f; --accent: #713c2f; --line: #c6bca8; --surface: #eae2d2; --field: #faf6ec; --presence: #eae4d8; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'Palatino Linotype', 'Book Antiqua', Georgia, serif; }
main { width: 100%; height: 100dvh; min-height: 640px; padding: 18px 28px 12px; display: flex; flex-direction: column; gap: 18px; }
header, footer { display: flex; justify-content: space-between; flex: 0 0 auto; font: 10px/1.6 'Trebuchet MS', sans-serif; letter-spacing: .16em; }
header { border-top: 3px solid var(--ink); border-bottom: 1px solid var(--line); padding: 8px 0; }
.introduction { display: grid; grid-template-columns: minmax(300px, 1.1fr) minmax(250px, 1fr) auto; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); padding-bottom: 18px; flex: 0 0 auto; }
.intro-persona { min-width: 0; }
.eyebrow { font: 10px 'Trebuchet MS', sans-serif; letter-spacing: .22em; color: var(--accent); margin: 0 0 10px; }
h1 { font-size: clamp(38px, 3.8vw, 66px); font-weight: 400; letter-spacing: -.055em; line-height: 1.02; margin: 0; }
h1 em { color: var(--accent); font-weight: 400; }
.subtitle { font-size: 17px; margin: 10px 0 6px; }
.disclosure { margin: 0; font: 10px/1.5 'Trebuchet MS', sans-serif; color: var(--muted); }
.voice { display: flex; align-items: center; gap: 10px; font: 10px/1.5 'Trebuchet MS', sans-serif; }
.voice span { color: var(--muted); }
.voice .disc { width: 32px; height: 32px; border: 1px solid var(--muted); border-radius: 50%; display: grid; place-items: center; font: 18px Georgia, serif; color: var(--accent); }
.workspace { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: minmax(280px, .9fr) minmax(400px, 1.8fr) minmax(230px, .75fr); gap: 24px; }
.workspace > section { min-width: 0; min-height: 0; }
.workspace-tabs { display: none; }
.conversation { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; border-inline: 1px solid var(--line); padding: 0 24px; }
.conversation-heading { display: flex; flex-wrap: wrap; flex: 0 0 auto; gap: 8px; justify-content: space-between; font: 12px/1.5 'Trebuchet MS', sans-serif; letter-spacing: .12em; padding: 5px 0 14px; border-bottom: 1px solid var(--line); }
#status { letter-spacing: .02em; color: var(--accent); }
#messages { flex: 1 1 0; min-height: 0; overflow-y: auto; padding-right: 12px; scrollbar-width: thin; overscroll-behavior: contain; }
.message { margin: 24px 0; }
.message small { display: block; color: var(--muted); letter-spacing: .1em; font: 10px 'Trebuchet MS', sans-serif; }
.message-heading { display: flex; align-items: center; gap: 12px; min-height: 36px; margin-bottom: 6px; }
.message p { font-size: 18px; line-height: 1.7; max-width: 75ch; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { border-left: 2px solid var(--accent); padding-left: 15px; }
button { font: 13px 'Trebuchet MS', sans-serif; cursor: pointer; border: 1px solid var(--accent); padding: 12px 16px; color: var(--paper); background: var(--accent); }
button:hover { background: #542e25; }
button:disabled { opacity: .5; cursor: wait; }
.speak-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 8px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--accent); flex: 0 0 auto; }
.speak-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.speak-button:hover, .speak-button[aria-pressed="true"] { background: var(--accent); color: var(--paper); }
.message.speaking small { color: var(--accent); }
.presence { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--muted); background: var(--presence); border-radius: 8px; font: 12px 'Trebuchet MS', sans-serif; min-width: 0; }
.state-orb { display: grid; place-items: center; position: relative; width: 44px; height: 44px; background: #f5f0e6; border-radius: 6px; flex: 0 0 auto; }
.state-mic { display: none; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.presence[data-state="idle"] .state-mic { display: block; }
.presence[data-state="idle"] .speech-bars { display: none; }
.state-copy { display: grid; gap: 7px; }
.state-copy strong { font-size: 16px; font-weight: 600; color: var(--ink); }
.state-copy > span { font-size: 11px; line-height: 1.5; }
.presence[data-state="thinking"], .presence[data-state="transcribing"] { color: #926b27; }
.presence[data-state="synthesizing"] { color: #a25b34; }
.presence[data-state="listening"] { color: #35625b; background: #e3eae2; }
.presence[data-state="music"] { color: #5b683b; }
.thinking-dots, .music-note { display: none; }
.thinking-dots, .activity-dots { align-items: center; gap: 5px; }
.thinking-dots i, .activity-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: thinking 1s infinite ease-in-out; }
.thinking-dots i:nth-child(2), .activity-dots i:nth-child(2) { animation-delay: 150ms; }
.thinking-dots i:nth-child(3), .activity-dots i:nth-child(3) { animation-delay: 300ms; }
.presence[data-state="thinking"] .thinking-dots, .presence[data-state="transcribing"] .thinking-dots { display: flex; }
.presence[data-state="thinking"] .speech-bars, .presence[data-state="transcribing"] .speech-bars, .presence[data-state="music"] .speech-bars { display: none; }
.presence[data-state="music"] .music-note { display: block; font: 34px Georgia, serif; }
.presence[data-state="synthesizing"] .speech-bars i, .presence[data-state="listening"] .speech-bars i { animation: voice-wave 900ms var(--wave-delay, 0ms) ease-in-out infinite alternate; }
.activity { display: flex; align-items: center; gap: 14px; margin: 16px 0; padding: 16px 20px; background: var(--surface); color: #76562b; font: 13px/1.5 'Trebuchet MS', sans-serif; }
.activity-dots { display: flex; flex: 0 0 auto; }
@keyframes thinking { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.presence[data-state="speaking"] { color: var(--accent); }
.speech-bars { display: flex; align-items: center; justify-content: center; gap: 3px; height: 28px; width: 30px; }
.speech-bars i { display: block; width: 3px; height: 10px; background: currentColor; border-radius: 2px; transform-origin: center; }
.speech-bars i:nth-child(2), .speech-bars i:nth-child(4) { height: 18px; --wave-delay: -320ms; }
.speech-bars i:nth-child(3) { height: 26px; --wave-delay: -160ms; }
.speech-bars i:nth-child(5) { --wave-delay: -480ms; }
.presence[data-state="speaking"] .speech-bars i { animation: voice-wave 650ms var(--wave-delay, 0ms) ease-in-out infinite alternate; }
@keyframes voice-wave { from { transform: scaleY(.35); opacity: .65; } to { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .presence.speaking .speech-bars i { animation: none; height: 16px; } }
.microphone { margin: 0; width: 100%; color: var(--accent); background: transparent; padding: 12px 14px; min-height: 44px; }
.microphone:hover { background: #e8dcc7; }
.microphone[aria-pressed="true"] { color: var(--paper); background: var(--accent); }
.mic-hint { margin: 7px 0 0; color: var(--muted); font: 10px/1.5 'Trebuchet MS', sans-serif; }
.music-library { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; }
.library-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; padding-bottom: 14px; flex: 0 0 auto; }
.library-heading h2 { margin: 0; font-size: 30px; font-weight: 400; }
#music-count { display: block; width: 100%; font: 10px/1.6 'Trebuchet MS', sans-serif; color: var(--muted); }
.library-note { color: var(--muted); font: 11px/1.6 'Trebuchet MS', sans-serif; }
#music-search, #history-search, #music-filter { width: 100%; padding: 11px 12px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font: 15px Georgia, serif; }
#music-filter { margin-top: 8px; font-size: 12px; }
.history-library { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; background: var(--surface); border-top: 3px solid var(--accent); padding: 18px; }
.history-library .library-heading { padding-bottom: 0; }
.history-library .library-heading h2 { font-size: 32px; color: var(--accent); }
#history-count { color: var(--accent); font: 11px 'Trebuchet MS', sans-serif; }
.history-results { flex: 1 1 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; margin-top: 12px; overscroll-behavior: contain; }
.history-results details { margin-top: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-results summary { color: var(--ink); font: 14px/1.5 Georgia, serif; }
.history-results p, .catalogue-versions p { font: 11px/1.7 'Trebuchet MS', sans-serif; }
.history-results button { display: block; background: transparent; color: var(--accent); padding: 8px 0; font-size: 11px; margin-top: 8px; }
.reply-sources { font: 10px/1.6 'Trebuchet MS', sans-serif; color: var(--muted); margin-top: 12px; }
.reply-sources a { padding: 4px; }
.music-list { flex: 1 1 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; margin-top: 12px; overscroll-behavior: contain; }
.library-info { flex: 0 0 auto; margin-top: 10px; max-height: 150px; overflow-y: auto; }
.conversation-notes { display: flex; align-items: start; gap: 20px; padding-top: 10px; flex: 0 0 auto; max-height: 150px; overflow-y: auto; }
.conversation-notes details { margin: 0; flex: 1; }
#chat-form, #error, .activity { flex: 0 0 auto; }
#chat-form label { margin: 12px 0 8px; }
.library-work { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 8px; }
.library-play { display: grid; gap: 4px; text-align: left; background: transparent; color: var(--ink); border: none; padding: 12px 0; width: 100%; }
.library-play:hover { background: #e8dcc7; }
.library-play strong { font: 16px Georgia, serif; font-weight: 400; }
.library-play span { color: var(--muted); font: 10px 'Trebuchet MS', sans-serif; }
.library-play:disabled { opacity: .6; cursor: default; }
.library-work > a { padding: 10px; text-decoration: none; }
.work-versions { margin: 6px 0 12px; }
.work-versions button { display: block; width: 100%; text-align: left; background: transparent; color: var(--accent); border-color: var(--line); padding: 8px; margin-top: 6px; font-size: 10px; }
.music-card { display: flex; gap: 20px; padding: 22px; margin: 20px 0; border: 1px solid var(--line); background: var(--surface); }
.music-card > div { min-width: 0; flex: 1; }
.music-card small { color: var(--accent); font: 9px/1.6 'Trebuchet MS', sans-serif; letter-spacing: .08em; }
.music-card h3 { font-size: 24px; font-weight: 400; margin: 8px 0; }
.music-card p { font: 12px/1.6 'Trebuchet MS', sans-serif; color: var(--muted); margin: 7px 0; }
.music-card .recording-details { font-size: 10px; }
.music-card audio { width: 100%; height: 36px; margin-top: 12px; }
.music-card a { display: block; margin-top: 12px; font: 10px 'Trebuchet MS', sans-serif; }
.music-stop { margin-top: 8px; font-size: 11px; padding: 8px 12px; }
.record-disc { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%; background: repeating-radial-gradient(circle, #292d29 0 2px, #3a3d36 3px 4px); position: relative; }
.record-disc:after { content: ''; position: absolute; inset: 21px; border: 8px solid var(--accent); border-radius: 50%; background: var(--paper); }
.music-card.playing .record-disc { animation: record-spin 5s linear infinite; }
@keyframes record-spin { to { transform: rotate(360deg); } }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .presence * , .activity *, .music-card * { animation: none !important; } }
label { display: block; font: 12px 'Trebuchet MS', sans-serif; margin: 20px 0 10px; }
.input-row { display: flex; gap: 8px; }
.composer-actions { display: flex; flex-direction: column; gap: 8px; width: 172px; flex: 0 0 auto; }
.composer-actions button { min-height: 44px; }
textarea { flex: 1; min-width: 0; resize: vertical; font: 16px/1.5 Georgia, serif; padding: 12px; background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 0; }
textarea:focus, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#error { font: 13px/1.6 'Trebuchet MS', sans-serif; color: #8a2e22; }
details { margin-top: 24px; color: var(--muted); font: 11px/1.7 'Trebuchet MS', sans-serif; }
summary { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; }
#voice-id { overflow-wrap: anywhere; }
footer { border-top: 1px solid var(--line); padding-top: 8px; color: var(--muted); letter-spacing: .08em; }
@media (min-width: 761px) and (max-width: 1150px) {
  main { padding-inline: 20px; gap: 14px; }
  .introduction { grid-template-columns: 1fr 1fr 170px; gap: 16px; }
  h1 { font-size: 38px; }
  .presence { padding-left: 16px; gap: 10px; }
  .state-orb { width: 46px; height: 46px; }
  .state-copy strong { font-size: 15px; }
  .workspace { grid-template-columns: minmax(400px, 1fr) 300px; grid-template-rows: 1fr 1fr; gap: 16px; }
  .conversation { grid-column: 1; grid-row: 1 / 3; padding: 0 20px 0 0; border-left: 0; }
  .music-library { grid-column: 2; grid-row: 1; }
  .history-library { grid-column: 2; grid-row: 2; padding: 12px; }
  .library-heading { padding-bottom: 8px; }
  .library-heading h2, .history-library .library-heading h2 { font-size: 26px; }
  .history-library .library-note { display: none; }
  .history-results { margin-top: 6px; }
  #history-search { margin-top: 8px; }
  .library-info { display: none; }
}
@media (max-width: 760px) {
  main { padding: 10px 16px; gap: 12px; min-height: 640px; }
  header { font-size: 9px; padding: 6px 0; }
  .introduction { grid-template-columns: 1fr; gap: 10px; padding-bottom: 12px; }
  .intro-persona { grid-column: 1 / -1; }
  .eyebrow { display: none; }
  h1 { font-size: clamp(32px, 7vw, 44px); }
  .subtitle { margin: 6px 0; font-size: 14px; }
  .disclosure { font-size: 9px; }
  .presence { padding: 0; gap: 8px; background: transparent; }
  .state-orb { width: 36px; height: 36px; }
  .state-copy strong { font-size: 13px; }
  .state-copy > span { display: none; }
  .intro-controls, .mic-hint { display: none; }
  .microphone { margin: 0; padding: 10px 8px; font-size: 11px; }
  .workspace-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; flex: 0 0 auto; }
  .workspace-tabs button { font-size: 11px; padding: 10px 4px; min-height: 42px; color: var(--accent); background: transparent; border-color: var(--line); }
  .workspace-tabs button[aria-pressed="true"] { color: var(--paper); background: var(--accent); border-color: var(--accent); }
  .workspace { display: flex; }
  .workspace > section { width: 100%; }
  .workspace[data-view="conversation"] > :not(.conversation), .workspace[data-view="music"] > :not(.music-library), .workspace[data-view="history"] > :not(.history-library) { display: none; }
  .conversation { border: 0; padding: 0; }
  .conversation-heading { font-size: 10px; padding-bottom: 10px; }
  .message { margin: 16px 0; }
  .message p { font-size: 16px; line-height: 1.6; }
  .history-library { padding: 14px; }
  .library-heading h2, .history-library .library-heading h2 { font-size: 28px; }
  .conversation-notes { padding-top: 8px; gap: 10px; }
  .input-row { flex-direction: column; gap: 6px; }
  .composer-actions { flex-direction: row; width: 100%; gap: 6px; }
  .composer-actions button { flex: 1; }
  #send { padding-inline: 10px; font-size: 11px; }
  textarea { padding: 10px; font-size: 15px; }
  .music-card { padding: 16px; gap: 12px; }
  .record-disc { width: 40px; height: 40px; }
  .record-disc:after { inset: 12px; border-width: 6px; }
  .music-card h3 { font-size: 20px; }
  footer { font-size: 8px; gap: 12px; }
}
@media (min-width: 761px) and (max-width: 1150px) and (max-height: 720px) {
  .intro-controls, .mic-hint, .subtitle, .disclosure { display: none; }
  .microphone { margin-top: 0; }
  .introduction { grid-template-columns: 1fr 1fr; padding-bottom: 12px; }
  h1 { font-size: 32px; }
}

@view-transition { navigation: auto; }
body[data-artist="fresedo"] { --paper:#eef1e7; --ink:#243b34; --muted:#637267; --accent:#325f50; --line:#b7c8b6; --surface:#dfe7dc; --field:#f7faf2; --presence:#e2e9de; }
body[data-artist="pugliese"] { --paper:#f1e7e8; --ink:#35282e; --muted:#78626b; --accent:#772f43; --line:#cbb3ba; --surface:#e8d9dd; --field:#fcf5f5; --presence:#e6d9de; }
.back-to-artists { text-decoration:none; letter-spacing:.03em; }
.intro-persona { display:flex; align-items:center; gap:18px; }
.portrait-link { flex:0 0 auto; display:block; line-height:0; }
.portrait { width:88px; height:112px; object-fit:cover; object-position:center 28%; filter:grayscale(1); border:1px solid var(--line); }
body[data-artist="pugliese"] .portrait { object-position:75% 25%; }
.persona-title { min-width:0; }
h1 { font-size:clamp(32px,3.15vw,52px); }
body[data-busy="true"] #title { animation:maestro-glow 1.6s ease-in-out infinite alternate; }
body[data-busy="true"] .portrait { animation:portrait-glow 1.6s ease-in-out infinite alternate; }
.message p:not([hidden]) { animation:reply-reveal 240ms ease-out; }
body[data-artist="carlos"] .portrait { view-transition-name:portrait-carlos; }
body[data-artist="fresedo"] .portrait { view-transition-name:portrait-fresedo; }
body[data-artist="pugliese"] .portrait { view-transition-name:portrait-pugliese; }
@keyframes maestro-glow { from { text-shadow:0 0 0 transparent; opacity:.65; } to { text-shadow:0 0 20px color-mix(in srgb,var(--accent) 40%,transparent); opacity:1; } }
@keyframes portrait-glow { to { box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 20%,transparent); } }
@keyframes reply-reveal { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
@media(min-width:761px) and (max-width:1150px) { .portrait { width:56px; height:76px; } .intro-persona { gap:12px; } h1 { font-size:34px; } }
@media(max-width:760px) { .portrait { width:56px; height:72px; } .intro-persona { gap:12px; } h1 { font-size:30px; } .subtitle { font-size:12px; } .disclosure { font-size:8px; } header>span:nth-child(2) { display:none; } }
@media(min-width:761px) and (max-height:720px) { .portrait { width:44px; height:56px; } h1 { font-size:28px; } .intro-persona { gap:10px; } }
@media(prefers-reduced-motion:reduce) { #title,.portrait,.message p { animation:none!important; view-transition-name:none!important; } }
