:root {
    --bg-1: #0a0d12;
    --bg-2: #11161d;
    --card-1: rgba(18, 23, 31, 0.96);
    --card-2: rgba(13, 17, 24, 0.96);
    --tile-1: rgba(34, 39, 49, 0.96);
    --tile-2: rgba(23, 28, 37, 0.96);
    --line: rgba(255, 255, 255, 0.10);
    --line-2: rgba(255, 255, 255, 0.08);
    --text: #f3f6fb;
    --muted: #9aa7b8;
    --blue: #4da3ff;
    --blue-2: #78b9ff;
    --orange: #ff8a2a;
    --green: #64e38b;
    --danger: #ff6b6b;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    font-family: Arial, sans-serif;
    margin: 40px;
    background: #1e1e1e;
    color: white;
}

body.login-page,
body.panel-page {
    margin: 0;
    padding: 0;
    color: var(--text);
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at 15% 20%, rgba(77, 163, 255, 0.13), transparent 28%),
        radial-gradient(circle at 85% 80%, rgba(255, 138, 42, 0.10), transparent 26%),
        linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
}

h1 {
    margin-bottom: 10px;
}

h2 {
    margin-top: 40px;
}

a {
    color: var(--blue);
}

/* =========================
   LOGIN
========================= */

.login-page {
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
}

.login-page-wrap {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-layout {
    width: 100%;
    max-width: 1220px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: stretch;
}

.login-hero,
.login-card-modern {
    border: 1px solid var(--line);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.login-hero {
    background: linear-gradient(160deg, rgba(19, 25, 34, 0.94), rgba(11, 15, 22, 0.92));
    padding: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    font-size: 12px;
    color: var(--blue-2);
    letter-spacing: 0.08em;
    margin-bottom: 18px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px rgba(100, 227, 139, 0.8);
}

.login-hero h1 {
    margin: 0 0 14px 0;
    font-size: 48px;
    line-height: 1.02;
}

.login-hero h1 span {
    color: var(--orange);
}

.login-hero p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    font-size: 16px;
    max-width: 620px;
}

.login-hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.login-feature {
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.08);
    color: #d8e2ef;
    font-size: 13px;
}

.login-card-modern {
    background: linear-gradient(180deg, var(--card-1), var(--card-2));
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-badge-modern {
    display: inline-block;
    align-self: flex-start;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(77, 163, 255, 0.12);
    border: 1px solid rgba(77, 163, 255, 0.30);
    color: var(--blue-2);
    font-size: 12px;
    margin-bottom: 14px;
}

.login-card-modern h2 {
    margin: 0 0 8px 0;
    font-size: 30px;
}

.login-subtitle-modern {
    margin: 0 0 22px 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.field-group label {
    font-size: 13px;
    color: #dbe6f3;
}

.login-card-modern input {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: white;
    padding: 0 14px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-card-modern input:focus {
    border-color: rgba(77, 163, 255, 0.75);
    box-shadow: 0 0 0 4px rgba(77, 163, 255, 0.14);
    background: rgba(255,255,255,0.06);
}

.login-button-modern {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--orange) 0%, #ff6f1f 45%, #ff9d3f 100%);
    box-shadow: 0 12px 26px rgba(255, 111, 31, 0.28);
    transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.15s ease;
    margin-top: 8px;
}

.login-button-modern:active {
    transform: translateY(1px);
}

.login-footer-modern {
    margin-top: 18px;
    font-size: 12px;
    color: #8fa0b4;
    text-align: center;
}

/* =========================
   PANEL LAYOUT
========================= */

.panel-page {
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

.panel-bg {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 38px 38px;
    pointer-events: none;
    opacity: 0.5;
}

.panel-shell {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: 22px;
    touch-action: pan-y;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(19, 25, 34, 0.94), rgba(11, 15, 22, 0.92));
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.panel-header-left h1 {
    margin: 16px 0 8px 0;
    font-size: 40px;
    line-height: 1.05;
}

.panel-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}

.panel-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.panel-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    font-size: 12px;
    color: var(--blue-2);
    letter-spacing: 0.08em;
}

.panel-status-badge.online .status-dot {
    background: #64e38b;
    box-shadow: 0 0 14px rgba(100, 227, 139, 0.95);
}

.panel-status-badge.offline .status-dot {
    background: #ff5b5b;
    box-shadow: 0 0 14px rgba(255, 91, 91, 0.95);
}

.panel-server-status {
    margin: 0;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    font-size: 14px;
    min-width: 220px;
    text-align: center;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--orange) 0%, #ff6f1f 45%, #ff9d3f 100%);
    box-shadow: 0 12px 26px rgba(255, 111, 31, 0.22);
}

