:root {
  --bg: #1f3bff; --ink: #ffe8f0; --acc: #ffd23f;
  --ink-08: rgba(255, 232, 240, .08); --ink-15: rgba(255, 232, 240, .15); --ink-30: rgba(255, 232, 240, .3); --ink-60: rgba(255, 232, 240, .6);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .9, .25, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--ink); font: 16px/1.3 "Bricolage Grotesque", system-ui, sans-serif;
  overscroll-behavior: none; transition: background-color .6s var(--ease), color .6s var(--ease); }
button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }
.ico { width: 1.25em; height: 1.25em; display: block; flex: none; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }

/* paper grain over everything, very quiet */
.grain { position: fixed; inset: -50%; z-index: 40; pointer-events: none; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- the type lockup ---------- */
.lockup { width: 100%; padding: 0 .06em .16em 0; margin: 0; font-weight: 720; font-stretch: 84%; line-height: .84; letter-spacing: -.015em; text-transform: lowercase; }
.lockup .ln { display: block; white-space: nowrap; }
.lockup .w.alt { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; letter-spacing: -.025em; }
.lockup .lk { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; font-size: .42em; letter-spacing: 0; margin-right: .14em; color: var(--acc); }
.lockup .sp { color: var(--acc); }
.lockup .c { display: inline-block; animation: drop .62s cubic-bezier(.2, 1.5, .35, 1) both; animation-delay: calc(var(--i) * 24ms); }
.lockup.still .c { animation: none; }
@keyframes drop { from { opacity: 0; transform: translateY(.45em) rotate(var(--r)) scale(.55); } }
@media (hover: hover) { .lockup .c:hover { animation: jiggle .5s ease; } }
@keyframes jiggle { 30% { transform: rotate(-9deg) translateY(-.06em); } 60% { transform: rotate(6deg); } }

/* ---------- buttons ---------- */
.big { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 60px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 800; font-size: 20px; letter-spacing: -.01em;
  box-shadow: 0 5px 0 var(--acc); transition: transform .12s, box-shadow .12s, background-color .6s, color .6s; }
.big .ico { width: 24px; height: 24px; }
.big:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--acc); }
.big.small { height: 52px; font-size: 18px; margin-top: 18px; }

/* ---------- intro ---------- */
.intro { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 22px calc(64px + var(--safe-b)); transition: opacity .5s, transform .6s var(--ease); }
.intro.out { opacity: 0; transform: translateY(-4%); pointer-events: none; }
.intro-type { flex: 1; min-height: 0; display: flex; align-items: center; }
.intro-foot { opacity: 0; animation: rise .8s 1.9s var(--ease) forwards; max-width: 460px; width: 100%; margin: 0 auto; }
.tag { margin: 0 0 20px; font-size: 18px; line-height: 1.35; opacity: .9; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.legal-link { position: absolute; left: 18px; bottom: calc(16px + var(--safe-b)); font-size: 11px; opacity: .45; text-decoration: none; }
.legal-link.in { position: static; display: inline-block; margin-top: 12px; }

/* ---------- app: one screen ---------- */
.app { position: relative; z-index: 1; height: 100vh; height: 100svh; max-width: 520px; margin: 0 auto; display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto; grid-template-columns: minmax(0, 1fr); gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(58px + var(--safe-b)); }
.app > * { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.mark { font-weight: 800; font-size: 21px; letter-spacing: -.04em; font-stretch: 85%; display: flex; align-items: center; gap: 1px; }
.mark .at { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; font-size: 26px; color: var(--acc); display: inline-block; animation: spin 7s linear infinite; }
@keyframes spin { 0%, 80% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
.pill { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--ink-15); font-weight: 800; }
.pill.bump { animation: bump .45s; }
@keyframes bump { 40% { transform: scale(1.2) rotate(-5deg); } }

.stage { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 0; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.stage .lockup { transition: transform .45s var(--ease), opacity .3s; }
.stage.drag .lockup { transition: none; }
.meaning { margin: 14px 0 0; font-family: "Instrument Serif", serif; font-style: italic; font-size: 19px; line-height: 1.2; opacity: .75;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; animation: fadeUp .6s .25s both; }
.meaning em { opacity: .65; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* ---------- profile row (how it looks on Instagram) ---------- */
.profile { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 22px; background: var(--ink-08); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; padding: 2px; border-radius: 16px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative;
  background: var(--acc); color: var(--bg); font-weight: 800; font-size: 19px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.who { min-width: 0; display: flex; flex-direction: column; }
.who b { font-size: 16px; font-weight: 800; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { font-size: 12px; opacity: .6; }
.who.wrap b { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; }
.who.wrap small { display: none; }
.me:active .avatar { transform: scale(.92); }
.ib { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; transition: transform .1s, background-color .2s; }
.ib .ico { width: 22px; height: 22px; }
.ib:active { transform: scale(.9); }
.ib.on { background: var(--acc); color: var(--bg); }
.ib.on .ico path { fill: currentColor; }

/* ---------- style row ---------- */
.styles { display: grid; grid-template-columns: repeat(4, 1fr) 58px; gap: 6px; }
.sty { height: 50px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12.5px; font-weight: 700; background: var(--ink-08); transition: background-color .2s, color .2s; white-space: nowrap; }
.sty .ico { width: 20px; height: 20px; }
.sty[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.sty.tune b { font-size: 10.5px; letter-spacing: .04em; }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .25s; }
.sheet { width: 100%; max-width: 520px; max-height: 82svh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink);
  border-radius: 24px 24px 0 0; padding: 16px 18px calc(62px + var(--safe-b)); animation: up .32s var(--ease); box-shadow: 0 -1px 0 var(--ink-30); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.035em; font-stretch: 85%; }
.lbl { margin: 14px 0 7px; font-size: 13px; font-weight: 700; opacity: .65; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--ink-08); border-radius: 14px; padding: 4px; height: 50px; }
.seg button { border-radius: 10px; font-weight: 700; font-size: 15px; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.word { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 6px 0 14px; border-radius: 14px; background: var(--ink-08); border: 2px solid transparent; }
.word:focus-within { border-color: var(--ink); }
.word .ico { width: 18px; height: 18px; opacity: .6; }
.word input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; font-weight: 600; }
.word input::placeholder { color: var(--ink-60); font-weight: 500; }
.x { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.saved-list { list-style: none; margin: 4px 0 0; padding: 0; overflow-y: auto; min-height: 0; }
.saved-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ink-15); }
.saved-list .dot { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.saved-list .nm { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; }
.saved-list .mini { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-08); text-decoration: none; flex: none; }
.empty { opacity: .7; display: flex; align-items: center; gap: 6px; margin: 14px 0; }
.empty .ico { display: inline-block; width: 1.1em; height: 1.1em; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 30; transform: translate(-50%, -20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: opacity .25s, transform .25s; pointer-events: none; max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- short phones ---------- */
@media (max-height: 700px) {
  .app { gap: 9px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .top { height: 34px; }
  .sty { height: 46px; gap: 2px; }
  .big { height: 54px; font-size: 18px; }
  .meaning { font-size: 17px; margin-top: 10px; }
  .avatar { width: 36px; height: 36px; font-size: 16px; }
  .ib { width: 40px; height: 40px; }
}
@media (max-width: 360px) { .sty { font-size: 11.5px; } .styles { grid-template-columns: repeat(4, 1fr) 50px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
