/* Базовые сбросы и переменные */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #1e1f22;
  color: #bcbec4;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.matino-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40px;
  min-height: 40px;
  flex-shrink: 0;
  background-color: #111213;
  padding: 0 16px;
  border-bottom: 1px solid #2b2d30;
}

.nav-brand {
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  letter-spacing: 1px;
  cursor: pointer;
}

.nav-brand:hover {
  color: #8ab4f8;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links a {
  color: #8ab4f8;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 4px 0;
}

.nav-links a:hover {
  color: #fff;
}

.nav-links a.active {
  color: #fff;
  font-weight: bold;
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.start-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
  width: 100%;
}

.start-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.start-header h1 {
  color: #fff;
  font-size: 1.8rem;
}

.start-actions {
  display: flex;
  gap: 10px;
}

.panel-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #818596;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #2b2d30;
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid #383b40;
}

.project-name {
  cursor: pointer;
  color: #dfe1e5;
  font-weight: 500;
}

.project-name:hover {
  color: #8ab4f8;
}

.btn {
  background-color: #383b40;
  color: #dfe1e5;
  border: 1px solid #4e5157;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn:hover {
  background-color: #4e5157;
}

.btn-primary {
  background-color: #3574f0;
  border-color: #3574f0;
  color: #fff;
}

.btn-primary:hover {
  background-color: #2e62c7;
}

.btn-danger {
  background-color: #cf6679;
  border-color: #cf6679;
  color: #fff;
}

.btn-danger:hover {
  background-color: #b54f60;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #abb2bf;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.editor-topbar {
  height: 30px;
  padding: 0 12px;
  background-color: #2b2d30;
  border-bottom: 1px solid #1e1f22;
  display: flex;
  align-items: center;
  color: #bcbec4;
}

.project-title-display {
  font-weight: 500;
  font-size: 0.9rem;
  color: #dfe1e5;
}

.workspace {
  display: flex;
  height: calc(100vh - 70px);
  position: relative;
}

.workspace.sidebar-collapsed .filepanel {
  display: none;
}

.ide-left-bar {
  width: 44px;
  background-color: #1e1f22;
  border-right: 1px solid #2b2d30;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  z-index: 10;
}

.ide-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ide-left-bar .btn-icon {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: #abb2bf;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ide-left-bar .btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.ide-left-bar .btn-run {
  color: #6aab73 !important;
  font-size: 1.2rem;
}
.ide-left-bar .btn-run:hover {
  background-color: rgba(106, 171, 115, 0.15) !important;
}

#btn-toggle-sidebar.toggle-active {
  background-color: rgba(53, 116, 240, 0.25);
  color: #8ab4f8;
}

.filepanel {
  width: 240px;
  background-color: #2b2d30;
  border-right: 1px solid #1e1f22;
  display: flex;
  flex-direction: column;
}

.filepanel.collapsed {
  display: none;
}

.filepanel-header {
  padding: 10px 12px;
  border-bottom: 1px solid #383b40;
}

.filelist {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

/* Строки дерева — единая сетка для файлов и папок */
.filelist-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #dfe1e5;
}

.filelist-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.filelist-item.active {
  background-color: #3574f0;
  color: #fff;
}

.row-icon {
  text-align: center;
  color: #818596;
}

.row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-item {
  font-weight: 500;
}

.folder-root {
  font-weight: 600;
  color: #fff;
}

.drop-target {
  outline: 1px dashed #3574f0;
  outline-offset: -2px;
}

.menu-btn {
  width: 28px;
  height: 28px;
  font-size: 1rem;
  line-height: 1;
  opacity: 0;
}

@media (hover: hover) {
  .filelist-item:hover .menu-btn {
    opacity: 1;
  }
}

@media (hover: none) {
  .menu-btn {
    opacity: 1;
  }
}

.item-menu {
  position: fixed;
  list-style: none;
  background-color: #2b2d30;
  border: 1px solid #4e5157;
  border-radius: 6px;
  padding: 4px 0;
  min-width: 150px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.item-menu li {
  padding: 8px 14px;
  color: #dfe1e5;
  cursor: pointer;
  font-size: 0.9rem;
}

.item-menu li:hover {
  background-color: #3574f0;
  color: #fff;
}

.editorpane {
  flex: 3;
  display: flex;
  flex-direction: column;
  background-color: #1e1f22;
  min-width: 0;
}

.editor-wrap {
  display: flex;
  align-items: flex-start;
  flex: 1;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.linenumbers {
  width: 45px;
  background-color: #1e1f22;
  color: #606366;
  padding: 12px 6px;
  text-align: right;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
}

.editor {
  flex: 1;
  background-color: #1e1f22;
  color: #bcbec4;
  border: none;
  padding: 12px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  overflow-y: hidden;
}

.previewpane {
  flex: 2;
  background-color: #fff;
  border-left: 1px solid #2b2d30;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.previewpane .panel-title {
  background-color: #2b2d30;
  color: #bcbec4;
  padding: 8px 12px;
  margin: 0;
}

.preview-scale-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.preview {
  width: 1280px;
  height: 800px;
  border: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
}

.preview-exit-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.dialog-box {
  background-color: #2b2d30;
  padding: 24px;
  border-radius: 8px;
  width: 360px;
  border: 1px solid #383b40;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #fff;
}

.dialog-input {
  background-color: #1e1f22;
  border: 1px solid #4e5157;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  outline: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.binary-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #111213;
  overflow: auto;
  padding: 16px;
}

.binary-preview img,
.binary-preview video {
  max-width: 100%;
  max-height: 100%;
}