:root {
    color-scheme: only light;
    --bg-color: #f0efeb;
    --text-color: #1d1d1f;
    --modal-bg: #ffffff;
    --input-bg: #f9f9fb;
    --border-color: #d2d2d7;
    --accent-bg: #1d1d1f;
    --accent-fg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    color-scheme: only light;
    background-color: #f0efeb;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Stała tablica na cały ekran bez przewijania */
.board {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f0efeb;
    cursor: crosshair;
}

/* Nagłówek na górze strony (logo + tytuł i treść obok siebie) — obszar wyłączony z przypinania karteczek */
.site-header {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
    padding: 20px 28px 16px;
    cursor: default;
    user-select: none;
}

.site-logo {
    flex-shrink: 0;
    display: block;
}

.site-logo img {
    display: block;
    height: 62px;
    width: auto;
    mix-blend-mode: multiply;
}

.site-header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 620px;
    padding-left: 25px;
}

.site-title {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 4px;
    color: var(--text-color);
}

.site-description {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--text-color);
    opacity: 0.85;
}

/* Wersja otwierana na telefonie (komputer pozostaje bez zmian) */
html.is-phone {
    height: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    color-scheme: only light;
    background-color: #f0efeb;
}

html.is-phone body {
    width: 100%;
    height: 150%;
    min-height: 150vh;
    min-height: 150dvh;
    overflow-x: hidden;
    overflow-y: visible;
    color-scheme: only light;
    background-color: #f0efeb;
    color: #1d1d1f;
}

html.is-phone .board {
    width: 100%;
    height: 100%;
    min-height: 150vh;
    min-height: 150dvh;
    background-color: #f0efeb;
}

html.is-phone .site-header {
    gap: 12px;
    padding: 14px 16px 12px;
}

html.is-phone .site-logo img {
    height: 48px;
}

html.is-phone .site-title {
    font-size: 18px;
}

html.is-phone .site-description {
    font-size: 13px;
}

/* Pasek administratora (widoczny tylko po zalogowaniu jako admin) */
.admin-bar {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    background-color: var(--modal-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 20px var(--shadow-color);
    font-size: 0.82rem;
}

.admin-badge {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
}

.admin-logout {
    color: #ef4444;
    text-decoration: none;
    font-weight: 500;
}

.admin-logout:hover {
    text-decoration: underline;
}

/* Pojedyncza karteczka — kompaktowy wymiar, 4 rogi zaokrąglone na 3px, zawsze poniżej nagłówka i wewnątrz ekranu */
.sticky-note {
    position: absolute;
    left: clamp(12px, var(--x, 10%), max(12px, calc(100% - 272px)));
    top: clamp(var(--min-y, 120px), var(--y, 140px), max(var(--min-y, 120px), calc(100% - 212px)));
    width: 260px;
    min-height: 200px;
    height: auto;
    padding: 24px 20px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #1f2937;
    border-radius: 3px;
    box-shadow: 0 8px 20px var(--shadow-color);
    transform: rotate(var(--rot, 0deg));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    cursor: default;
    user-select: none;
    z-index: 10;
}

.sticky-note[data-draggable="1"] {
    cursor: grab;
    touch-action: none;
}

.sticky-note:hover {
    transform: scale(1.03) rotate(0deg);
    z-index: 25;
}

.sticky-note.is-dragging {
    cursor: grabbing;
    transform: scale(1.05) rotate(0deg);
    box-shadow: 0 18px 34px var(--shadow-color);
    transition: none;
    z-index: 50;
}

/* Pasek kleju / taśmy na górze karteczki */
.sticky-note::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 18px;
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

/* Przycisk usuwania (tylko dla administratora) */
.delete-note-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(31, 41, 55, 0.12);
    color: #1f2937;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.delete-note-btn:hover {
    opacity: 1;
    background: #ef4444;
    color: #ffffff;
}

