:root {
  color-scheme: light;
  --bg-color: #fff;
  --alt-bg-color: #f0f6fa;
  --surface-color: #f2f2f2;
  --divider-color: #e7e7e7;
  --input-border-color: #e0e0e0;
  --input-focus-color: #39ade7;
  --text-color: #222;
  --text-secondary-color: #a8a8a8;
  --link-color: #0086d3;
  --link-bghover: #e8f3fa;
  --accent-color: #0f9ae4;
  --accent-bghover: #068cd4;
  --fade-color: #fff;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-color: #17212b;
  --alt-bg-color: #1e2c3a;
  --surface-color: #242f3d;
  --divider-color: #2b3947;
  --input-border-color: #3d4f63;
  --text-color: #f5f5f5;
  --text-secondary-color: #8b9bab;
  --link-color: #6ab3f3;
  --link-bghover: #243447;
  --accent-color: #50a7e0;
  --accent-bghover: #3d96d4;
  --fade-color: #17212b;
}

body.tr-body {
  font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: var(--text-color);
  background: var(--bg-color);
  margin: 0;
  padding: 0;
}

.tr-container {
  min-width: 970px;
}

.tr-container header {
  border-bottom: 1px solid var(--divider-color);
  background: var(--bg-color);
}

.tr-container header .container {
  width: 970px;
  max-width: 100%;
  margin: 0 auto;
}

.header-wrap {
  position: relative;
  min-height: 54px;
}

.header-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-auth-link {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
}

.header-auth-link:hover {
  background: var(--link-bghover);
  text-decoration: none;
  border-radius: 3px;
  padding: 4px 8px;
  margin: -4px -8px;
}

.header-breadcrumb .breadcrumb {
  background: transparent;
  margin: 0;
  padding: 16px 0;
  font-size: 15px;
}

.header-breadcrumb .breadcrumb > li + li:before {
  content: "›";
  padding: 0 8px;
  color: var(--text-secondary-color);
}

.header-breadcrumb .breadcrumb a {
  color: var(--link-color);
}

.tr-container main.container {
  width: 970px;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  display: flow-root;
}

.tr-menu {
  float: left;
  width: 216px;
  border-right: 1px solid var(--divider-color);
  padding: 12px 0 24px;
  margin-right: -1px;
}

.tr-menu-header-label {
  font-size: 13px;
  line-height: 17px;
  font-weight: 500;
  text-transform: uppercase;
  padding: 16px 15px 14px;
  color: var(--text-secondary-color);
}

.tr-menu-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tr-menu-items > li.active .tr-menu-item,
.tr-menu-items > li.active a.tr-menu-item {
  background: var(--accent-color);
  color: #fff;
}

.tr-menu-item,
a.tr-menu-item {
  display: block;
  padding: 8px 15px;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 0;
}

a.tr-menu-item:hover {
  background: var(--link-bghover);
  color: var(--link-color);
  text-decoration: none;
}

.tr-menu-selected {
  padding: 0 15px 8px;
}

.tr-menu-selected .tr-menu-item-with-desc {
  padding: 8px 0;
}

.tr-menu-selected .nav-label {
  display: block;
  font-weight: 500;
}

.tr-menu-selected .nav-label-desc {
  display: block;
  font-size: 13px;
  color: var(--text-secondary-color);
}

.tr-menu-section-collapsed .tr-menu-items {
  display: none;
}

.tr-menu-header {
  cursor: pointer;
  position: relative;
}

.tr-menu-header-collapse {
  position: absolute;
  right: 20px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-secondary-color);
  border-bottom: 2px solid var(--text-secondary-color);
  transform: rotate(-135deg);
  transition: transform 0.2s ease;
}

.tr-menu-section-collapsed .tr-menu-header-collapse {
  transform: rotate(45deg);
}

section.content {
  margin-left: 216px;
  padding: 24px 24px 48px;
  min-height: 480px;
}

.tr-content h1 {
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 20px;
}

.tr-content h3 {
  font-size: 18px;
  font-weight: 500;
  margin: 28px 0 12px;
}

.tr-content p,
.tr-content li {
  line-height: 1.65;
}

.tr-content .dev_side_image {
  float: right;
  max-width: 320px;
  margin: 0 0 16px 24px;
  border-radius: 8px;
}

.arrow-link {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  color: var(--link-color);
  cursor: pointer;
  margin-top: 8px;
}

.arrow-link:after {
  content: " →";
}

.tr-info-box {
  background: var(--alt-bg-color);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px 0;
}

.tr-info-box h4 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-secondary-color);
  letter-spacing: 0.04em;
}

.tr-share-link {
  display: block;
  word-break: break-all;
  color: var(--link-color);
  margin-top: 8px;
}

.tr-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.tr-platform-card {
  border: 1px solid var(--divider-color);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  background: var(--bg-color);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tr-platform-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: inherit;
}

.tr-platform-card strong {
  display: block;
  margin-bottom: 6px;
}

.tr-platform-card .muted {
  color: var(--text-secondary-color);
  font-size: 13px;
}

.tr-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  margin-right: 4px;
  background: var(--surface-color);
  color: var(--text-secondary-color);
}

.tr-badge-official { background: #d9edd9; color: #449d44; }
.tr-badge-custom { background: #e8e6ff; color: #6c63ff; }
.tr-badge-beta { background: #ffeeb8; color: #de8833; }

.tr-theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--surface-color);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.popup-container {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
}

.popup-container.hide {
  display: none;
}

.popup {
  width: 100%;
  max-width: 420px;
  background: var(--bg-color);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.popup-body {
  padding: 20px 24px 24px;
}

.popup-body h4 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 500;
}

.popup .form-control {
  width: 100%;
  margin-bottom: 12px;
  border: 1px solid var(--input-border-color);
  border-radius: 3px;
  padding: 8px 12px;
  background: var(--bg-color);
  color: var(--text-color);
}

.popup .form-control:focus {
  border-color: var(--input-focus-color);
  outline: none;
}

.tr-languages-results {
  max-height: 320px;
  overflow-y: auto;
  margin: 8px 0 0;
}

.tr-languages-results a {
  display: block;
  padding: 8px 12px;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 4px;
}

.tr-languages-results a:hover {
  background: var(--link-bghover);
  color: var(--link-color);
}

.tr-languages-add {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--divider-color);
}

.tr-languages-add a {
  color: var(--link-color);
  font-weight: 500;
  cursor: pointer;
}

.tr-form-row {
  margin-bottom: 12px;
}

.tr-form-row label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary-color);
  margin-bottom: 4px;
}

.tr-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.btn-tr-primary {
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 8px 16px;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 13px;
  cursor: pointer;
}

.btn-tr-primary:hover {
  background: var(--accent-bghover);
}

.btn-tr-default {
  background: transparent;
  color: var(--link-color);
  border: none;
  border-radius: 3px;
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
}

.btn-tr-default:hover {
  background: var(--link-bghover);
}

.tr-admin-panel {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--divider-color);
}

.tr-admin-panel summary {
  cursor: pointer;
  color: var(--text-secondary-color);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tr-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(34, 34, 34, 0.92);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tr-toast.visible {
  opacity: 1;
}

.tr-empty {
  color: var(--text-secondary-color);
  font-style: italic;
}

@media (max-width: 991px) {
  .tr-container,
  .tr-container header .container,
  .tr-container main.container {
    min-width: 0;
    width: 100%;
  }

  .tr-menu {
    float: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--divider-color);
  }

  section.content {
    margin-left: 0;
  }
}
