/* ═══════════════════════════════════════════════
   ALTIMIT OS — CSS VARIABLES (matches homepage)
═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Orbitron:wght@400;600;700;900&family=Rajdhani:wght@300;400;500;600&display=swap');

:root {
  --cyan:         #00f0ff;
  --cyan-dim:     #00cfe0;
  --cyan-dark:    #004d55;
  --blue:         #0a4fff;
  --blue-mid:     #0066cc;
  --navy:         #020c18;
  --navy2:        #040f1e;
  --panel-bg:     rgba(2, 12, 28, 0.92);
  --panel-border: rgba(0, 240, 255, 0.45);
  --panel-glow:   rgba(0, 240, 255, 0.14);
  --text-main:    #ddf3ff;
  --text-dim:     #7abfd8;
  --text-label:   #00f0ff;
  --red-alert:    #ff2244;
  --gold:         #ffc533;
  --font-mono:    'Share Tech Mono', monospace;
  --font-hud:     'Orbitron', sans-serif;
  --font-body:    'Rajdhani', sans-serif;
}

/* ═══════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--navy);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  padding: 20px;
}

/* Ambient glow + grid background via pseudo-element */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 15% 20%, rgba(0,80,200,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 85% 80%, rgba(0,200,255,0.12) 0%, transparent 65%),
    radial-gradient(ellipse 40% 50% at 50% 50%, rgba(0,30,80,0.5) 0%, transparent 70%),
    var(--navy);
}

/* Grid lines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0,240,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.04) 1px, transparent 1px),
    linear-gradient(rgba(0,240,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.015) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
  opacity: 0.6;
}

::selection { background: rgba(0,240,255,0.25); color: #fff; }

/* ═══════════════════════════════════════════════
   FOCUS
═══════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(0, 240, 255, 0.15);
}
:focus:not(:focus-visible) { outline: none; }

/* ═══════════════════════════════════════════════
   TYPOGRAPHY
═══════════════════════════════════════════════ */
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-hud);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0;
}
.prose h1 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}
.prose h2 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cyan);
  border-left: 3px solid var(--cyan);
  padding-left: 0.6rem;
  margin-bottom: 0.3rem;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}
.prose h3 { font-size: 0.68rem; color: var(--cyan-dim); margin: 0; }
.prose p, .prose li { color: var(--text-dim); font-family: var(--font-body); }
.prose strong { color: #fff; }
code {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 0.88em;
}

/* ═══════════════════════════════════════════════
   CARD / PANEL
═══════════════════════════════════════════════ */
.card {
  background: var(--panel-bg) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: 0 !important;
  box-shadow:
    0 0 0 1px rgba(0,240,255,0.06) inset,
    0 4px 40px rgba(0,0,0,0.6),
    0 0 30px rgba(0,240,255,0.04);
  backdrop-filter: blur(14px);
  position: relative;
}
/* Corner bracket top-left */
.card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 12px; height: 12px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
  pointer-events: none;
  z-index: 1;
}
/* Corner bracket bottom-right */
.card::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 12px; height: 12px;
  border-bottom: 2px solid var(--cyan);
  border-right: 2px solid var(--cyan);
  pointer-events: none;
  z-index: 1;
}
.card:hover {
  border-color: rgba(0, 240, 255, 0.65) !important;
  box-shadow:
    0 0 0 1px rgba(0,240,255,0.10) inset,
    0 6px 48px rgba(0,0,0,0.7),
    0 0 40px rgba(0,240,255,0.07);
}

/* ═══════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  position: relative;
  z-index: 1;
}
.sidebar {
  position: sticky;
  top: 20px;
  padding: 18px;
  display: grid;
  gap: 14px;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 20px;
  align-items: start;
}
.editor-column, .preview-column { display: grid; gap: 20px; }
.preview-column { position: sticky; top: 20px; align-self: start; }
.panel, .section-card { padding: 16px; }
.brand p {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════
   DETAILS / SUMMARY
═══════════════════════════════════════════════ */
details.section-card,
details.panel { overflow: hidden; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }

.section-card > summary,
.panel-summary {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.section-card > summary::after,
.panel-summary::after {
  content: "−";
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  flex: 0 0 auto;
  text-shadow: 0 0 8px var(--cyan);
}
details:not([open]) > .panel-summary::after,
details:not([open]) > summary::after { content: "+"; }

.panel-summary button { flex: 0 0 auto; width: auto; min-width: 110px; margin-left: auto; }
.panel-body { margin-top: 14px; }

/* ═══════════════════════════════════════════════
   GRID HELPERS
═══════════════════════════════════════════════ */
.grid { display: grid; gap: 14px; }
.grid.two   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.stack { display: grid; gap: 12px; }
.button-grid { display: grid; gap: 10px; margin-top: 10px; }
.button-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════ */
label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  position: relative;
}
label > span:first-child {
  color: var(--text-label);
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
}

input, textarea, select, button {
  border-radius: 0;
  border: 1px solid rgba(0, 240, 255, 0.25);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
input, textarea, select {
  background: rgba(0, 8, 20, 0.85);
  color: var(--text-main);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.12), 0 0 12px rgba(0, 240, 255, 0.08);
}
select option { background: #020c18; color: var(--text-main); }

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
button {
  background: transparent;
  border: 1px solid var(--cyan-dim);
  color: var(--cyan);
  padding: 9px 12px;
  cursor: pointer;
  font-family: var(--font-hud);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
  white-space: wrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
button:hover {
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
  transform: translateY(-1px);
  color: #fff;
}
button.secondary {
  border-color: rgba(0, 240, 255, 0.2);
  color: var(--text-dim);
}
button.secondary:hover {
  border-color: var(--cyan-dim);
  color: var(--text-main);
  background: rgba(0, 240, 255, 0.05);
}
button.danger {
  border-color: rgba(255, 34, 68, 0.45);
  color: #ff6680;
}
button.danger:hover {
  background: rgba(255, 34, 68, 0.1);
  box-shadow: 0 0 14px rgba(255, 34, 68, 0.25);
  color: #ffd0d6;
}

/* ═══════════════════════════════════════════════
   JSON PREVIEW
═══════════════════════════════════════════════ */
.preview {
  background: rgba(0, 4, 12, 0.95) !important;
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(0,240,255,0.04), inset 0 0 20px rgba(0,0,0,0.3);
  padding: 16px;
  min-height: 280px;
  max-height: 42vh;
  white-space: pre-wrap;
  overflow: auto;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan-dim);
  line-height: 1.6;
}
.preview::-webkit-scrollbar { width: 6px; }
.preview::-webkit-scrollbar-track { background: rgba(0,240,255,0.03); }
.preview::-webkit-scrollbar-thumb { background: rgba(0,240,255,0.2); }

/* ═══════════════════════════════════════════════
   ITEM CARDS
═══════════════════════════════════════════════ */
.item-card { padding: 14px; }
.item-card.inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.item-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.item-actions button { width: auto; min-width: 100px; }

/* ═══════════════════════════════════════════════
   SUBHEADINGS
═══════════════════════════════════════════════ */
.section-heading, .subheading {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 14px;
}
.subheading button { width: auto; min-width: 100px; }

/* ═══════════════════════════════════════════════
   STATUS BOX
═══════════════════════════════════════════════ */
.status {
  padding: 10px 14px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  background: rgba(0, 240, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cyan-dim);
  letter-spacing: 0.05em;
}
.status.warn  { border-color: rgba(255,197,51,0.35); background: rgba(255,197,51,0.06); color: var(--gold); }
.status.error { border-color: rgba(255,34,68,0.35);  background: rgba(255,34,68,0.08);  color: #ff6680; }

.validation-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  display: grid;
  gap: 6px;
}

/* ═══════════════════════════════════════════════
   FILE INPUT
═══════════════════════════════════════════════ */
.file-input { position: relative; overflow: hidden; }
.file-input input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.file-input span {
  display: block;
  background: rgba(0, 8, 20, 0.8);
  border: 1px dashed rgba(0, 240, 255, 0.35);
  padding: 14px;
  color: var(--text-dim);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  transition: border-color 0.2s, color 0.2s;
}
.file-input:hover span { border-color: var(--cyan); color: var(--text-main); }

/* ═══════════════════════════════════════════════
   WIKI TIP
═══════════════════════════════════════════════ */
.wiki-tip {
  border-left: 3px solid var(--gold);
  background: rgba(255, 197, 51, 0.05);
  color: var(--text-dim);
  padding: 0.8rem 1rem;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.6;
}
.wiki-tip strong { color: var(--gold); }

/* ═══════════════════════════════════════════════
   INLINE HELP TOOLTIP
═══════════════════════════════════════════════ */
.inline-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  width: 16px;
  height: 16px;
  background: rgba(0, 240, 255, 0.08);
  color: var(--cyan) !important;
  cursor: help;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  position: relative;
}
.inline-help::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  min-width: 240px;
  max-width: 340px;
  background: rgba(2, 8, 20, 0.97);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
  padding: 10px 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 20px rgba(0,240,255,0.08);
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  z-index: 20;
  transition: opacity 0.15s ease;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.5;
  letter-spacing: 0.03em;
}
.inline-help:hover::after,
.inline-help:focus::after { opacity: 1; }

