/* Adaptive layer, loaded last. Two axes:
   1. form factor (width + touch): phone <= 760px, tablet 761-1180px, desktop above;
   2. operating system (<html data-os="ios|android|mac|windows|linux">, set by the server from the user agent and
      corrected in the browser for iPadOS): each system gets its own UI typeface, navigation style, touch feedback,
      scrollbars and keyboard hints. Headings keep the brand serif everywhere. */
:root { --tab-h: 0px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }

/* ---------------------------------------------------------------- typefaces
   UI text uses the system's own face. Japanese / Korean / Thai: Apple and Android ship good ones; elsewhere the
   self-hosted Noto families (public/fonts/<lang>/) are used, downloaded slice by slice only when a page needs them. */
[data-os="ios"], [data-os="mac"] { --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Inter", sans-serif; }
[data-os="android"] { --sans: Roboto, "Google Sans Text", "Inter", system-ui, sans-serif; }
[data-os="windows"] { --sans: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, sans-serif; }
:lang(ja) { --sans: "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
:lang(ko) { --sans: "Inter", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
:lang(th) { --sans: "Inter", "Noto Sans Thai", "Leelawadee UI", "Thonburi", sans-serif; }
[data-os="windows"]:lang(ja), [data-os="windows"] :lang(ja) { --sans: "Segoe UI Variable Text", "Segoe UI", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif; }
[data-os="windows"]:lang(ko), [data-os="windows"] :lang(ko) { --sans: "Segoe UI Variable Text", "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif; }
[data-os="windows"]:lang(th), [data-os="windows"] :lang(th) { --sans: "Segoe UI Variable Text", "Segoe UI", "Noto Sans Thai", "Leelawadee UI", sans-serif; }
[data-os="ios"]:lang(ja), [data-os="mac"]:lang(ja), [data-os="ios"] :lang(ja), [data-os="mac"] :lang(ja) { --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }
[data-os="ios"]:lang(ko), [data-os="mac"]:lang(ko), [data-os="ios"] :lang(ko), [data-os="mac"] :lang(ko) { --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
[data-os="ios"]:lang(th), [data-os="mac"]:lang(th), [data-os="ios"] :lang(th), [data-os="mac"] :lang(th) { --sans: -apple-system, BlinkMacSystemFont, "Thonburi", "Noto Sans Thai", sans-serif; }
[data-os="android"]:lang(ja), [data-os="android"]:lang(ko), [data-os="android"]:lang(th), [data-os="android"] :lang(ja), [data-os="android"] :lang(ko), [data-os="android"] :lang(th) { --sans: Roboto, system-ui, sans-serif; }
/* display type: Japanese and Korean headings are set in the same sans, bold; Thai has a serif of its own */
html:lang(ja), html:lang(ko), html :lang(ja), html :lang(ko) { --serif: "Fraunces", var(--sans); }
html:lang(th), html :lang(th) { --serif: "Fraunces", "Noto Serif Thai", "Leelawadee UI", "Thonburi", serif; }
:lang(ja) :is(.display, .h2, .h3, h1, h2, h3), :lang(ko) :is(.display, .h2, .h3, h1, h2, h3) { font-weight: 700; font-variation-settings: normal; }
body { font-family: var(--sans); }
[data-os="ios"] body, [data-os="mac"] body { letter-spacing: -.003em; }
[data-os="windows"] body { font-optical-sizing: auto; }

/* ---------------------------------------------------------------- touch screens: no hover-only tricks, real press feedback */
html { -webkit-tap-highlight-color: transparent; }
@media (hover: none), (pointer: coarse) {
  .pack-fan { display: none; }
  .pack:hover .pack-cover { transform: none; filter: none; }
  .pack:hover .pack-go { background: rgba(255, 255, 255, .14); color: inherit; transform: none; }
  .tilt, [data-tilt] { transform: none !important; }
  .glare, .spot-glow { display: none !important; }
  .t-card:hover, .t-item:hover, .pack:hover { transform: none; }
  .chip, .lang-menu a, .menu a { min-height: 40px; }
  .nav-links > a, .nav-more-btn, .lang { min-height: 44px; }
  .drop small { display: none; }                      /* "or click to browse, paste with Ctrl+V": not a touch gesture */
  .btn:active, .chip:active, .t-item:active, .t-card:active, .pack:active, .tabbar a:active { transition-duration: .08s; }
  input, textarea, select { font-size: 16px !important; }   /* below 16px iOS zooms the page when a field gets focus */
}

/* ---------------------------------------------------------------- bottom tab bar (phones) */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tab-h: 56px; --nav-h: 56px; }
  [data-os="android"] { --tab-h: 72px; }
  [data-os="ios"] { --tab-h: 52px; }
  body { padding-bottom: calc(var(--tab-h) + var(--safe-b)); }
  .tabbar { position: fixed; z-index: 140; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
    display: grid; grid-template-columns: repeat(4, 1fr); align-items: stretch;
    background: rgba(13, 13, 16, .86); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); border-top: 1px solid var(--line); }
  .tabbar a { display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 0; color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .01em; transition: color .2s, transform .15s; }
  .tabbar a > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tabbar .tab-ic { display: grid; place-items: center; width: 56px; height: 28px; border-radius: 16px; transition: background .25s; }
  .tabbar .ic { width: 23px; height: 23px; }
  .tabbar a[aria-current] { color: var(--text); }
  .tabbar a[aria-current] .ic { color: var(--amber); }
  .nav-in { padding-inline: 14px; }
  .nav-end { gap: 4px; }
  .brand-name { font-size: 21px; }
  .foot { padding-bottom: 8px; }
  .toasts { bottom: calc(var(--tab-h) + var(--safe-b) + 14px); width: calc(100% - 28px); }
  .toast { width: 100%; text-align: center; }
  /* the consent banner becomes a bottom sheet above the tab bar */
  .consent { left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); width: 100%; border-radius: 22px 22px 0 0; max-height: calc(100dvh - var(--tab-h) - var(--safe-b) - 60px); overflow-y: auto; }
  .consent-act { display: grid; grid-template-columns: 1fr 1fr; }
  .consent-act .btn { width: 100%; justify-content: center; } .consent-act .btn-light { grid-column: 1 / -1; order: -1; --bh: 46px; }
}
/* iOS: translucent bar, small labels, a grabber on sheets, springy press */
[data-os="ios"] .tabbar { background: rgba(22, 22, 26, .72); -webkit-backdrop-filter: blur(30px) saturate(1.9); backdrop-filter: blur(30px) saturate(1.9); border-top-color: rgba(255, 255, 255, .1); }
[data-os="ios"] .tabbar a { font-size: 10px; font-weight: 500; gap: 1px; }
[data-os="ios"] .tabbar .tab-ic { height: 27px; }
[data-os="ios"] .tabbar .ic { width: 25px; height: 25px; }
@media (max-width: 760px) { [data-os="ios"] .consent::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28); margin: 9px auto -8px; } }
@media (hover: none), (pointer: coarse) {
  [data-os="ios"] :is(.btn, .chip, .t-item, .t-card, .pack, .tabbar a, .drop):active { transform: scale(.965); opacity: .86; }
}
[data-os="ios"] .panel, [data-os="mac"] .panel { border-radius: 22px; }
/* Android (Material 3): opaque bar, pill behind the active icon, label always shown, ripple on press, squarer shapes */
[data-os="android"] .tabbar { background: #15151a; -webkit-backdrop-filter: none; backdrop-filter: none; border-top: 0; box-shadow: 0 -1px 0 var(--line), 0 -12px 30px -18px #000; }
[data-os="android"] .tabbar a { font-size: 12px; font-weight: 500; gap: 4px; }
[data-os="android"] .tabbar .tab-ic { width: 64px; height: 32px; }
[data-os="android"] .tabbar a[aria-current] .tab-ic { background: rgba(255, 196, 107, .2); }
[data-os="android"] .tabbar a[aria-current] { font-weight: 700; }
[data-os="android"] :is(.btn, .chip, .tabbar a, .t-item, .drop) { position: relative; overflow: hidden; }
[data-os="android"] :is(.btn, .chip, .tabbar a, .drop)::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at center, rgba(255, 255, 255, .28) 0, rgba(255, 255, 255, .28) 40%, transparent 41%) center / 0% 0% no-repeat; opacity: 0; transition: background-size .45s ease-out, opacity .6s; }
[data-os="android"] :is(.btn, .chip, .tabbar a, .drop):active::after { background-size: 260% 260%; opacity: 1; transition: background-size 0s, opacity 0s; }
[data-os="android"] .chip { border-radius: 10px; }
[data-os="android"] .go-btn { border-radius: 18px; }
[data-os="android"] .tabs, [data-os="android"] .tabs button { border-radius: 12px; }
@media (max-width: 760px) { [data-os="android"] .consent { border-radius: 28px 28px 0 0; } [data-os="android"] .toast { border-radius: 6px; text-align: left; } }