.logout-btn:hover {
    filter: brightness(1.05);
    color: white;
}

.panel-top-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-card {
    position: relative;
    margin-bottom: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(180deg, var(--card-1), var(--card-2));
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.compact-card {
    height: 100%;
}

/* =========================
   SECTION HEADERS
========================= */

.section-head {
    position: relative;
    margin: -20px -20px 18px -20px;
    padding: 16px 20px 14px 20px;
    background: rgba(8, 14, 24, 0.94);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    text-align: center;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.section-head::before {
    display: none;
}

.section-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #e7edf7;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    position: relative;
}

.section-head h2::after {
    content: "";
    display: block;
    width: 88px;
    height: 3px;
    margin: 10px auto 0 auto;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
}

/* =========================
   COMMON BLOCKS
========================= */

.grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    touch-action: pan-y;
}

.tile-grid,
.player-list {
    touch-action: pan-y;
}

#output {
    margin: 0;
    background: #0b0f14;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 16px;
    color: #dbe6f3;
    min-height: 120px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.top-actions {
    margin: 15px 0 25px 0;
}

.top-actions-modern {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 16px 0;
}

.top-actions-modern button,
.admin-box-modern button,
.modal-buttons button,
.top-actions button {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.06);
    color: white;
    cursor: pointer;
    transition: 0.15s ease;
}

.top-actions-modern button:hover,
.admin-box-modern button:hover,
.top-actions button:hover,
.modal-buttons button:hover {
    border-color: var(--blue);
    background: rgba(77, 163, 255, 0.12);
}

