/* Kinoteka account page. System fonts only (the page's content security policy allows no web fonts). */
:root {
  --bg: #07080c;
  --s1: #0c0e15;
  --s2: #11141f;
  --s3: #171b2a;
  --s4: #1e2335;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #eef0f7;
  --text-2: #b6bcd0;
  --muted: #7f879d;
  --accent: #4f8eff;
  --accent-2: #7cb3ff;
  --violet: #9d7cf5;
  --good: #3dd68c;
  --warn: #f5a623;
  --bad: #f2555a;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--font); line-height: 1.5; font-size: 15px;
  background: var(--bg);
}
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent-2); }
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.ico { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.ico svg, .empty-ico svg, .act-ico svg, .stat-ico svg, .tab-ico svg { width: 100%; height: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ───────── header ───────── */
.top {
  position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 12, .72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.top-in { max-width: 1060px; margin: 0 auto; padding: 0 20px; height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand img { display: block; height: 32px; width: auto; }
.top-right { display: flex; align-items: center; gap: 8px; }
.user { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px 0 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--s2); margin-right: 4px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
  background: var(--accent); text-transform: uppercase;
}
.user-mail { font-size: 13px; color: var(--text-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--s2); color: var(--text-2); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.top-right .chip { height: 40px; padding: 0 16px; font-size: 13px; }
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, .24); background: var(--s3); }

.wrap { max-width: 1060px; margin: 0 auto; padding: 28px 20px 80px; }

/* ───────── buttons, fields, notices ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none; cursor: pointer;
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--s3); color: var(--text); font-size: 14px; font-weight: 650;
  transition: transform .12s, border-color .15s, background .15s;
}
.btn:hover { border-color: rgba(255, 255, 255, .26); background: var(--s4); }
.btn:active { transform: translateY(1px); }
.btn.primary { border: none; color: #fff; background: var(--accent); }
.btn.primary:hover { background: #6ea3ff; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.error { color: var(--bad); font-size: 13px; margin-top: 10px; display: none; }
.error.show { display: block; }
.notice.good {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 14px 18px; border-radius: var(--r-md); font-size: 14px;
  background: rgba(61, 214, 140, .09); border: 1px solid rgba(61, 214, 140, .35);
}
.notice.good b { color: var(--good); font-size: 22px; letter-spacing: .05em; }

/* ───────── signed-out card ───────── */
.card { background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.card.narrow { max-width: 460px; margin: 28px auto 0; padding: 30px; position: relative; }
/* ───────── greeting and summary ───────── */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 24px; align-items: end; margin-bottom: 26px; }
.hero-title { font-size: clamp(28px, 4vw, 40px); font-weight: 750; line-height: 1.1; overflow-wrap: anywhere; }
.hero-sub { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.hero-sub b { color: var(--text-2); font-weight: 600; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.sum {
  background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px;
  display: grid; gap: 2px; min-width: 0;
}
.sum b { font-size: 22px; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sum span { font-size: 12px; color: var(--muted); }
.sum.accent b { color: var(--accent-2); }
.sum.good b { color: var(--good); }
.sum.violet b { color: var(--violet); }

/* ───────── tabs ───────── */
.seg { display: inline-flex; gap: 4px; padding: 5px; margin-bottom: 24px; background: var(--s1); border: 1px solid var(--line); border-radius: 16px; max-width: 100%; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 9px; background: none; border: 1px solid transparent; color: var(--muted); padding: 10px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 650; cursor: pointer; white-space: nowrap; transition: color .15s, background .15s;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); background: var(--s4); border-color: var(--line-2); }
.tab.active .tab-ico { color: var(--accent-2); }
.tab-ico { display: inline-flex; width: 17px; height: 17px; }
.panel { animation: rise .22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sec-head { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 14px; }
.sec-head h2 { font-size: 17px; font-weight: 700; }
.count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--s3); border-radius: 999px; padding: 2px 9px; }

/* ───────── action cards ───────── */
.acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.act {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--s2); transition: transform .18s, border-color .18s;
}
.act:hover { transform: translateY(-2px); border-color: var(--line-2); }
.act.free { border-color: rgba(79, 142, 255, .45); background: rgba(79, 142, 255, .08); }
.act h3 { font-size: 16px; font-weight: 700; margin-top: 10px; }
.act p { font-size: 13.5px; flex: 1; margin-bottom: 14px; }
.act .btn { align-self: flex-start; }
.act-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; padding: 10px; background: var(--accent); }
.act-ico.buy { background: var(--violet); }
.act-ico.app { background: #2fcf9a; }

/* ───────── codes ───────── */
.list { display: grid; gap: 12px; }
.code-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 18px 20px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--s2); position: relative; overflow: hidden; transition: border-color .18s, transform .18s;
}
.code-card:hover { border-color: var(--line-2); }
.code-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; padding: 11px; grid-row: span 3; color: #fff; background: var(--accent); }
.code-ico.free { background: var(--violet); }
.code-ico.expired { background: var(--s4); color: var(--muted); }
.code-ico svg { width: 100%; height: 100%; }
.code-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.num { font-size: 21px; font-weight: 750; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.copy { display: inline-flex; align-items: center; gap: 6px; background: var(--s3); color: var(--text-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 5px 10px; font-size: 12px; font-weight: 650; cursor: pointer; }
.copy:hover { color: var(--text); border-color: rgba(255, 255, 255, .26); }
.copy svg { width: 14px; height: 14px; flex: none; }
.badge { justify-self: end; font-size: 11px; font-weight: 750; padding: 4px 11px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; }
.badge.active { background: rgba(61, 214, 140, .14); color: var(--good); }
.badge.unused { background: rgba(79, 142, 255, .16); color: var(--accent-2); }
.badge.expired, .badge.disabled { background: rgba(242, 85, 90, .14); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 2 / 4; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); background: var(--s3); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.pill { white-space: nowrap; }
.pill svg { width: 13px; height: 13px; flex: none; color: var(--muted); }
.pill.violet { color: #c9b6ff; border-color: rgba(157, 124, 245, .35); background: rgba(157, 124, 245, .1); }
.time { grid-column: 2 / 4; margin-top: 6px; }
.time-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.time-row b { color: var(--text); font-weight: 650; }
.meter { height: 6px; background: var(--s4); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.good i { background: var(--good); }
.meter.low i { background: var(--warn); }
.meter.done i { background: var(--good); }

/* ───────── favorites ───────── */
.fav-code { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fav-code label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.select { position: relative; }
.select select {
  -webkit-appearance: none; appearance: none; background: var(--s2); border: 1px solid var(--line-2); border-radius: 12px; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; padding: 11px 42px 11px 16px; cursor: pointer; min-width: 260px; max-width: 100%;
}
.select select:focus { outline: 2px solid rgba(79, 142, 255, .45); border-color: var(--accent); }
.select::after { content: ""; position: absolute; right: 17px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.searchbar { display: flex; gap: 10px; margin-bottom: 6px; align-items: stretch; }
.searchfield { position: relative; flex: 1; min-width: 0; }
.searchfield .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
#search-status { margin: 8px 2px 0; }
.sync-note { margin: -4px 0 14px; }
.searchbar input {
  width: 100%; min-width: 0; background: var(--s2); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px 14px 46px; color: var(--text); font: inherit; font-size: 15px;
}
.searchbar input:focus { outline: 2px solid rgba(79, 142, 255, .45); outline-offset: 0; border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.tile { position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--s2); border: 1px solid var(--line); transition: transform .2s, border-color .2s; }
.tile:hover { transform: translateY(-4px); border-color: var(--line-2); }
.tile img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: var(--s3); }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px 11px; background: rgba(5, 6, 10, .86); }
.tile .cap b { display: block; font-size: 13.5px; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .cap span { display: block; margin-top: 3px; color: var(--text-2); font-size: 11.5px; opacity: .85; }
.heart {
  position: absolute; top: 9px; right: 9px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .15); cursor: pointer;
  background: rgba(8, 9, 14, .6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; display: grid; place-items: center; padding: 0; transition: transform .15s, color .15s, background .15s;
}
.heart svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.heart:hover { transform: scale(1.1); }
.heart.on { color: #ff5d73; background: rgba(255, 93, 115, .16); border-color: rgba(255, 93, 115, .4); }
.heart.on svg { fill: currentColor; }

/* ───────── watched ───────── */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat { background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: grid; gap: 4px; }
.stat-ico { width: 34px; height: 34px; border-radius: 11px; padding: 8px; margin-bottom: 8px; background: rgba(79, 142, 255, .14); color: var(--accent-2); }
.stat:nth-child(2) .stat-ico { background: rgba(157, 124, 245, .14); color: var(--violet); }
.stat:nth-child(3) .stat-ico { background: rgba(245, 166, 35, .14); color: var(--warn); }
.stat:nth-child(4) .stat-ico { background: rgba(47, 207, 154, .14); color: #2fcf9a; }
.stat:nth-child(5) .stat-ico { background: rgba(61, 214, 140, .14); color: var(--good); }
.stat b { font-size: 21px; font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
.watch-row { display: flex; gap: 16px; align-items: center; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; transition: border-color .18s; }
.watch-row:hover { border-color: var(--line-2); }
.watch-row img { width: 62px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--s3); flex: none; }
.watch-row .info { flex: 1; min-width: 0; display: grid; gap: 6px; }
.watch-row .info b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-row .info span { color: var(--muted); font-size: 12.5px; }
.watch-row .pct { font-size: 12px; font-weight: 700; color: var(--text-2); flex: none; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.watch-row .pct.done { color: var(--good); }

/* ───────── empty and loading ───────── */
.empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 40px 16px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: rgba(255, 255, 255, .015); }
.empty-ico { width: 52px; height: 52px; padding: 14px; border-radius: 16px; background: var(--s3); color: var(--accent-2); }
.empty p { max-width: 360px; font-size: 14px; }
.loading { display: grid; place-items: center; padding: 90px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--s3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── small screens ───────── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .acts { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:last-child:nth-child(odd) { grid-column: span 2; }
}
@media (max-width: 560px) {
  .wrap { padding: 20px 14px 70px; }
  .top-in { padding: 0 14px; height: 72px; }
  .user-mail { display: none; }
  .top-right .chip { padding: 0 14px; }
  .user { padding: 0 5px; margin-right: 0; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg { display: flex; }
  .tab { flex: 1; justify-content: center; padding: 10px 8px; }
  .tab-label { display: none; }
  .tab.active .tab-label { display: inline; }
  .code-card { grid-template-columns: minmax(0, 1fr) auto; padding: 16px; }
  .code-ico { display: none; }
  .chips, .time { grid-column: 1 / 3; }
  .num { font-size: 19px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
  .card.narrow { padding: 24px 18px; }
  .searchbar .btn { padding: 11px 14px; }
  /* the buy and app cards sit as compact rows under the free-code card */
  .act:not(.free) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 16px; }
  .act:not(.free) .act-ico { grid-row: span 3; }
  .act:not(.free) h3 { margin-top: 0; }
  .act:not(.free) p { margin-bottom: 8px; font-size: 13px; }
  .act:not(.free) .btn { grid-column: 2; padding: 9px 14px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  .tile, .act, .btn { transition: none; }
}