/* ---------------------------------------------------------------- phones: layout */
@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  .section { padding-block: clamp(48px, 12vw, 72px); }
  .hero-cta { flex-direction: column; align-items: stretch; width: 100%; } .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-trust { gap: 8px 16px; font-size: 12.5px; }
  .pack-grid { gap: 12px; } .pack-info b { font-size: 17px; } .pack-info { left: 12px; bottom: 12px; right: 48px; } .pack-go { width: 32px; height: 32px; right: 10px; bottom: 10px; }
  .tool-links a { min-height: 60px; }
  /* studio: one column, the action button stays in reach above the tab bar */
  .studio-grid, .studio[data-mode="generate"] .studio-grid { width: calc(100% - 20px); gap: 10px; }
  .studio .panel { padding: 12px; border-radius: 20px; }
  .studio-head h1 { font-size: 26px; }
  .p-in:not(.p-compose) .tips, .p-in:not(.p-compose) .note { display: none; }
  .p-in .slot { min-width: 0; } .drop { aspect-ratio: auto; min-height: 132px; }
  .slot-preview img { max-height: 46dvh; object-fit: contain; }
  .stage { min-height: 0; aspect-ratio: 3 / 4; max-height: 72dvh; border-radius: 22px; }
  .t-grid { max-height: 58dvh; grid-template-columns: repeat(3, minmax(0, 1fr)); overscroll-behavior: contain; }
  .go { position: sticky; z-index: 30; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); margin: 4px -6px -6px; padding: 10px; border: 0; border-radius: 18px;
    background: rgba(20, 20, 26, .92); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: 0 0 0 1px var(--line-2), 0 -18px 30px -18px #000; }
  .go .quota { text-align: center; }
  .stage-bar { padding: 10px; gap: 8px; } .bar-note { display: none; }
  .bar-act { width: 100%; display: grid; grid-template-columns: 1fr 1fr; margin: 0; } .bar-act .btn { width: 100%; justify-content: center; --bh: 44px; } .bar-act #dl-png { grid-column: 1 / -1; order: -1; --bh: 50px; }
  .aspects { grid-template-columns: repeat(4, 1fr); } .styles { grid-template-columns: repeat(2, 1fr); }
  .g-filter-in { gap: 8px; } .g-h1 { font-size: clamp(38px, 12vw, 56px); }
  .prose h2 { font-size: 23px; margin-top: 36px; }
  .foot-in { padding: 40px 0 24px; gap: 28px; }
}
@media (max-width: 380px) { .t-wall, .pk-wall { gap: 10px; } .tabbar a { font-size: 10px; } .stage-card { width: 250px; margin-left: -125px; } }

