/* =============================================================================
   ui/study.css — فضای مطالعه, the CSS half of the StudySpaceScreen.kt port.

   Every number here comes from the Kotlin file, not from taste:
     FocusBg   = vertical gradient #0B100E → #12241C → #0A121A
     FocusGrad = linear gradient #10B981 → #38BDF8
     FocusInk  = #06110C, FocusMint = #4ADE9F, FocusCyan = #38BDF8
     TimerRing  264dp box, 232dp canvas, 16dp stroke, 60 ticks, breath 1→1.03
                over 2400ms Reverse, halo alpha .07 → .22 over 700ms,
                progress tween 500ms
     GradCtl    82dp, press 0.90 spring, halo 1.04 → 1.26 over 1500ms Reverse
     CircleCtl  54dp, white .10
     LogButton  radius 22dp, shine sweep 2000ms LinearEasing Restart,
                press 0.96 spring, shadow 14dp fading over 400ms
     SegBtn     selected 1.0 / idle 0.96 bouncy spring
     PresetChip selected 1.05 bouncy spring, mint .20 fill, mint border
     SoundCard  radius 22dp, mint .16 fill + mint .55 border when active,
                emoji 30sp, slider 28dp revealed by AnimatedVisibility
   ========================================================================== */

/* The progress fraction is registered so the arc can be *animated* like the
   Compose tween(500) instead of jumping between frames. */
