/* =========================================================
   4HE / ADDNEWS
   Add post page, media fields, category UI, tags and safety
   ========================================================= */

/* =========================
   PAGE RESET
   ========================= */

.addnews-page {
  display: grid;
  gap: 14px;
  color: var(--text);
}

.addnews-page .subsite-card,
.addnews-page .subsite-card__body {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none !important;
  overflow: visible;
}

/* =========================
   HERO
   ========================= */

.addnews-head {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 20px 22px 18px;
  background:
    radial-gradient(circle at 92% 10%, rgba(155, 234, 60, 0.14), transparent 20%),
    radial-gradient(circle at 84% 0%, rgba(155, 234, 60, 0.08), transparent 28%),
    linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-xs);
}

.addnews-head::before {
  content: "";
  position: absolute;
  top: -34px;
  right: -26px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(155, 234, 60, 0.08);
  filter: blur(28px);
  pointer-events: none;
}

.addnews-head::after {
  content: "";
  position: absolute;
  top: -18px;
  right: 42px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(155, 234, 60, 0.06);
  filter: blur(18px);
  pointer-events: none;
}

.addnews-head__title,
.addnews-head__text {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.addnews-head__title {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.addnews-head__text {
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.6;
}

/* =========================
   SHELL / BLOCKS
   ========================= */

.addnews-shell {
  display: grid;
  gap: 14px;
}

.addnews-block,
.addnews-block__body,
.addnews-field,
.addnews-control,
.addnews-category-control,
.addnews-category-ui {
  overflow: visible;
}

.addnews-block {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-xs);
}

.addnews-block:first-child {
  z-index: 60;
}

.addnews-block__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 8px;
}

.addnews-block__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.addnews-block__title .i-svg {
  width: 18px;
  height: 18px;
  color: var(--accent-main);
  flex: 0 0 auto;
}

.addnews-block__body {
  padding: 8px 18px 18px;
}

/* =========================
   FIELDS
   ========================= */

.addnews-field {
  margin: 0 0 16px;
}

.addnews-field:last-child {
  margin-bottom: 0;
}

.addnews-label {
  display: block;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.addnews-control {
  min-width: 0;
}

.addnews-control input[type="text"],
.addnews-control input[type="url"],
.addnews-control input[type="email"],
.addnews-control input[type="number"],
.addnews-control input[type="password"],
.addnews-control textarea,
.addnews-control select,
.addnews-captcha input[type="text"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.addnews-control input[type="text"],
.addnews-control input[type="url"],
.addnews-control input[type="email"],
.addnews-control input[type="number"],
.addnews-control input[type="password"],
.addnews-control select,
.addnews-captcha input[type="text"] {
  height: 48px;
  padding: 0 15px;
}

.addnews-control textarea {
  min-height: 180px;
  padding: 14px 15px;
  resize: vertical;
  line-height: 1.64;
}

.addnews-control input::placeholder,
.addnews-control textarea::placeholder,
.addnews-captcha input::placeholder {
  color: var(--text-fade);
}

.addnews-control input:hover,
.addnews-control textarea:hover,
.addnews-control select:hover,
.addnews-captcha input:hover {
  background: var(--surface);
  border-color: rgba(45, 123, 255, 0.18);
}

.addnews-control input:focus,
.addnews-control textarea:focus,
.addnews-control select:focus,
.addnews-captcha input:focus {
  outline: none;
  background: var(--surface);
  border-color: rgba(45, 123, 255, 0.32);
  box-shadow: 0 0 0 4px rgba(45, 123, 255, 0.09);
}

/* =========================
   CATEGORY UI
   ========================= */

.addnews-category-control,
.addnews-category-ui {
  position: relative;
  z-index: 80;
}

.addnews-category-control select.addnews-category-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.addnews-category-ui__trigger::before,
.addnews-category-ui__trigger::after,
.addnews-category-ui__trigger-icon::before,
.addnews-category-ui__trigger-icon::after,
.addnews-category-control::before,
.addnews-category-control::after {
  content: none !important;
  display: none !important;
}

.addnews-category-ui__trigger {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1.2;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.addnews-category-ui__trigger:hover {
  background: var(--surface) !important;
  border-color: rgba(45, 123, 255, 0.18) !important;
}

.addnews-category-ui.is-open .addnews-category-ui__trigger {
  background: var(--surface) !important;
  border-color: rgba(45, 123, 255, 0.32) !important;
  box-shadow: 0 0 0 4px rgba(45, 123, 255, 0.09) !important;
}

.addnews-category-ui__trigger-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
}

.addnews-category-ui__trigger-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-main);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.addnews-category-ui__trigger-icon .ui-icon,
.addnews-category-ui__trigger-icon .i-svg,
.addnews-category-ui__trigger-icon svg {
  width: 16px !important;
  height: 16px !important;
  display: block;
}

.addnews-category-ui__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 500 !important;
  padding: 6px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-md) !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s ease;
}