/* ---------------------------------------------------------------- tablets (iPad, Android tablets, small laptops): two columns */
@media (min-width: 761px) and (max-width: 1180px) {
  .nav-links { display: flex; } .nav-burger { display: none; }
  .nav-links > a, .nav-more-btn { padding: 0 11px; font-size: 14px; }
  .lang span { display: none; } .nav-end .btn span { display: none; } .nav-end .btn { padding: 0 12px; }
  .nav-links .menu { position: absolute; width: min(560px, 80vw); grid-template-columns: 1fr 1fr; }
  .pack-grid { grid-template-columns: repeat(3, 1fr); }
  .duo-grid { grid-template-columns: 1fr 1fr; } .bento { grid-template-columns: 1fr; min-height: 0; }
  .how-grid { grid-template-columns: repeat(3, 1fr); }
  .tool-hero-in { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
  .tool-links { grid-template-columns: repeat(2, 1fr); }
  /* studio: the picture on the left stays in view, controls scroll on the right */
  .studio-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 42%); grid-template-areas: "stage in" "stage pick"; grid-template-rows: auto 1fr; height: auto; align-items: start; }
  .studio[data-mode="generate"] .studio-grid { grid-template-columns: minmax(300px, 42%) minmax(0, 1fr); grid-template-areas: "in stage" "hist stage"; }
  .studio .p-in { grid-area: in; order: 0; flex-direction: column; flex-wrap: nowrap; } .studio .p-in .slot { min-width: 0; flex: none; }
  .studio .p-pick { grid-area: pick; order: 0; } .studio .p-hist { grid-area: hist; }
  .studio .stage-col { grid-area: stage; order: 0; position: sticky; top: calc(var(--nav-h) + 12px); height: calc(100dvh - var(--nav-h) - 28px); min-height: 480px; }
  .studio .stage { min-height: 0; }
  .p-in:not(.p-compose) .tips { display: none; } .drop { aspect-ratio: 16 / 8; }
  .t-grid { max-height: 52dvh; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bar-act { margin-left: 0; width: 100%; } .bar-act .btn { flex: 1; justify-content: center; }
  .p-hist .hist { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); grid-auto-columns: auto; overflow: visible; }
}
@media (min-width: 761px) and (max-width: 1180px) and (hover: none) { .go-btn { --bh: 56px; } .chip { min-height: 40px; } }