.admin-box,
.admin-box-modern {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-box {
    margin-bottom: 30px;
}

.admin-box-modern {
    margin-bottom: 0;
}

.admin-box input,
.admin-box-modern input {
    min-height: 48px;
    padding: 10px 14px;
    min-width: 220px;
    flex: 1 1 260px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: white;
    font-size: 16px;
    outline: none;
}

.admin-box input:focus,
.admin-box-modern input:focus {
    border-color: rgba(77, 163, 255, 0.75);
    box-shadow: 0 0 0 4px rgba(77, 163, 255, 0.14);
}

.admin-box button {
    padding: 10px 16px;
    border: 1px solid #444;
    background: #3a3a3a;
    color: white;
    border-radius: 6px;
    cursor: pointer;
}

.admin-box button:hover {
    border-color: var(--blue);
}

/* =========================
   CURRENT MAP / PLAYERS
========================= */

.current-map-preview {
    display: flex;
    gap: 14px;
    align-items: center;
}

.current-map-preview img {
    width: 180px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.current-map-preview-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.current-map-preview-name {
    font-size: 22px;
    font-weight: 700;
    color: #eef3fb;
    word-break: break-word;
}

.player-status-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.player-status-pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    color: #d9e4f2;
    font-size: 13px;
    font-weight: 700;
}

/* =========================
   TILES
========================= */

.tile,
.map-tile,
.rotation-tile,
.command-tile {
    -webkit-tap-highlight-color: transparent;
}

.tile {
    width: 360px;
    min-height: 320px;
    max-width: 100%;
    background: linear-gradient(180deg, var(--tile-1), var(--tile-2));
    border: 1px solid var(--line-2);
    border-radius: 16px;
    padding: 10px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-align: center;
    transition: 0.15s;
    user-select: none;
    flex-shrink: 0;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
}

.tile:hover {
    background: linear-gradient(180deg, rgba(39, 45, 57, 0.98), rgba(26, 31, 40, 0.98));
    border-color: rgba(77, 163, 255, 0.65);
    transform: translateY(-2px);
}

.tile img {
    width: 340px;
    height: 246px;
    max-width: 100%;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    transition: transform 0.18s ease;
}

.tile:hover img {
    transform: scale(1.035);
}

.tile span {
    display: block;
    margin-top: 6px;
    margin-bottom: 14px;
    font-size: 14px;
    text-align: center;
    word-break: break-word;
}

.tile-sub {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #bdbdbd;
    word-break: break-all;
}

.map-tile {
    width: 360px;
    min-height: 320px;
}

.command-tile {
    width: 220px;
    min-height: 78px;
    padding: 10px 10px 42px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.command-tile::before {
    content: "";
    display: block;
    height: 10px;
    background: linear-gradient(90deg, var(--blue), var(--orange));
    margin: -10px -10px 10px -10px;
}

.command-tile span {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
    margin-top: 0;
    margin-bottom: 14px;
}

.rotation-tile {
    width: 220px;
    min-height: 235px;
    padding: 10px;
    padding-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.rotation-tile span {
    display: block;
    width: 100%;
    font-size: 14px;
    text-align: center;
    color: white;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    margin-bottom: 14px;
}

.rotation-tile img {
    width: 200px;
    height: 130px;
    max-width: 100%;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    display: block;
}

.add-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: bold;
    color: #888;
}

.add-tile:hover {
    color: white;
}

.add-tile.command-tile {
    min-height: 78px;
    font-size: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile.dragging {
    opacity: 0.5;
}

.tile.drag-over {
    outline: 2px dashed var(--blue);
}

.current-map {
    outline: 3px solid #00ff6a;
    box-shadow: 0 0 10px rgba(0,255,100,0.6);
}

.next-map {
    outline: 2px solid #ffaa00;
}

.rotation-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.badge-current {
    background: #00ff6a;
    color: black;
}

.badge-next {
    background: #ffaa00;
    color: black;
}

/* =========================
   TILE ACTIONS
========================= */

.tile-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    z-index: 3;
    margin-top: 8px;
}

.command-tile .tile-actions {
    gap: 6px;
    padding: 0;
}

.favorite-btn,
.tile-actions button {
    width: 32px;
    height: 32px;
    border: 1px solid #555;
    border-radius: 10px;
    background: rgba(20,20,20,0.9);
    color: white;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.favorite-btn {
    color: #bbb;
}

.favorite-btn:hover,
.tile-actions button:hover {
    border-color: var(--blue);
    background: rgba(40, 40, 40, 0.95);
}

.favorite-btn.active {
    color: gold;
}

.tile-actions .delete-btn:hover {
    border-color: var(--danger);
}

.rotation-btn:hover {
    border-color: #7ed957;
}

/* =========================
   PLAYERS
========================= */

.player-list {
    margin-top: 10px;
}

.player-container {
    display: flex;
    gap: 25px;
    margin-top: 10px;
}

.player-column {
    flex: 1;
}

.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 6px;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.25s ease;
}

.player-row.join {
    opacity: 0;
    transform: translateY(-6px);
}

.player-row.show {
    opacity: 1;
    transform: translateY(0);
}

.player-row.leave {
    opacity: 0;
    transform: translateY(6px);
}

.player-row:hover {
    border-color: rgba(77, 163, 255, 0.55);
    background: rgba(255,255,255,0.06);
}

.player-row.bot-row {
    border-color: #8a6b2d;
    background: #3a2f16;
}

.player-name {
    font-size: 15px;
}

.player-actions button {
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.06);
    color: white;
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
}

.player-actions button:hover {
    border-color: var(--blue);
    background: rgba(77, 163, 255, 0.12);
}

.player-tag {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #444;
}

.player-tag.bot {
    background: #8a6b2d;
}

.player-tag.human {
    background: #2d5a8a;
}

/* =========================
   MODAL
========================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 11, 0.72);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(180deg, var(--card-1), var(--card-2));
    padding: 25px;
    border-radius: 18px;
    min-width: 340px;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: var(--shadow);
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    color: white;
    border-radius: 10px;
    box-sizing: border-box;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.delete-modal p {
    margin: 14px 0 18px 0;
    color: #ddd;
}

.danger-btn {
    border: 1px solid #a33 !important;
    background: #8b1e1e !important;
    color: white !important;
}

.danger-btn:hover {
    border-color: var(--danger) !important;
    background: #a92222 !important;
}

/* =========================
   MOBILE EDIT MODE
========================= */

.mobile-edit-btn {
    display: none;
}

.mobile-edit-btn.fullwidth {
    width: 100%;
    justify-content: center;
}

.mobile-edit-floating {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 10px);
    right: 12px;
    z-index: 999;
    display: none;
}