/* Kolory karteczek */
.note-yellow { background-color: #fef08a; }
.note-mint   { background-color: #bbf7d0; }
.note-pink   { background-color: #fbcfe8; }
.note-blue   { background-color: #bae6fd; }
.note-peach  { background-color: #fed7aa; }

.note-content {
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-wrap;
    margin-bottom: 16px;
}

.note-meta {
    font-size: 0.75rem;
    color: rgba(31, 41, 55, 0.65);
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px dashed rgba(31, 41, 55, 0.2);
    padding-top: 8px;
}

.note-author {
    font-weight: 600;
    color: rgba(31, 41, 55, 0.8);
}

.note-contact-badge {
    display: inline-block;
    font-weight: 600;
    color: #15803d;
}

.note-drag-hint {
    font-size: 0.68rem;
    opacity: 0.75;
    font-style: italic;
}

/* Parametry karteczek, hover oraz czcionka 12px wyłącznie na telefonie */
html.is-phone .sticky-note {
    position: absolute;
    left: clamp(12px, var(--x, 10%), max(12px, calc(100% - 150px)));
    top: clamp(var(--min-y, 120px), var(--y, 140px), max(var(--min-y, 120px), calc(100% - 112px)));
    width: 130px;
    min-height: 100px;
    height: auto;
    padding: 24px 20px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #1f2937;
    border-radius: 3px;
    box-shadow: 0 8px 20px var(--shadow-color);
    transform: rotate(var(--rot, 0deg));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    cursor: default;
    user-select: none;
    z-index: 10;
}

html.is-phone .sticky-note:hover,
html.is-phone .sticky-note:active,
html.is-phone .sticky-note.is-hovered {
    transform: scale(1.03) rotate(0deg);
    box-shadow: 0 14px 28px var(--shadow-color);
    z-index: 25;
}

html.is-phone .sticky-note.is-dragging {
    transform: scale(1.05) rotate(0deg);
    box-shadow: 0 18px 34px var(--shadow-color);
    transition: none;
    z-index: 50;
}

html.is-phone .sticky-note::before {
    top: -5px;
    width: 34px;
    height: 10px;
}

html.is-phone .delete-note-btn {
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    font-size: 12px;
}

html.is-phone .note-content {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 10px;
}

html.is-phone .note-meta {
    font-size: 12px;
    gap: 2px;
    padding-top: 6px;
}

html.is-phone .note-author {
    font-size: 12px;
}

html.is-phone .note-drag-hint {
    font-size: 10px;
}


/* Pływający pasek w prawym dolnym rogu (licznik + przycisk dodawania) */
.fab-group {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 90;
}

.notes-counter {
    padding: 10px 16px;
    border-radius: 999px;
    background-color: var(--modal-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 20px var(--shadow-color);
    font-size: 0.88rem;
    user-select: none;
    white-space: nowrap;
}

.notes-counter strong {
    font-weight: 700;
}

.add-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background-color: var(--accent-bg);
    color: var(--accent-fg);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--shadow-color);
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.add-btn:hover {
    transform: scale(1.08);
}

/* Okno modalne z formularzem */
dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    z-index: 200;
    width: min(92vw, 440px);
    max-height: 92dvh;
    overflow-y: auto;
    padding: 26px 28px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--modal-bg);
    color: var(--text-color);
    box-shadow: 0 20px 40px var(--shadow-color);
    cursor: default;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

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

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-hint {
    font-size: 0.82rem;
    opacity: 0.75;
    margin-bottom: 16px;
    line-height: 1.4;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    opacity: 0.6;
}

.close-btn:hover {
    opacity: 1;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    opacity: 0.85;
}

.optional-tag {
    font-size: 0.78rem;
    opacity: 0.65;
    font-weight: 400;
}

.required-tag {
    font-size: 0.78rem;
    color: #ef4444;
    font-weight: 500;
}

.form-group input[type="email"],
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 104px;
}

/* Checkbox "Proszę o kontakt" poniżej pola e-mail */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-bg);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-row label {
    margin-bottom: 0;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* Notka informacyjna RODO poniżej treści notatki */
.rodo-note {
    font-size: 0.74rem;
    line-height: 1.45;
    opacity: 0.75;
    margin-bottom: 16px;
}

.rodo-note a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rodo-note a:hover {
    opacity: 1;
}

.error-msg {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background-color: var(--accent-bg);
    color: var(--accent-fg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.submit-btn:hover {
    opacity: 0.9;
}

.hp-field {
    display: none;
}