:root {

    --tile-w: 200px;
    --tile-h: 80px;
    --icon-size: calc(var(--tile-h) - 18px);

    --bg: #0d1220;
    --text: #edf2f7;
    --tile-bg: #16202e;
    --tile-br: #24303f;
    --accent-green: #22c55e;
    --menu-bg: #16202e;
}

html[data-theme="light"] {
    --bg: #f5f7fb;
    --text: #0d1220;
    --tile-bg: #ffffff;
    --tile-br: #e5e7eb;
    --menu-bg: #ffffff;
}

* {
    box-sizing: border-box
}

html,
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

html {
    min-height: 100%;
    background: var(--bg);
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

body {
    min-height: 100vh;
    background: var(--bg);
    overscroll-behavior: none;
}

header {
    position: relative;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
}

/* logo na środku pilota*/
header .logo {
    display: block;
    height: 38px;
    width: auto;
    max-width: 60vw;
    object-fit: contain;
}

@media (min-width: 761px) {
    header .logo {
        height: 64px;
    }
}

header .logo-light {
    display: none;
}

header .logo-dark {
    display: block;
}

html[data-theme="light"] header .logo-dark {
    display: none;
}

html[data-theme="light"] header .logo-light {
    display: block;
}

/* logox na środku logowania*/
.logox {
    display: block;
    height: 80px;
    max-width: 120vw;
    margin-top: 80px;
    object-fit: contain;
}

.logo-wrapper .logo-light {
    display: none;
}

.logo-wrapper .logo-dark {
    display: block;
}

html[data-theme="light"] .logo-wrapper .logo-dark {
    display: none;
}

html[data-theme="light"] .logo-wrapper .logo-light {
    display: block;
}

.logo-wrapper{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
}
.text-container h2{ margin:0; }
.logo-wrapper h2{ margin:0; }

.logo-wrapper .nazwa{
  margin-top: 8px;
  font-size: clamp(18px, 2.4vw, 26px);
}


header .menu {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    height: 30px;
    cursor: pointer;
    -webkit-user-drag: none;
}

/* gwiazdka przełącznika motywu jasny/ciemny */
.themeToggle {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    color: var(--text);
    background: var(--tile-bg);
    border: 1px solid var(--tile-br);
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    -webkit-tap-highlight-color: transparent;
}

#login-menu {
    position: fixed;
    padding: 20px;
    width: 100%;
    height: 50%;
    top: 20vh;
    bottom: 10vh;

    /* Ustawienie kontenera jako CSS Grid */
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
    gap: 2px;
}

/* Widok poziomy: zmniejsz całą stronę logowania o połowę (poza logo) */
@media (orientation: landscape) {
    #login-menu {
        top: 15vh;
        bottom: 5vh;
    }

    #login-menu #plogin,
    #login-menu #phaslo {
        font-size: 1.125rem;
    }

    #login-menu #login,
    #login-menu #passwd,
    #login-menu .result {
        font-size: 1.05rem;
        padding: 0.25em;
    }

    #login-menu .loginBtn {
        font-size: 25px;
        padding: 5px 10px;
    }
}

/* Widok poziomy: kafelki 2x szersze (wysokość bez zmian) */
@media (orientation: landscape) {
    :root {
        --tile-w: 400px;
    }
}

.sideMenu {
    height: 90vh;
    width: 0;
    position: fixed;
    z-index: 100;
    top: 0;
    right: 0;
    background-color: var(--menu-bg);
    overflow-x: hidden;
    transition: 1s;
    padding-top: 35px;
    box-shadow: 0 0 8px #333;
}

.loginBtn {
    background-color: #15ce24;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 50px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none !important;
}

/* większa czcionka dla etykiet */
#plogin,
#phaslo {
    font-size: 2.25rem;
    font-weight: bold;
}

/* większa czcionka dla pól input */
#login,
#passwd,
.result {
    font-size: 2.1rem;
    padding: 0.5em;
}

.wrap {
    max-width: 480px;
    margin: 24px auto;
    padding: 0 12px 32px;
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Kafelek */
.tile {
    position: relative;
    width: var(--tile-w);
    height: var(--tile-h);
    margin: 0 auto;
    background: var(--tile-bg);
    border: 1px solid var(--tile-br);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* ikonę trzymamy centralnie */
    padding: 12px 16px;
    padding-right: 120px;
    /* rezerwacja miejsca dla etykiety po prawej */
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .04);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Ikona jako DIV z tłem (ustawiane w JS) — 128px mieści się w całości */
.icon {
    width: var(--icon-size);
    height: var(--icon-size);
    background-position: center;
    background-size: contain;
    /* żadnego ucinania */
    background-repeat: no-repeat;
    display: block;
    margin-left: 10px;
    pointer-events: auto;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* Podpis po prawej */
.label {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    font-size: 20px;
    text-align: right;
    pointer-events: none;
}

/* Zielone kółeczko statusu po lewej */
.status-dot {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
}

.status-dot.on {
    background: #22c55e;
}

/* Animacja obrotu ikony po długim przytrzymaniu */
@keyframes spinOnce {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.icon.spinning {
    animation: spinOnce 0.6s linear 1;
}

/* Responsywność */
@media (max-width: 420px) {
    :root {
        --tile-w: 100%;
    }

    .label {
        font-size: 15px;
    }
}

.separator--thin {
    width: var(--tile-w);
    margin: 6px auto 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.separator--thin .sep-text {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .3px;
    color: var(--accent-green);
    line-height: 1;
}

.separator--thin .sep-line {
    display: block;
    width: 100%;
    height: 1px;
    /* cienka linia */
    background: var(--accent-green);
    border-radius: 999px;
    opacity: .95;
}

@media (max-width: 420px) {
    .separator--thin {
        width: 100%;
    }
}

.cdebug {
    font-size: clamp(12px, 5vw, 20px);
    font-weight: 150;
    text-align: center;
    color: #000000;
    margin-top: 20px;
}

/* Kolory kropek */
.status-dot { 
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  background: #d90429; /* domyślnie czerwone */
}
.status-dot.on  { background: #25a244; }  /* zielone */
.status-dot.off { background: #d90429; }  /* czerwone */
