@font-face {
    font-family: 'FiraCode';
    src: url('../fonts/FiraCode-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background-color: #27272f;
    color: #929295;
    font-family: 'FiraCode', monospace !important;
    font-size: 13px !important;
    word-spacing: 0px !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Tooltip ── */
#ft-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    background-color: #1e1e25;
    color: #e0e0e2;
    border: 1px solid #ec7519;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: 'FiraCode', monospace;
    font-size: 11px;
    line-height: 1.5;
    max-width: 420px;
    word-break: break-all;
    pointer-events: none;
    white-space: pre-wrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
#ft-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Floating buttons ── */
a.header-arrow-up i {
    position: fixed;
    bottom: 20px;
    right: 20px;
    border: 1px solid #ec7519;
    font-size: 28px;
    border-radius: 100%;
    padding: 6px 10px;
    color: #ec7519;
    z-index: 1000;
    background: #27272f;
    text-decoration: none;
}

.search-icon {
    position: fixed;
    bottom: 78px;
    right: 20px;
    border: 1px solid #ec7519;
    font-size: 22px;
    border-radius: 100%;
    padding: 10px 11px;
    color: #ec7519;
    cursor: pointer;
    z-index: 1000;
    background: #27272f;
}

#searchInput {
    position: fixed;
    bottom: 136px;
    right: 20px;
    width: 0;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #ec7519;
    background-color: #32333d;
    color: #e0e0e2;
    outline: none;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
    font-family: 'FiraCode', monospace;
    font-size: 13px;
    z-index: 1000;
}
#searchInput.active { width: 230px; opacity: 1; }
#searchInput::placeholder { color: #555; }

/* ── Header ── */
#header-container {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    min-height: 54px;
    border-bottom: 1px solid #ec7519;
    padding: 0 24px;
    flex-wrap: wrap;
    gap: 10px 150px;
}

#logo h1 { margin: 0; }
#logo h1 a { color: #ec7519; text-decoration: none; }
nav ul { display: flex; list-style: none; padding: 0; margin: 0; gap: 20px; flex-wrap: wrap; }
nav a { color: #929295; text-decoration: none; transition: color 0.2s; }
nav a:hover { color: #ec7519; }

main {
    flex: 1;
}

footer {
    border-top: 1px solid #ec7519;
    text-align: center;
    height: 50px;
    word-break: break-all;
}

footer a { color: #ec7519; }

/* ── Cards Grid ── */
#meshDiv {
    width: 94%;
    max-width: 1440px;
    margin: 28px auto 80px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ── Card ── */
.device-card {
    background-color: #32333d;
    border: 1px solid #3e3f4a;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.device-card:hover {
    border-color: #ec7519;
    box-shadow: 0 6px 22px rgba(236,117,25,0.1);
    transform: translateY(-2px);
}

/* ── Card Header ── */
.card-header {
    background-color: #3a3b45;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #2c2d36;
}
.card-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 6px;
    background-color: #27272f;
    padding: 4px;
    flex-shrink: 0;
}
.card-img-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    background-color: #27272f;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #494951;
}
.card-header-text { flex: 1; min-width: 0; }
.card-device-name {
    color: #e8e8ea;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}
.card-playset {
    margin-top: 4px;
    font-size: 11px;
    color: #929295;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}
.card-playset-label { color: #ec7519; opacity: 0.8; }

/* ── Important banner ── */
.card-important {
    background-color: rgba(200,132,29,0.08);
    border-left: 3px solid #c8841d;
    color: #c8841d;
    font-size: 11px;
    padding: 7px 12px;
    line-height: 1.5;
}

/* ── Path row ── */
.card-path {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: #2c2d36;
    border-bottom: 1px solid #3e3f4a;
}
.card-path-label {
    color: #ec7519;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    flex-shrink: 0;
    opacity: 0.75;
}
.card-path-value {
    flex: 1;
    font-size: 11px;
    color: #7a7a7e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    cursor: default;
}

/* ── Settings ── */
.card-settings { flex: 1; }

.setting-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #2c2d36;
}
.setting-row:last-child { border-bottom: none; }

.setting-name {
    flex: 0 0 36%;
    max-width: 36%;
    padding: 9px 8px 9px 12px;
    color: #b0b0b3;
    font-size: 11px;
    background-color: #2e2f38;
    border-right: 1px solid #2c2d36;
    display: flex;
    align-items: center;
    word-break: break-word;
    line-height: 1.4;
    cursor: default;
}

.setting-fields {
    flex: 1;
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.setting-field-line {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.field-tag {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #ec7519;
    opacity: 0.6;
    flex-shrink: 0;
    width: 22px;
}
.field-text {
    flex: 1;
    font-size: 11px;
    color: #929295;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    cursor: default;
}

/* ── Copy button ── */
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 3px;
    font-size: 11px;
    color: #4a4a52;
    flex-shrink: 0;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.copy-btn:hover { color: #ec7519; background-color: rgba(236,117,25,0.1); }

.card-playset{
    display:flex;
    align-items:center;
    min-width:0;
}

.card-playset-value{
    flex:1;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    #meshDiv { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); width: 96%; }
}
@media (max-width: 600px) {
    #header-container { flex-direction: column; height: auto; padding: 10px 16px; gap: 8px; }
    nav ul { gap: 12px; justify-content: center; }
    #meshDiv { grid-template-columns: 1fr; width: 96%; margin: 16px auto 80px; }
    #searchInput.active { width: 180px; }
}
