/* ===== Binder chrome: leather, stitching, paper stacks, spine, rings, tabs ===== */
:root {
  --paper: #eeeeee;
  --ink: #111111;
  --ink2: #2b2b2b;
  --ink3: #595959;
  --rule: #dcdcdc;
  --blue: #2e86f0;
  --H: 846px;
  --f-ui: 'Figtree', 'Nunito Sans', 'Helvetica Neue', Arial, sans-serif;
  --f-thin: 'Quicksand', 'Comfortaa', 'Avenir Next', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #121214; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--f-ui); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body:not(.phone) { -webkit-font-smoothing: auto; }
#stage { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #2c2c31 0%, #17171a 55%, #0c0c0e 100%); touch-action: pan-y; }
#binder { position: absolute; left: 0; top: 0; width: 1400px; height: var(--H); transform-origin: 0 0; user-select: none; -webkit-user-select: none; }
#binder [contenteditable], #binder input, #binder textarea, #binder .selectable { user-select: text; -webkit-user-select: text; }
/* Safari: typed text inherits the 'none' from the binder unless every piece inside an editor says 'text' too */
#binder [contenteditable] *, #binder .selectable * { user-select: text; -webkit-user-select: text; }
#binder [contenteditable=true] { -webkit-user-modify: read-write; }
button { font-family: inherit; }

/* ---------- leather ---------- */
.leather-outer {
  position: absolute; inset: 0; border-radius: 31px; overflow: hidden;
  background:
    var(--leather-tex-soft),
    linear-gradient(180deg, rgba(255,150,140,.20) 0, rgba(255,150,140,0) 3px),
    linear-gradient(180deg, #a2403f 0%, #983837 40%, #8f3030 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,190,180,.85),
    inset 1px 0 0 rgba(255,160,150,.45),
    inset -1px 0 0 rgba(255,130,120,.30),
    inset 0 -1px 0 rgba(255,120,110,.25),
    inset 0 3px 5px rgba(255,170,160,.28),
    inset 0 -5px 8px rgba(70,0,0,.35);
}
.leather-inner {
  position: absolute; left: 14px; top: 14px; right: 14px; bottom: 18px; border-radius: 26px;
  background:
    var(--leather-tex),
    radial-gradient(ellipse at 50% 38%, rgba(160,70,58,.22) 0%, rgba(160,70,58,0) 70%),
    #702c27;
  box-shadow:
    0 0 0 1px rgba(58,15,12,.95),
    0 1px 0 1px rgba(255,140,130,.22),
    inset 0 0 20px rgba(26,4,3,.42),
    inset 0 3px 5px rgba(20,3,2,.45);
}
.stitch { position: absolute; left: 0; top: 0; pointer-events: none; }
.pocket {
  position: absolute; left: 15px; width: 29px; bottom: 19px; height: 232px; z-index: 1;
  clip-path: polygon(0 0, 100% 14px, 100% 100%, 0 100%);
  background: var(--leather-tex-soft), linear-gradient(180deg, #7f3223 0%, #70261c 40%, #692119 100%);
  box-shadow: inset 0 2px 1px rgba(190,95,70,.55), inset -2px 0 4px rgba(0,0,0,.25);
}

/* ---------- toolbar ---------- */
#toolbar { position: absolute; right: 34px; top: 14px; height: 20px; display: flex; align-items: center; z-index: 20; color: #fff; }
#toolbar .tb { background: none; border: 0; color: #fff; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); position: relative; }
#toolbar .tb svg { display: block; }
#toolbar .theme { font: 500 12.5px var(--f-ui); margin-right: 20px; letter-spacing: .1px; }
#toolbar .tb.i { width: 24px; height: 20px; margin-left: 2px; }
#toolbar .tb.caldate { width: 26px; height: 24px; } #toolbar .tb.caldate.on svg { outline: 2px solid #68bde2; outline-offset: 2px; border-radius: 6px; }
#toolbar .dot { position: absolute; right: 2px; top: 1px; width: 6px; height: 6px; border-radius: 50%; background: #ffb340; }

/* ---------- paper pages ---------- */
.page {
  position: absolute; top: 38px; bottom: 28px; z-index: 3; overflow: hidden;
  background: var(--paper-tex), var(--paper);
  color: var(--ink);
}
#pgL { left: 44px; width: 644px; border-radius: 28px 26px 26px 28px; box-shadow: inset -12px 0 14px -12px rgba(0,0,0,.10); }
#pgR { left: 712px; width: 642px; border-radius: 26px 28px 28px 26px; box-shadow: inset 12px 0 14px -12px rgba(0,0,0,.10); }
.pg-inner { position: absolute; inset: 0; }
.curl { position: absolute; width: 36px; height: 36px; bottom: 2px; pointer-events: none; z-index: 5; }
.curl path { fill: none; stroke: #8f8f93; stroke-width: 1; stroke-dasharray: 1 2.2; opacity: .55; stroke-linecap: round; }
#pgL .curl { left: 1px; }
#pgR .curl { right: 1px; transform: scaleX(-1) scaleY(1); }
#pgR .curl { transform: scaleX(-1); }

.stack { position: absolute; top: 38px; bottom: 28px; z-index: 2; }
.stack-l { left: 44px; width: 644px; }
.stack-r { left: 712px; width: 642px; }
.stack i { position: absolute; inset: 0; border-radius: 28px; }
.stack-l i { border-radius: 28px 26px 26px 28px; }
.stack-r i { border-radius: 26px 28px 28px 26px; }
.stack i:nth-child(1) { background: #a3a4a8; transform: translate(calc(var(--sx) * 4), 9.6px); box-shadow: 0 3px 7px rgba(25,0,0,.55); }
.stack i:nth-child(2) { background: #8f9094; transform: translate(calc(var(--sx) * 3), 7.2px); }
.stack i:nth-child(3) { background: #b9babe; transform: translate(calc(var(--sx) * 2), 4.8px); }
.stack i:nth-child(4) { background: #e4e2e5; transform: translate(calc(var(--sx) * 1), 2.4px); }
.stack-l { --sx: -1.55px; }
.stack-r { --sx: 1.4px; }

/* ---------- spine ---------- */
.spine {
  position: absolute; left: 688px; top: 66px; width: 24px; bottom: 60px; z-index: 6;
  background:
    linear-gradient(90deg, #a3a7b0 0%, #414d59 9%, #8d97a3 17%, #f7faff 27%, #f1f1f3 40%, #ced3d9 50%, #c2c9d1 58%, #e4e5e9 68%, #f5f6fa 78%, #dfe6ec 88%, #5b656f 94%, #363f48 100%);
  border-radius: 1px 1px 5px 5px / 1px 1px 9px 9px;
  box-shadow: 0 0 3px rgba(0,0,0,.25);
}
.spine::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 9px; border-radius: 0 0 5px 5px / 0 0 9px 9px; background: linear-gradient(180deg, rgba(40,50,62,0) 0%, rgba(40,50,62,.45) 100%); }
.spine::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 7px; background: linear-gradient(180deg, rgba(40,20,18,.5), rgba(40,20,18,0)); }
.fillet {
  position: absolute; left: 640px; width: 120px; top: calc(var(--H) - 62px); bottom: 18px; z-index: 7;
  clip-path: path('M48 0 V14 C48 27 40 35 27 36 C20 36.5 14 37 8 37 V44 H112 V37 C106 37 100 36.5 93 36 C80 35 72 27 72 14 V0 Z');
  background:
    var(--leather-tex),
    linear-gradient(180deg, rgba(0,0,0,.30) 0%, rgba(0,0,0,0) 40%),
    #702c27;
  background-position: -626px calc(-1 * (var(--H) - 62px) + 14px);
}
#rings { position: absolute; left: 0; top: 0; width: 1400px; height: var(--H); z-index: 8; pointer-events: none; }
#rings svg { position: absolute; left: 638px; overflow: visible; }

/* ---------- tabs ---------- */
#tabs { position: absolute; left: 0; top: 0; width: 1400px; height: var(--H); z-index: 12; pointer-events: none; }
.tab { position: absolute; width: 38px; pointer-events: auto; cursor: pointer; filter: drop-shadow(0 1.5px 1.5px rgba(0,0,0,.38)); transition: transform .25s; }
.tab.r { left: 1353px; }
.tab.l { left: 9px; }
.tab .sh { position: absolute; inset: 0; background: var(--g); }
.tab .sh::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(-52deg, rgba(255,255,255,.085) 0 1px, rgba(0,0,0,.05) 1px 2.4px), linear-gradient(90deg, rgba(0,0,0,.34) 0, rgba(0,0,0,0) 9px), linear-gradient(180deg, rgba(255,255,255,.28) 0, rgba(255,255,255,0) 14px); }
.tab.l .sh { transform: scaleX(-1); }
.tab .lbl {
  position: absolute; left: 0; width: 38px; display: flex; align-items: center; justify-content: center; text-align: center;
  font: 500 14.5px/1.12 var(--f-ui); color: #fff; letter-spacing: .1px; text-shadow: 0 1px 1.5px rgba(0,0,0,.45);
  white-space: nowrap;
}
.tab .lbl span { display: block; writing-mode: vertical-rl; }
.tab.l .lbl span { transform: rotate(180deg); }
.tab .lbl span.two { white-space: normal; font-size: 12px; line-height: 1.12; height: 128px; text-align: center; }
.tab.plus .lbl { font-size: 17px; font-weight: 400; }
.tab.plus .lbl span { writing-mode: horizontal-tb; }
.tab:hover .sh::before { filter: brightness(1.12); }

/* ---------- misc ---------- */
.flip { position: fixed; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 50; border: 0; border-radius: 999px; padding: 9px 20px; background: rgba(20,20,24,.78); color: #fff; font: 600 13px var(--f-ui); letter-spacing: .2px; backdrop-filter: blur(6px); }
#toast { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: rgba(24,24,28,.9); color: #fff; font: 500 13px var(--f-ui); padding: 9px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; white-space: nowrap; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#overlay { position: absolute; inset: 0; z-index: 100; pointer-events: none; }
#overlay > * { pointer-events: auto; }

/* page turn (content swap) */
.pg-inner { transition: opacity .16s ease; }
.pg-inner.out { opacity: 0; }

body.phone #binder { transition: transform .35s cubic-bezier(.3,.7,.2,1); }

#rings.blue-right .rg.top .rtint { opacity: 1; }
body:not(.phone) .leather-outer { border-radius: 0; }
body:not(.phone) #stage { background: #8f3030; }
