:root {
  --bg: #08120d;
  --bg2: #030705;
  --panel: #101b14;
  --panel2: #15251a;
  --panel3: #0c1710;
  --border: #2a4932;
  --border2: rgba(101, 229, 114, 0.35);
  --green: #65e572;
  --green2: #22c55e;
  --text: #e7f9ea;
  --muted: #91a596;
  --danger: #ef4444;
  --warn: #f59e0b;
  --blue: #60a5fa;
  --shadow: 0 10px 30px rgba(0,0,0,0.22);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.12), transparent 35%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: var(--green);
  word-break: break-word;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(460px, 100%);
  background: rgba(16, 27, 20, 0.96);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
}

.logo {
  font-size: 32px;
  font-weight: 900;
  color: var(--green);
  letter-spacing: 0.5px;
  line-height: 1.05;
}

.sub {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: rgba(9, 19, 13, 0.94);
  border-right: 1px solid var(--border);
  padding: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.nav button {
  width: 100%;
  text-align: left;
}

.main {
  padding: 24px;
  max-width: 1500px;
  width: 100%;
  min-width: 0;
}

.card {
  background: rgba(16, 27, 20, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.space {
  justify-content: space-between;
}

.btn {
  background: linear-gradient(180deg, #35d365, #169a45);
  color: #021908;
  border: 0;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.25);
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1.2;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: #1e3225;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.danger {
  background: #7f1d1d;
  color: white;
}

.btn.warn {
  background: #92400e;
  color: white;
}

input,
textarea,
select {
  width: 100%;
  background: #07110c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  min-height: 42px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border2);
  box-shadow: 0 0 0 3px rgba(101, 229, 114, 0.08);
}

textarea {
  min-height: 140px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  resize: vertical;
  line-height: 1.45;
  tab-size: 2;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 4px 9px;
  color: var(--muted);
  font-size: 12px;
  gap: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.badge.ok {
  color: var(--green);
  border-color: rgba(101, 229, 114, 0.45);
}

.badge.fail {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.55);
}

.project-card {
  cursor: pointer;
  transition: 0.16s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(101, 229, 114, 0.55);
}

.file-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
}

.file-list {
  max-height: 680px;
  overflow: auto;
  padding-right: 2px;
}

.file-item {
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
  word-break: break-all;
  font-size: 13px;
  line-height: 1.35;
}

.file-item:hover,
.file-item.active {
  background: #0d1b12;
  border-color: var(--border);
  color: var(--text);
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: #050b08;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  max-height: 420px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.45;
}

.small {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(26px, 4vw, 42px);
}

h2 {
  font-size: clamp(21px, 3vw, 28px);
}

h3 {
  font-size: clamp(17px, 2.4vw, 22px);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

details {
  max-width: 100%;
}

summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 700;
  margin: 8px 0;
}

#notice {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 10px;
}

/* Tablet */
@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px;
  }

  .main {
    padding: 18px;
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .file-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

/* Mobile */
@media (max-width: 820px) {
  .shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 14px;
    backdrop-filter: blur(12px);
  }

  .sidebar .logo {
    font-size: 24px;
  }

  .sidebar .sub {
    font-size: 13px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .nav button {
    text-align: center;
    padding: 9px 8px;
    font-size: 13px;
    min-height: 40px;
  }

  .main {
    padding: 14px;
  }

  .card {
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 14px;
  }

  .grid-2,
  .grid-3,
  .file-layout {
    grid-template-columns: 1fr;
  }

  .file-list {
    max-height: 230px;
  }

  .file-item {
    font-size: 12px;
    padding: 9px;
  }

  textarea#fileEditor {
    min-height: 420px !important;
    font-size: 13px;
  }

  .row.space {
    align-items: flex-start;
  }

  .row.space > .row {
    width: 100%;
  }

  .row.space > .row .btn {
    flex: 1 1 auto;
  }

  pre {
    max-height: 320px;
    font-size: 12px;
  }
}

/* Small phones */
@media (max-width: 540px) {
  body {
    font-size: 15px;
  }

  .login {
    padding: 12px;
    align-items: start;
    padding-top: 28px;
  }

  .login-card {
    padding: 18px;
    border-radius: 18px;
  }

  .logo {
    font-size: 26px;
  }

  .sidebar {
    padding: 12px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav button {
    font-size: 12px;
    min-height: 42px;
  }

  .main {
    padding: 10px;
  }

  .card {
    padding: 12px;
    border-radius: 14px;
  }

  .btn {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
  }

  .row {
    width: 100%;
  }

  .row .btn {
    flex: 1 1 100%;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  textarea {
    min-height: 180px;
  }

  textarea#fileEditor {
    min-height: 360px !important;
    font-size: 13px;
  }

  .file-list {
    max-height: 190px;
  }

  .badge {
    font-size: 11px;
  }

  pre {
    padding: 10px;
    font-size: 11px;
    max-height: 280px;
  }
}

/* Very small screens */
@media (max-width: 380px) {
  .nav {
    grid-template-columns: 1fr;
  }

  .sidebar .logo {
    font-size: 22px;
  }

  h1 {
    font-size: 24px;
  }
}
