:root {
  --navy: #123b6d;
  --navy-strong: #0b2a50;
  --navy-soft: #eaf1f8;
  --gold: #c9a227;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f1f3f5;
  --text: #111827;
  --text-2: #4b5563;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d7dbe0;
  --error: #b42318;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-1: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 8px 24px rgba(16, 24, 40, 0.1);
  --shadow-3: 0 24px 60px rgba(16, 24, 40, 0.22);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #5b8fcb;
    --navy-strong: #6ea0da;
    --navy-soft: #16273b;
    --gold: #d4af37;
    --bg: #0b0d10;
    --surface: #15181c;
    --surface-subtle: #1c2025;
    --text: #f5f6f7;
    --text-2: #b7bec7;
    --text-muted: #879099;
    --border: #262b31;
    --border-strong: #343b42;
    --error: #e5534b;
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-3: 0 24px 60px rgba(0, 0, 0, 0.65);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
}

button,
[role='button'],
.tab,
.chip,
.switch-field,
.dropzone,
input[type='search'] {
  touch-action: manipulation;
}

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__brand img {
  border-radius: 8px;
}

.topbar__titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar__titles strong {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar__titles span {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar__status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.topbar__status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e9e5b;
  box-shadow: 0 0 0 3px rgba(46, 158, 91, 0.15);
}

.page {
  max-width: 940px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-subtle);
  border-radius: 999px;
  margin-bottom: 20px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.page-heading p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.item-count {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-field {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-field:focus-within {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-soft);
}

.search-field svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-field input {
  min-width: 0;
  flex: 1;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.search-field input:focus {
  box-shadow: none;
}

.search-field input::-webkit-search-cancel-button {
  appearance: none;
}

.search-field button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--text-2);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.tab.is-active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: var(--shadow-1);
}

.composer-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  font: inherit;
  color: var(--text-muted);
  text-align: left;
  transition: box-shadow 0.25s var(--ease), transform 0.15s var(--ease), border-color 0.2s var(--ease);
}

.composer-trigger:hover {
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
}

.composer-trigger:active {
  transform: scale(0.995);
}

.composer-trigger img {
  border-radius: 50%;
  flex-shrink: 0;
}

.composer-trigger span:not(.composer-trigger__plus) {
  flex: 1;
  font-size: 15px;
}

.composer-trigger__plus {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.feed {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pub {
  display: flex;
  gap: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.25s var(--ease), transform 0.2s var(--ease);
}

.pub:hover {
  box-shadow: var(--shadow-2);
}

.pub.is-new {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
}

.pub__thumb {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--navy), var(--navy-strong));
  flex-shrink: 0;
}

.pub__thumb--empty {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 24px;
}

.pub__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pub__cat {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pub__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pub__meta {
  font-size: 12px;
  color: var(--text-muted);
}

.pub__featured {
  align-self: flex-start;
  margin-top: 2px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.pub__actions {
  display: flex;
  gap: 8px;
  align-self: center;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.chip-remove {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  transition: transform 0.12s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease),
    color 0.2s var(--ease);
}

.primary-btn {
  border: 0;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  padding: 12px 22px;
  box-shadow: var(--shadow-1);
}

.primary-btn:hover {
  background: var(--navy-strong);
}

.primary-btn:active {
  transform: scale(0.97);
}

.primary-btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  padding: 11px 18px;
}

.ghost-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.icon-btn {
  border: 0;
  background: var(--surface-subtle);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.icon-btn:hover {
  background: var(--border);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn--danger:hover {
  background: color-mix(in srgb, var(--error) 12%, transparent);
  color: var(--error);
}

button:focus-visible,
[role='button']:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--navy-soft);
  outline-offset: 2px;
}

.pub__actions .icon-btn {
  width: 40px;
  height: 40px;
  font-size: 17px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 18, 32, 0.42);
  backdrop-filter: blur(3px);
  animation: fade 0.2s var(--ease);
}

body.has-overlay {
  overflow: hidden;
}