.mobile-edit-floating.show {
    display: block;
}

.mobile-edit-floating-btn {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    background: rgba(12, 18, 28, 0.92);
    color: white;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(0,0,0,0.35);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.mobile-edit-floating-btn:hover {
    border-color: #ff8a2a;
    background: rgba(255, 138, 42, 0.16);
}

/* =========================
   DRAG SIZE FIX
========================= */

.sortable-ghost,
.sortable-chosen,
.sortable-drag {
    width: auto !important;
    max-width: 100% !important;
    transform: none !important;
}

body.mobile-edit-mode .sortable-ghost,
body.mobile-edit-mode .sortable-chosen,
body.mobile-edit-mode .sortable-drag {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body.mobile-edit-mode .grid > .sortable-ghost,
body.mobile-edit-mode .grid > .sortable-chosen,
body.mobile-edit-mode .grid > .sortable-drag {
    height: auto !important;
}

/* =========================
   ECHTER STICKY KARTENKOPF TEST
========================= */

.sticky-card .section-head {
    position: relative !important;
    top: auto !important;
    margin: 0 !important;
    padding: 18px 20px 14px 20px !important;
    background: rgba(8, 14, 24, 0.96) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
    box-shadow: none !important;
}

.sticky-card-head {
    position: sticky;
    top: 0;
    z-index: 25;
    background: linear-gradient(180deg, rgba(13, 17, 24, 0.98), rgba(13, 17, 24, 0.98));
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    overflow: hidden;
}

.sticky-card-body {
    padding-top: 14px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .login-layout,
    .panel-top-grid {
        grid-template-columns: 1fr;
    }

    .panel-header {
        flex-direction: column;
    }

    .panel-header-right {
        align-items: flex-start;
        width: 100%;
    }
}

@media (max-width: 900px) {
    .panel-shell {
        padding: 10px;
    }

    .panel-card {
        padding: 12px;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .section-head {
        margin: -12px -12px 14px -12px;
        padding: 14px 12px 12px 12px;
        border-top-left-radius: 14px;
        border-top-right-radius: 14px;
    }

    .section-head h2 {
        font-size: 20px;
        line-height: 1.2;
    }

    .mobile-edit-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 10px 16px;
        border: 1px solid #444;
        background: #3a3a3a;
        color: white;
        border-radius: 10px;
        cursor: pointer;
    }

    .mobile-edit-btn.active {
        border-color: var(--orange);
        background: rgba(255, 138, 42, 0.18);
    }

    .grid,
    .tile-grid,
    #favorites_commands,
    #favorites_maps,
    #maps_de,
    #maps_cs,
    #maps_wingman,
    #maps_workshop,
    #maps_gungame,
    #cmd_server,
    #cmd_bots,
    #cmd_modes,
    #mapRotation {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }

    .tile,
    .map-tile,
    .rotation-tile,
    .command-tile,
    .add-tile {
        display: flex;
        flex-direction: column;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        min-height: auto !important;
        padding: 10px !important;
        border-radius: 14px;
        overflow: hidden;
    }

    .command-tile {
        min-height: 120px !important;
        padding-bottom: 10px !important;
    }

    .rotation-tile {
        min-height: auto !important;
        padding-bottom: 10px !important;
    }

    .tile img,
    .map-tile img,
    .rotation-tile img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
        object-fit: cover !important;
        border-radius: 10px;
        margin: 0 0 8px 0 !important;
        display: block;
    }

    .tile span,
    .map-tile span,
    .rotation-tile span,
    .command-tile span {
        display: block;
        width: 100%;
        font-size: 15px;
        line-height: 1.25;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        margin: 0 0 12px 0;
    }

    .tile-actions {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        margin-top: 2px;
        position: static;
        right: auto;
        bottom: auto;
        transform: none;
    }

    .tile-actions button,
    .favorite-btn,
    .rotation-btn,
    .edit-btn,
    .delete-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 10px;
    }

    .tile-sub {
        display: block;
        margin-top: 6px;
        text-align: center;
        font-size: 12px;
    }

    .rotation-badge {
        position: static;
        display: inline-block;
        margin: 6px auto 0 auto;
    }

    .current-map-preview {
        flex-direction: column;
        align-items: stretch;
    }

    .current-map-preview img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .current-map-preview-name {
        text-align: center;
        font-size: 20px;
    }

    .mobile-edit-floating {
        top: auto;
        bottom: calc(env(safe-area-inset-bottom) + 12px);
        left: 12px;
        right: 12px;
        display: none;
    }

    .mobile-edit-floating.show {
        display: block;
    }

    .mobile-edit-floating-btn {
        width: 100%;
        min-height: 48px;
        border-radius: 14px;
        background: linear-gradient(135deg, #ffb36b 0%, #ff8a2a 100%);
        color: #111;
        border: 0;
        font-weight: 800;
    }

    body:not(.mobile-edit-mode) .tile,
    body:not(.mobile-edit-mode) .map-tile,
    body:not(.mobile-edit-mode) .rotation-tile,
    body:not(.mobile-edit-mode) .command-tile {
        touch-action: pan-y;
    }

    body.mobile-edit-mode .tile,
    body.mobile-edit-mode .map-tile,
    body.mobile-edit-mode .rotation-tile,
    body.mobile-edit-mode .command-tile {
        touch-action: none;
        outline: 2px dashed rgba(255, 138, 42, 0.35);
        outline-offset: 2px;
    }

    body.mobile-edit-mode .grid,
    body.mobile-edit-mode .tile-grid,
    body.mobile-edit-mode #favorites_commands,
    body.mobile-edit-mode #favorites_maps,
    body.mobile-edit-mode #maps_de,
    body.mobile-edit-mode #maps_cs,
    body.mobile-edit-mode #maps_wingman,
    body.mobile-edit-mode #maps_workshop,
    body.mobile-edit-mode #maps_gungame,
    body.mobile-edit-mode #cmd_server,
    body.mobile-edit-mode #cmd_bots,
    body.mobile-edit-mode #cmd_modes,
    body.mobile-edit-mode #mapRotation {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    body.mobile-edit-mode .tile,
    body.mobile-edit-mode .map-tile,
    body.mobile-edit-mode .rotation-tile,
    body.mobile-edit-mode .command-tile,
    body.mobile-edit-mode .add-tile {
        min-height: auto !important;
        padding: 8px !important;
    }

    body.mobile-edit-mode .tile img,
    body.mobile-edit-mode .map-tile img,
    body.mobile-edit-mode .rotation-tile img {
        aspect-ratio: 16 / 10 !important;
        margin-bottom: 6px !important;
    }

    body.mobile-edit-mode .tile span,
    body.mobile-edit-mode .map-tile span,
    body.mobile-edit-mode .rotation-tile span,
    body.mobile-edit-mode .command-tile span {
        font-size: 12px !important;
        line-height: 1.1 !important;
        margin-bottom: 6px !important;
    }

    body.mobile-edit-mode .tile-actions {
        gap: 6px !important;
    }

    body.mobile-edit-mode .tile-actions button,
    body.mobile-edit-mode .favorite-btn,
    body.mobile-edit-mode .rotation-btn,
    body.mobile-edit-mode .edit-btn,
    body.mobile-edit-mode .delete-btn {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
        font-size: 14px !important;
    }

    #favorites_maps,
    #favorites_commands {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        width: 100% !important;
    }

    #favorites_maps .tile,
    #favorites_maps .map-tile,
    #favorites_commands .command-tile {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        min-height: auto !important;
        padding: 8px !important;
    }

    #favorites_maps .tile img,
    #favorites_maps .map-tile img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 10 !important;
        margin-bottom: 6px !important;
    }

    #favorites_maps .tile span,
    #favorites_maps .map-tile span,
    #favorites_commands .command-tile span {
        font-size: 13px !important;
        line-height: 1.15 !important;
        margin-bottom: 6px !important;
    }

    #favorites_maps .tile-actions,
    #favorites_commands .tile-actions {
        gap: 6px !important;
    }

    #favorites_maps .tile-actions button,
    #favorites_maps .favorite-btn,
    #favorites_commands .tile-actions button,
    #favorites_commands .favorite-btn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
        font-size: 16px !important;
    }

    .sticky-card .section-head {
        padding: 16px 12px 12px 12px !important;
        border-top-left-radius: 14px !important;
        border-top-right-radius: 14px !important;
    }

    .sticky-card-head {
        top: 0;
        border-top-left-radius: 14px;
        border-top-right-radius: 14px;
    }

    .sticky-card-body {
        padding-top: 12px;
    }
}