/* ═══════════════════════════════════════════════
   CLASS PACK SELECT
═══════════════════════════════════════════════ */
#classPackSelect { min-height: 200px; width: 100%; }

/* ═══════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════ */
.page-header {
  width: min(1400px, calc(100% - 32px));
  margin: 20px auto 24px;
  position: relative;
  z-index: 1;
}

.header-banner {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  box-shadow:
    0 0 0 1px rgba(0,240,255,0.06) inset,
    0 18px 50px rgba(0,0,0,0.5),
    0 0 40px rgba(0,240,255,0.06);
  background: var(--navy2);
}
.header-banner::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 20px; height: 20px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
  z-index: 2;
  pointer-events: none;
}
.header-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(2,12,28,0.10), rgba(2,12,28,0.30)),
    linear-gradient(to top, rgba(2,12,28,0.35), rgba(2,12,28,0.05));
  pointer-events: none;
  z-index: 1;
}
.header-banner-image {
  display: block;
  width: 100%;
  height: clamp(180px, 24vw, 300px);
  object-fit: cover;
  object-position: center 38%;
}

.header-links-block {
  margin-top: 14px;
  padding: 18px 20px 20px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  text-align: center;
  backdrop-filter: blur(14px);
  position: relative;
}
.header-links-block::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 12px; height: 12px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
}
.header-links-block::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 12px; height: 12px;
  border-bottom: 2px solid var(--cyan);
  border-right: 2px solid var(--cyan);
}
.header-links-label {
  margin: 0 0 14px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.8;
}
.header-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 160px;
  padding: 10px 20px;
  border: 1px solid var(--cyan-dim);
  background: transparent;
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--font-hud);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s, color 0.2s;
}
.header-btn:hover {
  transform: translateY(-2px);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
  color: #fff;
}
.header-btn.secondary {
  border-color: rgba(0, 240, 255, 0.2);
  color: var(--text-dim);
}
.header-btn.secondary:hover { border-color: var(--cyan-dim); color: var(--text-main); }
.header-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.header-actions a.header-btn { text-decoration: none; }

/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
footer {
  text-align: center;
  padding: 24px 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-top: 1px solid rgba(0, 240, 255, 0.1);
  margin-top: 40px;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 1350px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-column { position: static; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 780px) {
  .grid.two, .grid.three, .item-card.inline, .button-grid.two { grid-template-columns: 1fr; }
  .panel-summary { flex-wrap: wrap; }
  .panel-summary button, .subheading button, .item-actions button { width: 100%; }
}
@media (max-width: 640px) {
  body { padding: 12px; }
}