.sheet {
  width: min(880px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: pop 0.32s var(--ease);
}

.sheet--sm {
  width: min(420px, 100%);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.sheet__head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.sheet__body {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  padding: 22px;
  overflow-y: auto;
}

.sheet__body--single {
  display: block;
}

.sheet__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.sheet__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.sheet__error {
  color: var(--error);
  font-size: 13px;
  font-weight: 500;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field__label em {
  font-style: normal;
  font-weight: 400;
  color: var(--text-muted);
}

input[type='text'],
input[type='password'],
textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

#fTitle {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

select {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-soft);
}

.field__hint {
  min-height: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.field__hint.is-valid {
  color: #2e9e5b;
}

.field__hint.is-error {
  color: var(--error);
}

.switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.switch-field span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-field strong {
  font-size: 14px;
}

.switch-field small {
  color: var(--text-muted);
  font-size: 12px;
}

.switch-field input {
  appearance: none;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  position: relative;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.switch-field input::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.24);
  transition: transform 0.2s var(--ease);
}

.switch-field input:checked {
  background: var(--navy);
}

.switch-field input:checked::before {
  transform: translateX(18px);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.chip.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.dropzone.is-over {
  border-color: var(--navy);
  background: var(--navy-soft);
}

.dropzone__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 14px;
}

.dropzone__empty small {
  color: var(--text-muted);
  font-size: 12px;
}

.dropzone__icon {
  font-size: 26px;
}

.dropzone__preview {
  position: relative;
}

.dropzone__preview img {
  width: 100%;
  border-radius: 10px;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.chip-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: rgba(11, 18, 32, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
}

.chip-remove:hover {
  background: rgba(11, 18, 32, 0.9);
}

.preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.app-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}

.app-card__media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--navy), var(--navy-strong));
  background-size: cover;
  background-position: center;
}

.app-card__media--video {
  display: grid;
  place-items: center;
}

.app-card__play {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding-left: 3px;
  border-radius: 50%;
  background: rgba(11, 42, 80, 0.72);
  color: #fff;
  font-size: 18px;
}

.app-card__text {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-card__cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.app-card__text h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-card__date {
  font-size: 12px;
  color: var(--text-muted);
}

.notify {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.notify__details {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-subtle);
}

.notify-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lockscreen {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transition: border-color 0.2s var(--ease);
}

.lockscreen.is-priority {
  border-color: var(--gold);
}

.lockscreen__icon img {
  display: block;
  border-radius: 6px;
}

.lockscreen__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lockscreen__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lockscreen__title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lockscreen__body {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 16px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty strong {
  color: var(--text-2);
  font-size: 15px;
}

.empty .ghost-btn {
  margin-top: 8px;
}

.skeleton {
  height: 96px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 37%, #eef1f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  animation: toast-in 0.3s var(--ease);
}

.toast.is-error {
  background: var(--error);
}

.icon-btn:active,
.search-field button:active {
  transform: scale(0.9);
}

.ghost-btn:active,
.chip:active,
.chip-remove:active {
  transform: scale(0.96);
}

.tab:active {
  transform: scale(0.97);
}

.dropzone:active {
  transform: scale(0.995);
}

.tab,
.dropzone,
.search-field button {
  transition: transform 0.12s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.overlay.is-closing {
  animation: overlay-out 0.16s var(--ease) forwards;
  pointer-events: none;
}

.overlay.is-closing .sheet {
  animation: sheet-out 0.18s var(--ease) forwards;
}

.toast.is-leaving {
  animation: toast-out 0.18s var(--ease) forwards;
}

.primary-btn--danger {
  background: var(--error);
}

.primary-btn--danger:hover {
  background: color-mix(in srgb, var(--error) 86%, #000);
}

.confirm-message {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
}

@keyframes overlay-out {
  to {
    opacity: 0;
  }
}

@keyframes sheet-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

@keyframes shimmer {
  to {
    background-position: -400% 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding-inline: 16px;
  }
  .topbar__titles span,
  .topbar__status .dot,
  #lockLabel {
    display: none;
  }
  .topbar__status {
    gap: 0;
  }
  .topbar__status .ghost-btn {
    padding: 9px 12px;
  }
  .page {
    padding: 18px 16px 64px;
  }
  .tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tab {
    flex: 1 0 auto;
    padding-inline: 14px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .item-count {
    padding-top: 5px;
  }
  .sheet__body {
    grid-template-columns: 1fr;
  }
  .preview {
    order: -1;
  }
  .pub__thumb {
    width: 72px;
    height: 72px;
  }
  .pub {
    gap: 12px;
    padding: 12px;
  }
  .pub__actions {
    flex-direction: column;
    gap: 4px;
  }
  .overlay {
    padding: 0;
    place-items: end center;
  }
  .sheet {
    width: 100%;
    max-height: 96dvh;
    border-radius: 20px 20px 0 0;
  }
  .sheet--sm {
    width: 100%;
  }
  .sheet__head,
  .sheet__body,
  .sheet__foot {
    padding-inline: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
