@layer base, components, responsive;
@layer base {
  :root { color-scheme: light; --paper:#fff8ec; --canvas:#e2ead9; --ink:#304334; --muted:#57694f; --accent:#456b43; --accent-deep:#2f4f31; --sage:#bacda8; --line:#cbd7bf; --surface:#edf2e2; --field:#fafbf2; --selected:#e0ead4; --control-border:#9bad8b; --wood:#cba171; --serif:Georgia,'Times New Roman',serif; --sans:'Avenir Next','Trebuchet MS',sans-serif; font-family:var(--sans); color:var(--ink); background:var(--canvas); }
  * { box-sizing:border-box; }
  html,body { touch-action:pan-x pan-y; }
  body { margin:0; }
  html[data-locked] .app-shell { visibility:hidden; }
  button,input,select,textarea { font:inherit; }
  button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
  button,a { touch-action:manipulation; }
  button { cursor:pointer; }
  button:disabled { cursor:wait; opacity:.6; }
  a { color:inherit; text-underline-offset:4px; }
  button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible { outline:3px solid var(--accent); outline-offset:4px; }
  button { color:inherit; }
  h1,h2,h3,p { margin:0; }
  button svg { width:18px; height:18px; }
  [hidden] { display:none!important; }
  .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
}
@layer components {
  .app-shell { max-width:1200px; margin:auto; min-height:100svh; display:grid; grid-template-columns:1fr 540px; }
  .desktop-aside { position:sticky; top:0; height:100svh; min-height:740px; padding:48px 52px 28px; display:flex; flex-direction:column; align-items:flex-start; overflow:hidden; }
  .wordmark { font-size:11px; letter-spacing:2px; font-weight:800; text-decoration:none; display:flex; gap:10px; align-items:center; }
  .wordmark-fruit { font-size:28px; color:var(--accent); }
  .aside-copy { margin-top:60px; position:relative; z-index:1; }
  .eyebrow { font-size:11px; text-transform:uppercase; letter-spacing:1.8px; color:var(--muted); font-weight:700; }
  .aside-copy h1 { font-family:var(--serif); font-weight:400; font-size:clamp(36px,4.4vw,58px); line-height:1.09; letter-spacing:-2px; margin:18px 0 20px; }
  .aside-copy em { color:var(--accent); }
  .aside-copy p { font-size:14px; line-height:1.8; color:var(--muted); }
  .owner-art { display:block; background-image:url('./assets/marie-character-sheet.jpg'); background-repeat:no-repeat; background-size:200% 200%; background-color:#fff6e5; aspect-ratio: .83; width:120px; flex-shrink:0; }
  .art-smile { background-position:0 0; }
  .art-notebook { background-position:100% 0; }
  .art-laugh { background-position:0 100%; }
  .art-stall { background-position:100% 100%; }
  .desktop-aside>.art-stall { width:245px; align-self:flex-end; margin-top:20px; border-radius:48% 48% 18px 18px; transform:rotate(3deg); }
  .aside-footer { margin-top:auto; padding-top:24px; font-size:12px; color:var(--muted); }
  .aside-footer span { color:var(--accent); margin-left:8px; }
  .app-panel { background:var(--paper); min-height:100svh; border-inline:1px solid var(--line); box-shadow:0 0 45px #30433408; }
  .app-header { min-height:86px; padding:20px 28px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
  .owner-link { display:flex; gap:8px; align-items:center; text-decoration:none; font-size:11px; color:var(--muted); }
  .owner-link .owner-art { width:38px; height:38px; border-radius:50%; background-size:205% 240%; background-position:0 1%; border:2px solid var(--line); }
  .awning { height:23px; background:repeating-linear-gradient(90deg,var(--sage) 0 27px,var(--paper) 27px 54px); border-radius:0 0 10px 10px; border-bottom:1px solid var(--control-border); }
  main { padding:28px 28px 20px; min-height:650px; }
  main:focus { outline:none; }
  .market-welcome { display:grid; grid-template-columns:1fr 142px; align-items:center; gap:8px; margin-bottom:22px; }
  .market-welcome .owner-art { width:142px; border-radius:45% 45% 10px 10px; }
  .page-title { font-family:var(--serif); font-size:38px; line-height:1.07; letter-spacing:-1.7px; font-weight:400; margin:10px 0; overflow-wrap:anywhere; }
  .subtitle { font-size:13px; color:var(--muted); line-height:1.65; }
  .small { font-size:12px; line-height:1.6; color:var(--muted); }
  .example-notice { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:11px; color:var(--muted); border-block:1px solid var(--line); padding:7px 0; margin-bottom:20px; }
  .text-button { border:0; background:transparent; padding:9px 0; min-height:44px; font-size:12px; text-decoration:underline; text-underline-offset:3px; }
  .search { width:100%; background:var(--surface); border:1px solid transparent; border-radius:12px; padding:12px 14px; font-size:14px; min-height:44px; color:var(--ink); }
  .filters { display:flex; gap:7px; margin:10px 0 16px; flex-wrap:wrap; }
  .filter { border:1px solid var(--line); background:transparent; border-radius:20px; padding:9px 12px; font-size:11px; min-height:40px; }
  .filter[aria-pressed=true] { background:var(--ink); color:var(--paper); border-color:var(--ink); }
  .market-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:20px; row-gap:24px; padding:0 4px; }
  .fruit-card { border:0; background:transparent; min-width:0; padding:6px 8px 20px; position:relative; display:flex; align-items:center; flex-direction:column; text-decoration:none; }
  .fruit-card:after { content:''; position:absolute; bottom:0; left:-4px; right:-4px; height:9px; background:var(--wood); border-radius:2px; box-shadow:0 3px 0 #b28c62,0 7px 8px #8c674316; }
  .fruit-card .fruit,.fruit-card .person-photo { transition:transform .18s ease-out; }
  @media(hover:hover) { .fruit-card:hover .fruit,.fruit-card:hover .person-photo { transform:translateY(-5px) rotate(-4deg); } }
  .name-tag { border:1px solid var(--line); background:var(--field); border-radius:3px; padding:5px 13px; font-family:var(--serif); font-size:18px; transform:rotate(-3deg); max-width:100%; overflow-wrap:anywhere; margin-top:6px; }
  .fruit-caption { margin-top:9px; font-size:11px; color:var(--muted); }
  .note-count { font-size:10px; color:var(--muted); margin-top:4px; }
  .fruit { position:relative; display:block; width:112px; height:112px; flex-shrink:0; margin:8px auto; }
  .fruit-body { position:absolute; inset:15px 12px 9px; background:#e77880; border:2px solid #754444; border-radius:42% 45% 46% 47%; box-shadow:inset -9px -6px 0 #7f28351a; }
  .strawberry .fruit-body { clip-path:polygon(0 0,100% 0,100% 54%,77% 85%,50% 100%,24% 85%,0 54%); border-radius:38%; background:radial-gradient(ellipse at center,#ffe2ac 0 1.3px,transparent 2px) 4px 2px / 18px 20px,#e77880; }
  .blueberry .fruit-body { background:#9fa8d7; border-color:#60658c; border-radius:47% 50% 43% 48%; }
  .peach .fruit-body { background:#f1b18f; border-color:#a66d52; }
  .leaf { position:absolute; top:7px; left:43px; width:31px; height:21px; background:#7f995e; border:1px solid #597342; border-radius:1px 21px 1px 21px; transform:rotate(-18deg); }
  .blueberry .leaf { background:#7782b9; border-color:#626b9e; width:24px; height:16px; top:11px; left:43px; clip-path:polygon(0 0,40% 30%,65% 0,70% 45%,100% 60%,60% 100%,20% 70%); }
  .fruit-eyes { position:absolute; top:49px; left:36px; display:flex; gap:22px; }
  .fruit-eyes:before,.fruit-eyes:after { content:''; width:6px; height:9px; border-radius:50%; background:#50392f; }
  .fruit-mouth { position:absolute; top:65px; left:46px; width:17px; height:9px; border-bottom:2px solid #50392f; border-radius:50%; }
  .blueberry .fruit-mouth { width:8px; height:9px; left:51px; border:2px solid #50392f; border-radius:50%; }
  .strawberry .fruit-mouth { width:13px; border-radius:0; transform:rotate(-12deg); }
  .fruit-feet { position:absolute; bottom:1px; left:29px; width:15px; height:6px; background:#795744; border-radius:50%; box-shadow:37px 0 0 #795744; }
  .person-photo { display:block; width:104px; height:104px; margin:12px auto; object-fit:cover; border:5px solid var(--sage); border-radius:50%; }
  .person-portrait { display:block; position:relative; width:120px; height:128px; margin:0 auto; }
  .fruit-badge { position:absolute; right:-1px; bottom:2px; width:54px; height:54px; border-radius:50%; background:var(--paper); border:2px solid var(--line); box-shadow:0 2px 3px #79574415; }
  .fruit-badge .fruit { position:absolute; top:-1px; left:-1px; margin:0; transform:scale(.46)!important; transform-origin:top left; }
  .nationality-badges { display:flex; flex-wrap:wrap; justify-content:center; gap:4px 7px; margin-top:8px; max-width:100%; }
  .country-badge { display:inline-flex; align-items:center; gap:4px; font-size:10px; color:var(--muted); line-height:1.6; overflow-wrap:anywhere; }
  .country-badge>span { font-size:16px; }
  .profile-countries .country-badge { font-size:12px; }
  .selected-countries { display:flex; gap:7px; flex-wrap:wrap; margin-bottom:10px; }
  .country-chip { border:1px solid var(--line); background:var(--selected); border-radius:18px; padding:7px 11px; font-size:12px; min-height:38px; }
  .country-picker { position:relative; border:1px solid var(--control-border); border-radius:10px; background:var(--field); }
  .country-picker summary { padding:13px; font-size:14px; min-height:48px; cursor:pointer; }
  .country-picker summary:focus-visible { outline:3px solid var(--accent); outline-offset:4px; }
  .country-menu { border-top:1px solid var(--line); padding:10px; }
  .country-menu input[type=search] { padding:10px!important; margin-bottom:7px; }
  .country-options { max-height:230px; overflow-y:auto; overscroll-behavior:contain; }
  .country-option { display:flex; align-items:center; gap:9px; min-height:44px; padding:8px; border-radius:7px; cursor:pointer; font-size:13px; }
  .country-option:has(:checked) { background:var(--selected); }
  .country-option input[type=checkbox] { width:17px!important; height:17px; min-height:0; accent-color:var(--accent); margin:0; flex-shrink:0; }
  .country-option>span:first-of-type { font-size:20px; }
  .country-option small { margin-left:auto; color:var(--muted); font-size:10px; }
  .country-empty { padding:12px; }
  .add-card { justify-content:center; min-height:205px; }
  .add-circle { border:1px dashed var(--control-border); color:var(--accent); width:68px; height:68px; display:grid; place-items:center; border-radius:50%; font-size:30px; margin-bottom:14px; }
  .market-bottom { margin-top:30px; }
  .button { border:1px solid var(--line); border-radius:12px; background:transparent; min-height:48px; padding:12px 17px; font-size:14px; font-weight:600; text-decoration:none; display:inline-flex; justify-content:center; align-items:center; gap:8px; }
  .primary { background:var(--accent); color:#fff8ec; border-color:var(--accent); box-shadow:0 3px 0 var(--accent-deep); }
  .wide { width:100%; }
  .market-bottom>p { text-align:center; margin-top:13px; }
  .app-footer { display:flex; flex-direction:column; align-items:center; gap:7px; font-size:10px; color:var(--muted); padding:18px 20px 25px; }
  .app-footer a { padding:6px; }
  .back-row { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
  .back-link { text-decoration:none; font-size:13px; padding:10px 0; min-height:44px; display:inline-flex; align-items:center; }
  .profile-heading { text-align:center; padding:3px 0 15px; }
  .profile-heading .page-title { margin:7px 0; }
  .profile-heading .fruit { width:112px; }
  .profile-heading .subtitle { white-space:pre-wrap; overflow-wrap:anywhere; }
  .fruit-picker { border:0; padding:0; margin:18px 0; }
  .fruit-picker legend,.field-label { display:block; font-size:12px; font-weight:700; margin-bottom:9px; }
  .fruit-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .fruit-option { display:flex; align-items:center; justify-content:center; position:relative; min-width:0; }
  .fruit-option input { position:absolute; opacity:0; width:1px; height:1px; }
  .fruit-option>span { display:flex; flex-direction:column; align-items:center; border:1px solid var(--line); padding:12px 4px; border-radius:12px; width:100%; gap:4px; min-height:65px; font-size:12px; cursor:pointer; }
  .fruit-option small { font-size:10px; color:var(--muted); text-align:center; }
  .fruit-option input:checked+span { border:2px solid var(--accent); padding:11px 3px; background:var(--selected); }
  .fruit-option input:focus-visible+span { outline:3px solid var(--accent); outline-offset:3px; }
  .section-heading { display:flex; align-items:center; gap:13px; margin:25px 0 10px; }
  .section-heading .owner-art { width:65px; border-radius:45% 45% 10px 10px; }
  .section-heading h2 { font-family:var(--serif); font-weight:400; font-size:23px; margin-bottom:5px; }
  .note { position:relative; background:var(--selected); border-radius:2px 10px 10px 10px; padding:19px; margin:16px 0; box-shadow:0 3px 0 #8da67533; }
  .note:nth-child(even) { transform:rotate(-.6deg); }
  .note:before { content:''; position:absolute; width:40px; height:14px; top:-6px; left:calc(50% - 20px); background:#92ac7350; transform:rotate(-4deg); }
  .note p { font-family:var(--serif); font-size:17px; line-height:1.55; white-space:pre-wrap; overflow-wrap:anywhere; }
  .note-footer { display:flex; justify-content:space-between; align-items:center; margin-top:10px; gap:8px; }
  .note time { font-size:10px; color:var(--muted); }
  .note-delete { border:0; background:transparent; font-size:11px; color:var(--muted); padding:8px; min-height:35px; }
  .field { display:block; margin:19px 0; }
  .field input:not([type=radio]),.field textarea { width:100%; background:var(--field); color:var(--ink); border:1px solid var(--control-border); border-radius:10px; padding:13px; font-size:16px; }
  .field textarea { resize:vertical; min-height:110px; line-height:1.6; }
  .field .small { display:block; margin-top:6px; }
  .field-label .small { display:inline; margin:0; font-weight:400; }
  .form-heading { display:flex; align-items:center; gap:17px; margin:8px 0 20px; }
  .form-heading .owner-art { width:94px; border-radius:40% 40% 12px 12px; }
  .form-heading .page-title { font-size:32px; }
  .form-error { background:#f9e0d8; color:#813b32; padding:12px; border-radius:10px; font-size:13px; line-height:1.5; margin:12px 0; }
  .form-actions { display:flex; gap:10px; align-items:center; margin-top:24px; }
  .form-actions .primary { flex:1; }
  .photo-field { border:1px dashed var(--control-border); border-radius:12px; padding:14px; }
  .photo-preview { width:64px; height:64px; border-radius:50%; object-fit:cover; display:block; margin:0 0 10px; }
  .photo-field input { font-size:12px!important; padding:4px 0!important; border:0!important; background:transparent!important; color:var(--muted)!important; }
  .photo-field input::file-selector-button { min-height:44px; padding:10px 16px; margin-right:12px; border:1px solid var(--control-border); border-radius:10px; color:var(--ink); background:var(--selected); font:600 13px var(--sans); cursor:pointer; box-shadow:0 2px 0 var(--sage); transition:background .15s ease; }
  .photo-field input::file-selector-button:hover { background:#cfdfc1; }
  .photo-field input:disabled::file-selector-button { cursor:wait; opacity:.6; }
  .celebration { display:flex; align-items:center; gap:14px; background:var(--surface); padding:12px; border-radius:14px; margin:15px 0; }
  .celebration .owner-art { width:83px; border-radius:35% 35% 9px 9px; }
  .celebration h2 { font-family:var(--serif); font-size:21px; font-weight:400; margin-bottom:5px; }
  .empty { text-align:center; padding:25px 10px; }
  .empty .owner-art { width:140px; margin:0 auto 18px; border-radius:45%; }
  .empty h2 { font-family:var(--serif); font-size:26px; font-weight:400; margin-bottom:10px; }
  .empty p { font-size:13px; color:var(--muted); line-height:1.7; }
  .danger { color:#973b3b; margin-top:24px; }
  .about { text-align:center; padding:10px 10px 30px; }
  .about .owner-art { width:205px; margin:20px auto; border-radius:45% 45% 14px 14px; }
  .about p { line-height:1.8; font-size:14px; margin:18px 0; color:var(--muted); }
  .storage-message { background:var(--surface); padding:12px; border-radius:10px; font-size:12px; line-height:1.5; margin-bottom:15px; }
  .login-body { min-height:100svh; display:grid; place-items:center; padding:28px 16px; background:var(--canvas); }
  .login-card { padding:0; min-height:0; width:100%; max-width:390px; border:1px solid var(--line); border-radius:22px; background:var(--paper); box-shadow:0 10px 40px #3043340c; overflow:hidden; }
  .login-card>.wordmark { justify-content:center; padding:25px; }
  .login-content { padding:8px 28px 26px; text-align:center; }
  .login-content .fruit { width:112px; margin:12px auto 20px; }
  .login-content .page-title { font-size:35px; margin:13px 0; }
  .login-content form { text-align:left; margin-top:24px; }
  .login-content .field { margin:17px 0; }
  .login-content .primary { margin-top:8px; }
  .login-footer { margin-top:24px; font-family:var(--serif); font-style:italic; font-size:13px; color:var(--muted); }
}
@layer responsive {
  /* iOS focuses smaller editable text by zooming the page. */
  @media(max-width:900px),(pointer:coarse) { .search,.field input:not([type=file]):not([type=radio]):not([type=checkbox]),.field textarea,select { font-size:16px; } }
  @media(min-width:1100px) { .app-shell { padding:24px 0; } .app-panel { border:1px solid var(--line); border-radius:25px; overflow:hidden; min-height:calc(100svh - 48px); } .desktop-aside { height:calc(100svh - 48px); top:24px; } }
  @media(max-width:900px) { .app-shell { display:block; max-width:540px; } .desktop-aside { display:none; } }
  @media(max-width:420px) { main { padding:22px 20px 16px; } .app-header { padding:16px 20px; min-height:72px; } .owner-link>span:last-child { display:none; } .market-welcome { grid-template-columns:1fr 112px; } .market-welcome .owner-art { width:112px; } .page-title { font-size:33px; } .market-grid { column-gap:14px; } .fruit-options { gap:5px; } .fruit-option>span { font-size:11px; } .fruit-option small { font-size:10px; } .filter { padding:9px 10px; } }
  @media(prefers-reduced-motion:reduce) { *,*:before,*:after { transition:none!important; scroll-behavior:auto!important; } }
}