.addnews-category-ui.is-open .addnews-category-ui__dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.addnews-category-ui__list {
  display: grid;
  gap: 2px;
  max-height: 280px;
  overflow: auto;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.addnews-category-ui__item {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 500;
  box-shadow: none !important;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.addnews-category-ui__item:hover {
  background: var(--surface-2) !important;
}

.addnews-category-ui__item.is-selected {
  background: var(--accent-main-soft) !important;
  color: var(--accent-main) !important;
}

.addnews-category-ui__item.is-disabled,
.addnews-category-ui__item:disabled {
  opacity: 0.45;
  cursor: default;
}

/* =========================
   MEDIA
   ========================= */

.addnews-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.addnews-media-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: none !important;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease;
}

.addnews-media-card:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 123, 255, 0.18);
}

.addnews-media-card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 15px 12px;
}

.addnews-media-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--accent-main-soft);
  color: var(--accent-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.addnews-media-card__icon .i-svg {
  width: 18px;
  height: 18px;
}

.addnews-media-card__meta {
  min-width: 0;
}

.addnews-media-card__title {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 600;
}

.addnews-media-card__text {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.52;
}

.addnews-media-card__body {
  padding: 0 15px 15px;
}

.addnews-media-card__body input[type="text"],
.addnews-media-card__body input[type="url"],
.addnews-media-card__body textarea,
.addnews-media-card__body input[type="file"] {
  width: 100%;
}

.addnews-media-card__body input[type="text"],
.addnews-media-card__body input[type="url"],
.addnews-media-card__body textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 15px;
}

.addnews-media-card__body input[type="text"]:focus,
.addnews-media-card__body input[type="url"]:focus,
.addnews-media-card__body textarea:focus {
  background: var(--surface);
  border-color: rgba(45, 123, 255, 0.32);
  box-shadow: 0 0 0 4px rgba(45, 123, 255, 0.09);
}

.addnews-media-card__body input[type="file"] {
  padding: 12px 0;
  color: var(--text);
  font-size: 14px;
}

.addnews-media-card--gallery .addnews-media-card__icon {
  background: var(--accent-hot-soft);
  color: #6aa51d;
}

.addnews-media-card--gallery:hover {
  border-color: rgba(155, 234, 60, 0.28);
}

/* =========================
   DESCRIPTION / EDITOR
   ========================= */

.addnews-editor {
  position: relative;
}

.addnews-editor > .bb-editor,
.addnews-editor > .wseditor,
.addnews-editor > textarea,
.addnews-editor #short_story {
  width: 100%;
}

