/* csokor.bosz.dev: a bosz.dev szinei es betuje, ket panel: kod es csokor. */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  --bg: #0f1216;
  --panel: #12161b;
  --fg: #e6e9ef;
  --dim: #7b8593;
  --accent: #3fa892;
  --hiba: #f0767f;
  --vonal: 198, 213, 232;
  --hatar: rgba(198, 213, 232, 0.09);

  /* a kod sorai: a szerkeszto, a kiemeles, a sorszamok es a hibasav ebbol szamol */
  --kod-betu: 13px;
  --sor: 20px;
  --kod-felso: 14px;
  --kod-bal: 16px;

  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  overflow: hidden;
}

::selection { background: rgba(63, 168, 146, 0.32); }

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Gorgetosav: vekony, a hatterhez illo. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(198, 213, 232, 0.18) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(198, 213, 232, 0.16);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(198, 213, 232, 0.3); }
::-webkit-scrollbar-corner { background: transparent; }

/* ------------------------------------------------------------ fejlec */

.fejlec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 6px 0 16px;
  border-bottom: 1px solid var(--hatar);
}

.cim {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.cim .halk {
  color: var(--dim);
  text-decoration: none;
  transition: color 0.15s ease;
}

.cim .halk:hover { color: var(--fg); }
.cim .pont { color: var(--accent); }
.cim .per { color: rgba(123, 133, 147, 0.5); margin: 0 0.5em; }

/* Nyelvvalaszto: a bosz.dev-rol, a fejlecben. */
.nyelvek {
  display: flex;
  gap: 4px;
}

.nyelvek button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.nyelvek button svg {
  display: block;
  width: 30px;
  height: 18px;
  border-radius: 2px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.nyelvek button:hover svg { opacity: 0.85; }
.nyelvek button.aktiv svg { opacity: 1; }

.nyelvek button::after {
  content: '';
  position: absolute;
  inset: 10px 3px;
  border: 1px solid transparent;
  border-radius: 4px;
  pointer-events: none;
  transition: border-color 0.2s ease;
}

.nyelvek button.aktiv::after { border-color: rgba(var(--vonal), 0.45); }
.nyelvek button:focus-visible { outline: none; }
.nyelvek button:focus-visible::after { border-color: var(--accent); border-width: 2px; }
.nyelvek button:focus-visible svg { opacity: 1; }

/* ------------------------------------------------------------ ket panel */

.munka {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  min-height: 0;
}

.kod {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--panel);
  border-right: 1px solid var(--hatar);
}

.eszkozsor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--hatar);
}

.fajl {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  min-width: 0;
}