@media (max-width: 700px) {
    .login-layout {
        gap: 14px;
    }

    .login-hero,
    .login-card-modern,
    .panel-header,
    .panel-card {
        padding: 18px;
        border-radius: 16px;
    }

    .login-hero h1 {
        font-size: 32px;
    }

    .login-hero {
        order: 2;
    }

    .login-card-modern {
        order: 1;
    }

    .panel-header-left h1 {
        font-size: 28px;
    }

    .section-head {
        margin: -18px -18px 12px -18px;
        padding: 12px 18px 10px 18px;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }

    .section-head h2 {
        font-size: 20px;
    }

    .panel-server-status,
    .logout-btn {
        width: 100%;
    }

    .top-actions-modern,
    .admin-box-modern,
    .modal-buttons {
        flex-direction: column;
    }

    .top-actions-modern button,
    .admin-box-modern button,
    .modal-buttons button {
        width: 100%;
    }

    .admin-box-modern input,
    .admin-box input {
        width: 100%;
        min-width: 0;
    }

    .modal {
        padding: 14px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal-content {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        margin-top: 20px;
    }

    .sticky-card .section-head {
        padding: 16px 18px 12px 18px !important;
        border-top-left-radius: 16px !important;
        border-top-right-radius: 16px !important;
    }

    .sticky-card-head {
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }
}

@media (max-width: 520px) {
    body.mobile-edit-mode .grid,
    body.mobile-edit-mode .tile-grid,
    body.mobile-edit-mode #favorites_commands,
    body.mobile-edit-mode #favorites_maps,
    body.mobile-edit-mode #maps_de,
    body.mobile-edit-mode #maps_cs,
    body.mobile-edit-mode #maps_wingman,
    body.mobile-edit-mode #maps_workshop,
    body.mobile-edit-mode #maps_gungame,
    body.mobile-edit-mode #cmd_server,
    body.mobile-edit-mode #cmd_bots,
    body.mobile-edit-mode #cmd_modes,
    body.mobile-edit-mode #mapRotation {
        grid-template-columns: 1fr 1fr;
    }

    .tile span,
    .map-tile span,
    .rotation-tile span,
    .command-tile span {
        font-size: 14px;
    }
}

@media (min-width: 901px) {
    .mobile-edit-floating {
        display: none !important;
    }
}

/* =========================
   IOS INPUT ZOOM FIX
========================= */

input,
textarea,
select {
    font-size: 16px !important;
}

.admin-box input,
.admin-box-modern input,
.modal-content input,
.modal-content textarea,
.login-card-modern input {
    font-size: 16px !important;
}