@property --p {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

.ss {
  direction: rtl;
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 20px);
  background: linear-gradient(180deg, #0B100E 0%, #12241C 52%, #0A121A 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* --------------------------------- header --------------------------------- */

.ss-head { width: 100%; max-width: 620px; display: flex; align-items: center; gap: 8px; }
.ss-ico {
  width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: transparent; color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: background 180ms ease, transform 140ms ease;
}
.ss-ico:hover { background: rgba(255,255,255,.08); }
.ss-ico:active { transform: scale(.9); }
.ss-title { flex: 1; text-align: center; font-size: 1.34rem; font-weight: 800; }

/* ------------------------------- mode toggle ------------------------------ */

.ss-seg {
  margin-top: 8px; display: flex; padding: 4px; gap: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
}
.ss-segb {
  border: 0; cursor: pointer;
  padding: 10px 26px; border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.72);
  font: inherit; font-weight: 500; font-size: .92rem;
  transform: scale(.96);
  transition: transform 460ms cubic-bezier(.2,1.5,.35,1), background 220ms ease, color 220ms ease;
}
.ss-segb.on {
  background: linear-gradient(120deg, #10B981, #38BDF8);
  color: #06110C; font-weight: 900;
  transform: scale(1);
}

/* ------------------------------ course chips ------------------------------ */

.ss-courses { width: 100%; max-width: 620px; margin-top: 14px; }
.ss-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.ss-chips::-webkit-scrollbar { display: none; }
.ss-chip {
  flex: none; cursor: pointer; white-space: nowrap;
  padding: 9px 15px; border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff; font: inherit; font-size: .9rem; font-weight: 600;
  transition: background 240ms ease, color 240ms ease, border-color 240ms ease, transform 150ms ease;
}
.ss-chip:active { transform: scale(.95); }
.ss-chip.on {
  background: linear-gradient(120deg, #10B981, #38BDF8);
  color: #06110C; border-color: transparent;
}
.ss-nocourse { color: #FB7185; font-size: .8rem; }

/* -------------------------------- the panel ------------------------------- */

.ss-panel { width: 100%; max-width: 620px; }
.ss-col { display: flex; flex-direction: column; align-items: center; }

/* ------------------------------- timer ring ------------------------------- */

.ss-ring {
  position: relative;
  width: 264px; height: 264px;
  margin-top: 20px;
  display: grid; place-items: center;
  --ring-a: #4ADE9F;
  --ring-b: #38BDF8;
  --p: 0;
  transition: --p 500ms linear;
}
.ss-ring.run { animation: spBreath 2400ms cubic-bezier(.4,0,.2,1) infinite alternate; }
@keyframes spBreath { from { transform: scale(1); } to { transform: scale(1.03); } }

.ss-halo {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(closest-side, var(--ring-a), transparent 74%);
  opacity: .07;
  transition: opacity 700ms ease, background 400ms ease;
}
.ss-ring.run .ss-halo { opacity: .22; }

.ss-ticks { position: absolute; inset: 0; }
.ss-tick {
  position: absolute; left: 50%; top: 50%;
  width: 1.3px; height: 4.2px; border-radius: 2px;
  background: rgba(255,255,255,.09);
  transform: translate(-50%,-50%) rotate(var(--a)) translateY(-111.5px);
}
.ss-tick.major {
  width: 2.4px; height: 8px;
  background: rgba(255,255,255,.22);
  transform: translate(-50%,-50%) rotate(var(--a)) translateY(-109.6px);
}

/* dim track: 190.4px circle with a 16px stroke, White .07 */
.ss-track {
  position: absolute;
  width: 190.4px; height: 190.4px; border-radius: 50%;
  border: 16px solid rgba(255,255,255,.07);
}

/* sweep-gradient progress arc: ringA → ringB → ringA, clipped to --p */
.ss-arc {
  position: absolute;
  width: 206.4px; height: 206.4px; border-radius: 50%;
  background: conic-gradient(from -90deg, var(--ring-a), var(--ring-b) 50%, var(--ring-a));
  -webkit-mask:
    conic-gradient(from -90deg, #000 calc(var(--p) * 360deg), transparent 0),
    radial-gradient(closest-side, transparent calc(100% - 16px), #000 calc(100% - 16px));
  mask:
    conic-gradient(from -90deg, #000 calc(var(--p) * 360deg), transparent 0),
    radial-gradient(closest-side, transparent calc(100% - 16px), #000 calc(100% - 16px));
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* عرض چهرهٔ رینگ هرگز از قطر داخلی تراک (۱۹۰٫۴px) بیشتر نمی‌شود؛
   کرنومتر hh:mm:ss است و با ۴۴px از دایره بیرون می‌زد. */
.ss-face {
  position: relative; z-index: 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 172px; max-width: 172px; overflow: hidden;
}
/* hh:mm:ss باید داخل قطر داخلی تراک (۱۹۰٫۴px) بماند؛ اندروید 44sp است ولی
   ارقام وزیرمتن پهن‌ترند، پس سقف امن + جمع‌شدن خودکار در JS. */
.ss-clock {
  font-size: clamp(22px, 7.2vw, 29px); font-weight: 900; line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; direction: ltr; unicode-bidi: isolate;
  letter-spacing: 0; max-width: 100%;
}
.ss-clock.big { font-size: clamp(28px, 9.5vw, 40px); letter-spacing: 0; }
.ss-sub {
  margin-top: 2px; font-size: .78rem; color: rgba(255,255,255,.7); transition: color 300ms ease;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ss-sub.live { color: #4ADE9F; }
.ss-mins {
  margin-top: 7px; padding: 4px 11px; border-radius: 999px;
  background: rgba(255,255,255,.10);
  color: rgba(255,255,255,.85); font-size: .7rem;
}
.ss-phase {
  padding: 4px 13px; border-radius: 999px;
  background: color-mix(in srgb, var(--ring-a) 16%, transparent);
  color: var(--ring-a); font-size: .82rem; font-weight: 700;
  transition: color 300ms ease, background 300ms ease;
}
.ss-dots { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.ss-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(74,222,159,.22);
  transition: width 400ms ease, height 400ms ease, background 400ms ease;
}
.ss-dot.on { width: 9px; height: 9px; background: #4ADE9F; }
.ss-dot-t { margin-inline-start: 6px; font-size: .7rem; color: rgba(255,255,255,.6); }

/* -------------------------------- controls -------------------------------- */

.ss-ctls { margin-top: 22px; display: flex; align-items: center; gap: 20px; }
.ss-ctl {
  width: 54px; height: 54px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: rgba(255,255,255,.10); color: #fff;
  display: grid; place-items: center;
  transition: background 200ms ease, transform 160ms cubic-bezier(.2,1.4,.4,1);
}
.ss-ctl:hover { background: rgba(255,255,255,.16); }
.ss-ctl:active { transform: scale(.9); }
.ss-ctl-spacer { width: 54px; height: 54px; }

.ss-grad-wrap { position: relative; width: 82px; height: 82px; display: grid; place-items: center; }
.ss-grad-halo {
  position: absolute; width: 82px; height: 82px; border-radius: 50%;
  background: rgba(74,222,159,.07);
  transform: scale(1.04);
  transition: background 500ms ease;
}
.ss-grad-wrap.active .ss-grad-halo {
  background: rgba(74,222,159,.18);
  animation: spHalo 1500ms cubic-bezier(.4,0,.2,1) infinite alternate;
}
@keyframes spHalo { from { transform: scale(1.04); } to { transform: scale(1.26); } }
.ss-grad {
  position: relative; width: 82px; height: 82px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: linear-gradient(120deg, #10B981, #38BDF8);
  color: #06110C;
  display: grid; place-items: center;
  box-shadow: 0 12px 26px rgba(0,0,0,.45);
  transition: transform 220ms cubic-bezier(.2,1.4,.4,1);
}
.ss-grad:active { transform: scale(.90); }

/* ------------------------------ preset chips ------------------------------ */

.ss-presets { margin-top: 18px; display: flex; gap: 8px; }
.ss-preset {
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
  font: inherit; font-size: .9rem;
  font-variant-numeric: tabular-nums;
  transition: transform 420ms cubic-bezier(.2,1.5,.35,1), background 220ms ease, color 220ms ease, border-color 220ms ease;
}
.ss-preset.on {
  background: rgba(74,222,159,.20);
  border-color: #4ADE9F; color: #4ADE9F; font-weight: 700;
  transform: scale(1.05);
}

.ss-pending {
  margin-top: 18px; padding: 7px 14px; border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.85); font-size: .84rem;
}

/* ------------------------------- log button ------------------------------- */

.ss-log {
  position: relative; overflow: hidden;
  margin-top: 20px;
  width: calc(100% - 16px); max-width: 604px;
  padding: 16px 18px; border: 0; border-radius: 22px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.32);
  font: inherit; font-size: 1rem; font-weight: 900; text-align: center;
  cursor: not-allowed;
  box-shadow: none;
  transition: background 400ms ease, color 400ms ease, box-shadow 400ms ease,
              transform 220ms cubic-bezier(.2,1.4,.4,1);
}
.ss-log.on {
  background: linear-gradient(120deg, #10B981, #38BDF8);
  color: #06110C; cursor: pointer;
  box-shadow: 0 14px 30px rgba(16,185,129,.35);
}
.ss-log.on:active { transform: scale(.96); }
.ss-log-t { position: relative; z-index: 2; }
.ss-shine { display: none; }
.ss-log.on .ss-shine {
  display: block; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.30), transparent);
  animation: spShine 2000ms linear infinite;
}
@keyframes spShine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.ss-warn { margin-top: 8px; color: #FBBF24; font-size: .74rem; }

/* --------------------------------- ambient -------------------------------- */

.ss-amb-head { width: 100%; max-width: 620px; margin-top: 26px; display: flex; align-items: center; gap: 8px; }
.ss-h2 { flex: 1; font-size: 1.06rem; font-weight: 800; }
.ss-stopall {
  border: 0; cursor: pointer;
  padding: 6px 10px; border-radius: 10px;
  background: rgba(251,113,133,.14); color: #FB7185;
  font: inherit; font-size: .82rem; font-weight: 700;
  animation: spPop 220ms cubic-bezier(0,0,.2,1) both;
}
@keyframes spPop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

.ss-sounds {
  width: 100%; max-width: 620px; margin-top: 12px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.ss-snd {
  padding: 14px; border-radius: 22px; cursor: pointer;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; align-items: center;
  transition: background 260ms ease, border-color 260ms ease, transform 150ms ease;
}
.ss-snd:active { transform: scale(.97); }
.ss-snd.on { background: rgba(74,222,159,.16); border-color: rgba(74,222,159,.55); }
.ss-snd-e { font-size: 30px; line-height: 1.16; }
.ss-snd-l { margin-top: 6px; font-size: .88rem; color: rgba(255,255,255,.75); }
.ss-snd.on .ss-snd-l { color: #fff; }
.ss-snd-v {
  width: 100%; height: 0; opacity: 0; overflow: hidden;
  transition: height 240ms cubic-bezier(0,0,.2,1), opacity 200ms ease;
}
.ss-snd.on .ss-snd-v { height: 28px; opacity: 1; }
.ss-slider { width: 100%; height: 28px; background: transparent; accent-color: #4ADE9F; cursor: pointer; }

.ss-tail { height: 30px; }

/* ------------------------------- music sheet ------------------------------ */

.ss-msec { margin: 10px 0 6px; font-size: .92rem; font-weight: 800; color: var(--primary); }
.ss-mrow {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border: 0; background: transparent; color: inherit;
  text-align: start; cursor: pointer; border-radius: 12px;
  transition: background 160ms ease;
}
.ss-mrow:hover { background: rgba(var(--primary-rgb) / .06); }
.ss-mic { display: grid; place-items: center; color: var(--primary); }
.ss-mic.list { color: var(--secondary); }
.ss-mtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ss-mtxt b { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-mtxt small { font-size: .72rem; color: var(--muted); }
.ss-mcount { font-size: .72rem; color: var(--muted); }
.ss-mempty { color: var(--muted); font-size: .82rem; }

/* -------------------------------- responsive ------------------------------ */

@media (max-width: 360px) {
  .ss { padding-inline: 14px; }
  .ss-face { width: 150px; max-width: 150px; }
  .ss-clock { font-size: 24px; }
  .ss-clock.big { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .ss-ring.run,
  .ss-grad-wrap.active .ss-grad-halo,
  .ss-log.on .ss-shine { animation: none; }
}

/* --- offline saved parts: dozens of parts can wait here safely --- */
.ss-off{margin:14px 16px 0;padding:12px;border-radius:18px;min-width:0;
  background:linear-gradient(180deg,rgba(var(--primary-rgb) /.10),rgba(var(--primary-rgb) /.03));
  border:1px solid rgba(var(--primary-rgb) /.22);animation:ssOffIn .32s var(--e-decel) both}
@keyframes ssOffIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.ss-off-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;min-width:0}
.ss-off-t{display:flex;align-items:center;gap:6px;min-width:0}
.ss-off-t b{font-size:14px}
.ss-off-n{min-width:22px;height:22px;padding:0 6px;border-radius:11px;display:grid;place-items:center;
  font-size:12px;font-weight:700;background:rgba(var(--primary-rgb) /.9);color:var(--on-primary-c)}
.ss-off-sum{font-size:12px;opacity:.75}
.ss-off-list{margin-top:10px;display:flex;flex-direction:column;gap:6px;max-height:230px;overflow-y:auto;overflow-x:hidden}
.ss-off-row{display:flex;align-items:center;gap:10px;min-width:0;padding:8px 10px;border-radius:14px;
  background:rgba(255,255,255,.04);animation:ssOffIn .26s var(--e-decel) both}
.ss-off-min{flex:0 0 auto;font-weight:800;font-size:13px;font-variant-numeric:tabular-nums;
  padding:4px 8px;border-radius:10px;background:rgba(var(--primary-rgb) /.16)}
.ss-off-body{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:2px}
.ss-off-body b{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ss-off-body small{font-size:11px;opacity:.65}
.ss-off-x{flex:0 0 auto;width:30px;height:30px;border-radius:10px;border:0;background:transparent;
  color:inherit;opacity:.6;cursor:pointer;transition:opacity var(--t-fast),transform var(--t-fast)}
.ss-off-x:hover{opacity:1;transform:scale(1.08)}
.ss-off-send{margin-top:10px;width:100%;height:42px;border:0;border-radius:14px;cursor:pointer;
  font-weight:700;font-size:14px;color:var(--on-primary-c);
  background:linear-gradient(135deg,rgba(var(--primary-rgb) /1),rgba(var(--primary-rgb) /.72));
  transition:transform var(--t-fast),filter var(--t-fast)}
.ss-off-send:active{transform:scale(.97)}
.ss-off-send:disabled{filter:grayscale(.6);opacity:.6;cursor:default}
@media (prefers-reduced-motion:reduce){.ss-off,.ss-off-row{animation:none}}