.fajlnev {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.allapot {
  margin: 0;
  font-size: 12px;
  color: var(--dim);
}

/* A kod kinyitasa: csak allo telefonon. */
.nyito {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px 0 -6px -10px;
  padding: 0;
  color: var(--fg);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.nyito svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

body[data-kod='nyitva'] .nyito svg { transform: rotate(180deg); }

.allapot.hibas { color: var(--hiba); }

.gombok {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.gomb {
  position: relative;
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  color: var(--fg);
  background: transparent;
  border: 1px solid rgba(var(--vonal), 0.18);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.gomb:hover { border-color: var(--accent); color: var(--accent); }
.gomb:active { transform: translateY(1px); }

/* Sajat sugo a nativ title-buborek helyett. Csak egerrel, kis kesleltetessel. */
@media (hover: hover) {
  [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 5;
    width: max-content;
    max-width: 260px;
    padding: 6px 9px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--fg);
    background: #1a1f26;
    border: 1px solid rgba(var(--vonal), 0.14);
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
  }

  [data-tip]:hover::after {
    opacity: 1;
    transition-delay: 0.45s;
  }
}

/* ------------------------------------------------------------ szerkeszto */

.szerk {
  position: relative;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  font-size: var(--kod-betu);
  line-height: var(--sor);
}

.szerk:focus-within { box-shadow: inset 2px 0 0 var(--accent); }

.sorszamok {
  overflow: hidden;
  padding: var(--kod-felso) 10px 0 0;
  color: rgba(123, 133, 147, 0.5);
  text-align: right;
  user-select: none;
}

#sorszamok { will-change: transform; }

/* Egy sorszam: balra tole hely a szin negyzetenek. */
.sorsz {
  position: relative;
  height: var(--sor);
  min-width: calc(2.2em + 30px);
  padding-left: 30px;
}

.sorsz.hibas { color: var(--hiba); }

/* A szin negyzete: kicsi rajz, de a tapintasi felulete a teljes sormagassag. */
.minta {
  position: absolute;
  top: 0;
  left: 6px;
  width: var(--sor);
  height: var(--sor);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.minta::before {
  content: '';
  position: absolute;
  inset: 25%;
  border-radius: 3px;
  background: var(--szin);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
  transition: transform 0.12s ease;
}

.minta:hover::before { transform: scale(1.18); }
.minta:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-radius: 5px; }

/* A rendszer szinvalasztoja lathatatlan; a negyzet mellett nyilik meg. */
.szinvalaszto {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.terulet {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.terulet textarea,
.kiemeles {
  margin: 0;
  padding: var(--kod-felso) var(--kod-bal) 40px;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: 0;
  tab-size: 4;
  white-space: pre;
  word-wrap: normal;
}

.terulet textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  resize: none;
  outline: none;
  overflow: auto;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--fg);
}

.kiemeles {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  color: #c3cad4;
  pointer-events: none;
  will-change: transform;
}

.hibasav {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--sor);
  background: rgba(240, 118, 127, 0.11);
  box-shadow: inset 2px 0 0 var(--hiba);
  pointer-events: none;
  will-change: transform;
}

/* A szinezes. Az allandok (csupa nagybetus nevek) azok, amiket atirni erdemes. */
.k-megj { color: #8a94a2; font-style: italic; }
.k-szoveg { color: #b8d08e; }
.k-szam { color: #e8a87c; }
.k-kulcs { color: #7fb2d6; }
.k-fv { color: #e9d49a; }
.k-allando { color: #f2c46d; }
.k-beepitett { color: #7cc4b4; }
.k-ertek { color: #d9a3c9; }
.k-szin { box-shadow: inset 0 -2px 0 var(--szin); }

.hiba {
  padding: 10px 16px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  background: rgba(240, 118, 127, 0.07);
  border-top: 1px solid rgba(240, 118, 127, 0.3);
}

.hiba p { margin: 0; }
.hiba-cim { color: var(--hiba); font-weight: 600; margin-bottom: 2px !important; }
.hiba-uzenet { white-space: pre-wrap; overflow-wrap: anywhere; }
.hiba-megjegyzes { color: var(--dim); margin-top: 4px !important; }

/* ------------------------------------------------------------ a csokor */

/* Egy fokuszpont: halvany, meleg fény a csokor mögött, kifele sotetedik. */
.virag {
  position: relative;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 58% 52% at 50% 44%,
      rgba(255, 170, 196, 0.075) 0%,
      rgba(255, 170, 196, 0.05) 30%,
      rgba(255, 170, 196, 0.022) 55%,
      transparent 78%),
    radial-gradient(ellipse 80% 80% at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.35) 100%),
    var(--bg);
}

.virag canvas {
  position: absolute;
  top: 12px;
  left: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  display: block;
}

.varakozas {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
}

.kurzor {
  display: inline-block;
  width: 0.6em;
  margin-left: 0.15em;
  background: var(--accent);
  animation: villog 1.15s steps(1, end) infinite;
}

@keyframes villog {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* ------------------------------------------------------------ lablec */

.lablec {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--dim);
  border-top: 1px solid var(--hatar);
}

/* ------------------------------------------------------------ telefon */

/*
 * Allo telefon (es keskeny, magas ablak). Egy kepernyo, nincs lapgorgetes:
 * felul a csokor, alul a kod. Alapbol a kod csak "kikandikal" (nehany sora
 * latszik), kinyitva a csokor kisebb, de latszik tovabb, igy a valtoztatas
 * hatasa is. A magassagvaltas nem animalt, csak a nyil fordul.
 */
@media (max-width: 859px) and (orientation: portrait) {
  body {
    height: 100vh;
    height: 100dvh;
  }

  .fejlec { min-height: 52px; }

  .munka {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .virag {
    order: -1;
    border-bottom: 1px solid var(--hatar);
  }

  .kod {
    border-right: 0;
    height: calc(var(--sor) * 5.5 + var(--kod-felso) + 64px);
  }

  body[data-kod='nyitva'] .munka { grid-template-rows: minmax(0, 34fr) minmax(0, 66fr); }
  body[data-kod='nyitva'] .kod { height: auto; }

  .eszkozsor {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 10px 8px 12px;
  }

  .nyito { display: grid; }

  .fajl {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .allapot {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .gombok { gap: 6px; flex: none; }
  .gomb { height: 44px; padding: 0 10px; }

  .hiba {
    max-height: 30%;
    overflow-y: auto;
    padding: 8px 12px 10px;
  }

  .lablec { padding: 8px 12px; font-size: 11px; }
}

/* Erintokepernyon 16 pixeles kod, kulonben az iPhone belenagyit gepeleskor. */
@media (pointer: coarse) {
  :root {
    --kod-betu: 16px;
    --sor: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kurzor { animation: none; }
  .gomb, .nyelvek button svg, .nyelvek button::after { transition: none; }
}