.addnews-editor textarea,
.addnews-editor #short_story,
.addnews-block [name="short_story"] {
  width: 100%;
  min-height: 250px;
  padding: 16px 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.72;
  letter-spacing: -0.01em;
  resize: vertical;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.addnews-editor textarea::placeholder,
.addnews-editor #short_story::placeholder,
.addnews-block [name="short_story"]::placeholder {
  color: var(--text-fade);
}

.addnews-editor textarea:hover,
.addnews-editor #short_story:hover,
.addnews-block [name="short_story"]:hover {
  background: var(--surface);
  border-color: rgba(45, 123, 255, 0.18);
}

.addnews-editor textarea:focus,
.addnews-editor #short_story:focus,
.addnews-block [name="short_story"]:focus {
  outline: none;
  background: var(--surface);
  border-color: rgba(45, 123, 255, 0.32);
  box-shadow: 0 0 0 4px rgba(45, 123, 255, 0.09);
}

.addnews-editor .bb-editor,
.addnews-editor .bb-pane,
.addnews-editor .wseditor .ws_toolbar,
.addnews-editor .wseditor .wseditor-toolbar,
.addnews-page .bb-pane,
.addnews-page .wseditor .ws_toolbar,
.addnews-page .wseditor .wseditor-toolbar {
  margin: 0 0 10px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: none !important;
}

.addnews-editor .bb-btn,
.addnews-editor .editor_button,
.addnews-editor .editor-btn,
.addnews-page .bb-btn,
.addnews-page .editor_button,
.addnews-page .editor-btn {
  min-width: 32px;
  height: 32px;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.addnews-editor .bb-btn:hover,
.addnews-editor .editor_button:hover,
.addnews-editor .editor-btn:hover,
.addnews-page .bb-btn:hover,
.addnews-page .editor_button:hover,
.addnews-page .editor-btn:hover {
  background: var(--accent-main-soft) !important;
  color: var(--accent-main) !important;
}

.addnews-editor .bb-btn:active,
.addnews-editor .editor_button:active,
.addnews-editor .editor-btn:active,
.addnews-page .bb-btn:active,
.addnews-page .editor_button:active,
.addnews-page .editor-btn:active {
  transform: scale(0.97);
}

/* =========================
   TAGS
   ========================= */

.addnews-tags-note {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.addnews-tags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.addnews-tags__group {
  min-width: 0;
  padding: 14px;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: none !important;
}

.addnews-tags__title {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 10px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-main-soft);
  color: var(--accent-main);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.addnews-tags__list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.addnews-page .button.button--type-minimal.js-addnews-tag,
.addnews-page .js-addnews-tag {
  min-height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  box-shadow: none !important;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.addnews-page .button.button--type-minimal.js-addnews-tag:hover,
.addnews-page .js-addnews-tag:hover {
  background: var(--accent-main-soft);
  border-color: rgba(45, 123, 255, 0.18);
  color: var(--accent-main);
  transform: translateY(-1px);
}

.addnews-page .button.button--type-minimal.js-addnews-tag:active,
.addnews-page .js-addnews-tag:active {
  transform: scale(0.985);
}

.addnews-page .js-addnews-tag.is-active,
.addnews-page .button.js-addnews-tag.button--type-primary {
  background: var(--accent-hot-soft) !important;
  border-color: rgba(155, 234, 60, 0.28) !important;
  color: #5d8f16 !important;
}

.addnews-page .js-addnews-tag.is-active:hover,
.addnews-page .button.js-addnews-tag.button--type-primary:hover {
  background: rgba(155, 234, 60, 0.22) !important;
  border-color: rgba(155, 234, 60, 0.34) !important;
  color: #4f7c12 !important;
}

.addnews-tag-input {
  margin-top: 10px;
}

.addnews-tag-input .addnews-control input {
  background: var(--surface);
}

/* =========================
   ADMIN SWITCHES
   ========================= */

.addnews-admin {
  display: grid;
  gap: 10px;
}

.addnews-admin .checkbox {
  margin: 0;
}

.addnews-switch {
  min-height: 54px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 17px;
  box-shadow: none !important;
  cursor: pointer;
}

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

.addnews-switch__title {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
}

.addnews-switch input[type="checkbox"] {
  all: unset;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  position: relative;
  display: inline-block;
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  flex: 0 0 46px !important;
  margin: 0 !important;
  border-radius: 999px !important;
  background: var(--surface-3) !important;
  vertical-align: middle;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.addnews-switch input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
  transition: transform 0.18s ease;
}

.addnews-switch input[type="checkbox"]:checked {
  background: var(--accent-main) !important;
}

.addnews-switch input[type="checkbox"]:checked::before {
  transform: translate(18px, -50%);
}

.addnews-switch input[type="checkbox"]:focus-visible {
  box-shadow:
    0 0 0 4px rgba(45, 123, 255, 0.12),
    inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* =========================
   CAPTCHA
   ========================= */

.addnews-captcha {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.addnews-captcha img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* =========================
   SUBMIT
   ========================= */

.addnews-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.addnews-submit .button,
.addnews-submit button {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 16px;
  background: var(--accent-main);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(45, 123, 255, 0.16);
  transition:
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.addnews-submit .button .i-svg,
.addnews-submit button .i-svg {
  width: 16px;
  height: 16px;
}

.addnews-submit .button:hover,
.addnews-submit button:hover {
  background: var(--accent-main-hover);
  color: #fff;
  box-shadow: 0 10px 22px rgba(45, 123, 255, 0.18);
}

.addnews-submit .button:active,
.addnews-submit button:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 6px 14px rgba(45, 123, 255, 0.14);
}

/* =========================
   GALLERY / UPLOADER
   ========================= */

.addnews-media-card .qq-uploader {
  position: relative;
  min-width: 0;
}

.addnews-media-card .qq-upload-button,
.addnews-media-card .btn,
.addnews-media-card .btn-green,
.addnews-media-card .bg-teal {
  width: 100% !important;
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 14px !important;
  background: var(--accent-main) !important;
  border: 0 !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  color: #fff !important;
  cursor: pointer !important;
  font-size: 13px !important;
  line-height: 1 !important;
  font-weight: 600 !important;
  text-align: center !important;
  transition:
    background 0.18s ease,
    transform 0.18s ease,
    filter 0.18s ease !important;
}

.addnews-media-card .qq-upload-button:hover,
.addnews-media-card .btn:hover,
.addnews-media-card .btn-green:hover,
.addnews-media-card .bg-teal:hover {
  background: var(--accent-main-hover) !important;
  color: #fff !important;
  filter: brightness(1.03);
}

.addnews-media-card .qq-upload-button:active,
.addnews-media-card .btn:active,
.addnews-media-card .btn-green:active,
.addnews-media-card .bg-teal:active {
  transform: scale(0.985);
}

.addnews-media-card [id^="uploadedfile_"] {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.addnews-media-card .file-box,
.addnews-media-card .file-preview-card {
  margin: 0 !important;
  padding: 10px !important;
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.addnews-media-card .file-footer {
  background: transparent !important;
  color: var(--text-soft) !important;
}

.addnews-media-card .progress {
  height: 8px !important;
  margin-top: 8px !important;
  background: var(--surface-3) !important;
  border-radius: 999px !important;
  overflow: hidden !important;
}

.addnews-media-card .progress-bar {
  height: 100% !important;
  background: var(--accent-main) !important;
  border-radius: inherit !important;
}

/* =========================
   NSFW CARD
   ========================= */

.addnews-block--safety .addnews-block__title .i-svg {
  color: var(--accent-fire);
}

.addnews-media-card--nsfw {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 138, 31, 0.12), transparent 34%),
    linear-gradient(180deg, var(--surface), var(--bg-soft));
  border-color: rgba(255, 138, 31, 0.22);
}

.addnews-media-card--nsfw:hover {
  border-color: rgba(255, 138, 31, 0.30);
}

.addnews-media-card--nsfw .addnews-media-card__icon {
  background: var(--accent-fire-soft);
  color: var(--accent-fire);
}

.addnews-control--nsfw {
  padding: 12px;
  background: rgba(255, 138, 31, 0.07);
  border: 1px solid rgba(255, 138, 31, 0.14);
  border-radius: 16px;
}

.addnews-control--nsfw label,
.addnews-control--nsfw .xfield-check,
.addnews-control--nsfw .checkbox {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  cursor: pointer;
}

.addnews-control--nsfw input[type="checkbox"] {
  all: unset;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  position: relative;
  order: 2;
  width: 44px !important;
  min-width: 44px !important;
  height: 26px !important;
  min-height: 26px !important;
  flex: 0 0 44px !important;
  margin: 0 !important;
  background: var(--surface-3) !important;
  border-radius: 999px !important;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.10);
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.addnews-control--nsfw input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
  transition: transform 0.18s ease;
}

.addnews-control--nsfw input[type="checkbox"]:checked {
  background: var(--accent-fire) !important;
}

.addnews-control--nsfw input[type="checkbox"]:checked::before {
  transform: translate(18px, -50%);
}

.addnews-control--nsfw input[type="checkbox"]:focus-visible {
  box-shadow:
    0 0 0 4px rgba(255, 138, 31, 0.16),
    inset 0 1px 2px rgba(15, 23, 42, 0.10);
}

/* =========================
   DARK
   ========================= */

.theme-dark .addnews-head,
.theme-dark .addnews-block,
.theme-dark .addnews-tags__group,
.theme-dark .addnews-media-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.theme-dark .addnews-head::before {
  background: rgba(155, 234, 60, 0.07);
}

.theme-dark .addnews-head::after {
  background: rgba(155, 234, 60, 0.05);
}

.theme-dark .addnews-tags__title {
  background: var(--accent-main-soft);
  color: #9ec8ff;
}

.theme-dark .addnews-page .js-addnews-tag.is-active,
.theme-dark .addnews-page .button.js-addnews-tag.button--type-primary {
  background: rgba(155, 234, 60, 0.18) !important;
  border-color: rgba(155, 234, 60, 0.24) !important;
  color: #b9eb79 !important;
}

.theme-dark .addnews-media-card--gallery .addnews-media-card__icon {
  background: rgba(155, 234, 60, 0.16);
  color: #b9eb79;
}

.theme-dark .addnews-media-card--nsfw {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 138, 31, 0.12), transparent 34%),
    linear-gradient(180deg, var(--surface), var(--bg-soft));
  border-color: rgba(255, 138, 31, 0.20);
}

.theme-dark .addnews-media-card--nsfw .addnews-media-card__icon {
  background: rgba(255, 138, 31, 0.16);
  color: #ffb56f;
}

.theme-dark .addnews-control--nsfw {
  background: rgba(255, 138, 31, 0.09);
  border-color: rgba(255, 138, 31, 0.16);
}

.theme-dark .addnews-switch input[type="checkbox"],
.theme-dark .addnews-control--nsfw input[type="checkbox"] {
  background: #4f5968 !important;
}

.theme-dark .addnews-switch input[type="checkbox"]:checked {
  background: var(--accent-main) !important;
}

.theme-dark .addnews-control--nsfw input[type="checkbox"]:checked {
  background: var(--accent-fire) !important;
}

/* =========================
   RESPONSIVE
   ========================= */

@media screen and (max-width: 768px) {
  .addnews-page {
    padding: 0 10px;
  }

  .addnews-head {
    padding: 18px;
    border-radius: 20px;
  }

  .addnews-head__title {
    font-size: 25px;
  }

  .addnews-block {
    border-radius: 18px;
  }

  .addnews-block__head {
    padding: 15px 16px 8px;
  }

  .addnews-block__body {
    padding: 8px 16px 16px;
  }

  .addnews-media-grid,
  .addnews-tags,
  .addnews-captcha {
    grid-template-columns: 1fr;
  }

  .addnews-submit {
    justify-content: stretch;
  }

  .addnews-submit .button,
  .addnews-submit button {
    width: 100%;
  }
}

@media screen and (max-width: 640px) {
  .addnews-page {
    padding: 0 8px;
  }

  .addnews-shell {
    gap: 12px;
  }

  .addnews-head {
    padding: 16px 14px 15px;
    border-radius: 18px;
  }

  .addnews-head__title {
    font-size: 22px;
    line-height: 1.12;
  }

  .addnews-head__text {
    font-size: 14px;
    line-height: 1.56;
  }

  .addnews-block,
  .addnews-editor .bb-editor,
  .addnews-editor .bb-pane,
  .addnews-editor .wseditor .ws_toolbar,
  .addnews-editor .wseditor-toolbar,
  .addnews-tags__group,
  .addnews-media-card,
  .addnews-switch {
    border-radius: 16px;
  }

  .addnews-block__head {
    padding: 14px 14px 8px;
  }

  .addnews-block__body {
    padding: 8px 14px 14px;
  }

  .addnews-control input[type="text"],
  .addnews-control input[type="url"],
  .addnews-control input[type="email"],
  .addnews-control input[type="number"],
  .addnews-control input[type="password"],
  .addnews-control select,
  .addnews-captcha input[type="text"],
  .addnews-category-ui__trigger,
  .addnews-submit .button,
  .addnews-submit button {
    height: 46px;
    border-radius: 15px;
  }

  .addnews-editor textarea,
  .addnews-editor #short_story,
  .addnews-block [name="short_story"] {
    min-height: 200px;
    padding: 14px 14px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.68;
  }

  .addnews-category-ui__dropdown {
    border-radius: 15px !important;
  }

  .addnews-category-ui__item {
    min-height: 42px;
    padding: 0 12px;
    font-size: 14px;
  }

  .addnews-tags {
    gap: 10px;
  }

  .addnews-tags__group {
    padding: 12px;
  }

  .addnews-tags__list {
    gap: 7px;
  }

  .addnews-page .button.button--type-minimal.js-addnews-tag,
  .addnews-page .js-addnews-tag {
    min-height: 31px;
    padding: 0 10px;
    font-size: 11px;
  }

  .addnews-switch {
    min-height: 52px;
    padding: 11px 13px;
  }

  .addnews-switch input[type="checkbox"] {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    flex-basis: 44px !important;
  }

  .addnews-switch input[type="checkbox"]::before {
    width: 18px;
    height: 18px;
  }

  .addnews-switch input[type="checkbox"]:checked::before {
    transform: translate(18px, -50%);
  }

  .addnews-control--nsfw {
    padding: 10px;
    border-radius: 14px;
  }

  .addnews-control--nsfw label,
  .addnews-control--nsfw .xfield-check,
  .addnews-control--nsfw .checkbox {
    gap: 12px;
    font-size: 13px;
  }

  .addnews-media-card .qq-upload-button,
  .addnews-media-card .btn,
  .addnews-media-card .btn-green,
  .addnews-media-card .bg-teal {
    min-height: 42px !important;
    border-radius: 13px !important;
    font-size: 12px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .addnews-head,
  .addnews-block,
  .addnews-control input,
  .addnews-control textarea,
  .addnews-control select,
  .addnews-captcha input,
  .addnews-category-ui__trigger,
  .addnews-category-ui__dropdown,
  .addnews-category-ui__item,
  .addnews-media-card,
  .addnews-editor textarea,
  .addnews-editor #short_story,
  .addnews-block [name="short_story"],
  .addnews-page .js-addnews-tag,
  .addnews-switch input[type="checkbox"],
  .addnews-switch input[type="checkbox"]::before,
  .addnews-submit .button,
  .addnews-submit button,
  .addnews-media-card .qq-upload-button,
  .addnews-media-card .btn,
  .addnews-media-card .btn-green,
  .addnews-media-card .bg-teal,
  .addnews-control--nsfw input[type="checkbox"],
  .addnews-control--nsfw input[type="checkbox"]::before {
    transition: none !important;
  }
}