/* ---------------------------------------------------------------- desktop systems */
/* Windows and Linux draw wide, light scrollbars: give them thin dark ones (macOS overlays its own) */
[data-os="windows"], [data-os="linux"] { scrollbar-color: rgba(255, 244, 230, .22) transparent; }
[data-os="windows"] ::-webkit-scrollbar, [data-os="linux"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-os="windows"] ::-webkit-scrollbar-thumb, [data-os="linux"] ::-webkit-scrollbar-thumb { background: rgba(255, 244, 230, .18); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
[data-os="windows"] ::-webkit-scrollbar-thumb:hover, [data-os="linux"] ::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 244, 230, .34); }
[data-os="windows"] ::-webkit-scrollbar-track, [data-os="linux"] ::-webkit-scrollbar-track { background: transparent; }
[data-os="windows"] :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* macOS: more vibrancy in the toolbar, native-feeling focus ring */
[data-os="mac"] .nav.scrolled .nav-in, [data-os="mac"] .nav.scrolled { -webkit-backdrop-filter: blur(28px) saturate(1.9); backdrop-filter: blur(28px) saturate(1.9); }
[data-os="mac"] :focus-visible { outline: 3px solid rgba(255, 196, 107, .55); outline-offset: 2px; }
/* keyboard hint on the main action (added by studio.js on machines with a keyboard) */
.kbd { margin-left: 10px; padding: 2px 7px; border-radius: 7px; font: 600 11.5px/1.5 var(--sans); letter-spacing: .04em; color: rgba(20, 12, 8, .72); background: rgba(255, 255, 255, .34); box-shadow: 0 0 0 1px rgba(255, 255, 255, .3) inset; }
[data-os="windows"] .kbd, [data-os="linux"] .kbd { border-radius: 4px; }
@media (hover: none), (max-width: 1180px) { .kbd { display: none; } }

/* installed to the home screen: the page is the app, so respect the status bar and drop the browser-only bits */
@media (display-mode: standalone) { .nav { padding-top: var(--safe-t); } }

/* Wide decorations (hero rings, marquees) must not widen the layout viewport on phones: a wider viewport pushes
   fixed bars off the visible screen. "clip" cuts the overflow without creating a scroll container (sticky still works). */
html { overflow-x: clip; }

/* nav labels: full names on wide toolbars, short ones when space is tight */
.nav-links .ns { display: none; }
@media (min-width: 761px) and (max-width: 1180px) { .nav-links .nl { display: none; } .nav-links .ns { display: inline; } .nav-links > a, .nav-more-btn { white-space: nowrap; } }
/* landscape tablets and small laptops: the hero keeps its two columns, with a smaller picture card */
@media (min-width: 960px) and (max-width: 1180px) {
  .hero-in { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 20px; min-height: 0; }
  .hero-copy { justify-items: start; text-align: left; padding-bottom: 0; } .hero-lead { margin-inline: 0; } .hero-cta, .hero-trust { justify-content: flex-start; }
  .hero-h1 { font-size: clamp(46px, 5.6vw, 66px); }
  .hero-stage { height: 540px; max-width: none; }
  .stage-card { width: 320px; margin: -260px 0 0 -160px; }
}
@media (min-width: 761px) and (max-width: 959px) { .hero-stage { height: 560px; } .hero-cta { flex-direction: row; } }
/* chips in scrolling rows keep their natural width (never squeezed) */
.g-chips .chip, .cats .chip, .sugs .chip { flex: none; }
