/* =========================================
   RESET
========================================= */

* {
    box-sizing: border-box;
}


html {
    font-size: 16px;
}


body {
    margin: 0;

    min-height: 100vh;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    background: #f5f6f8;

    color: #1f2328;
}


/* =========================================
   APP
========================================= */

.app {
    width: 100%;

    max-width: 760px;

    margin: 0 auto;

    padding:
        32px 18px 50px;
}


/* =========================================
   HEADER
========================================= */

.header {
    margin-bottom: 22px;
}


.header h1 {
    margin: 0;

    font-size: 30px;

    letter-spacing: -0.5px;
}


.subtitle {
    margin:
        6px 0 0;

    color: #6b7280;

    font-size: 15px;
}


/* =========================================
   STATUS CARD
========================================= */

.status-card {
    background: #ffffff;

    border:
        1px solid #e2e5e9;

    border-radius: 14px;

    padding: 16px 18px;

    margin-bottom: 16px;
}


.status-row {
    display: flex;

    align-items: center;

    gap: 9px;

    font-weight: 600;

    font-size: 15px;
}


.status-dot {
    width: 9px;

    height: 9px;

    border-radius: 50%;

    background: #9ca3af;

    flex-shrink: 0;
}


.status-dot.connected {
    background: #16a34a;
}


.status-dot.connecting {
    background: #f59e0b;
}


.status-dot.error {
    background: #dc2626;
}


.system-status {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-top: 13px;
}


.system-status span {
    background: #f3f4f6;

    color: #555b65;

    padding:
        6px 9px;

    border-radius: 7px;

    font-size: 12px;
}


.system-status span.success {
    color: #166534;

    background: #ecfdf3;
}


.system-status span.warning {
    color: #92400e;

    background: #fff7ed;
}


.system-status span.error {
    color: #991b1b;

    background: #fef2f2;
}


/* =========================================
   CARDS
========================================= */

.card {
    background: #ffffff;

    border:
        1px solid #e2e5e9;

    border-radius: 14px;

    padding: 20px;

    margin-bottom: 16px;
}


.card-header {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 15px;

    margin-bottom: 17px;
}


.card h2 {
    margin: 0;

    font-size: 19px;
}


.card-header p {
    margin:
        5px 0 0;

    color: #6b7280;

    font-size: 14px;

    line-height: 1.45;
}


/* =========================================
   BUTTONS
========================================= */

button {
    font-family: inherit;

    cursor: pointer;

    border: 0;
}


.primary-button {
    background: #1f2328;

    color: white;

    padding:
        11px 17px;

    border-radius: 8px;

    font-size: 14px;

    font-weight: 600;

    transition:
        opacity 0.15s,
        transform 0.05s;
}


.primary-button:hover {
    opacity: 0.9;
}


.primary-button:active {
    transform: translateY(1px);
}


.primary-button:disabled {
    opacity: 0.4;

    cursor: not-allowed;
}


.secondary-button {
    background: #f1f3f5;

    color: #343a40;

    padding:
        10px 14px;

    border-radius: 8px;

    font-size: 14px;

    font-weight: 600;
}


.secondary-button:hover {
    background: #e8eaed;
}


.small-button {
    background: #f1f3f5;

    color: #343a40;

    padding:
        7px 11px;

    border-radius: 7px;

    font-size: 13px;

    font-weight: 600;
}


.small-button:disabled {
    opacity: 0.4;

    cursor: not-allowed;
}


/* =========================================
   HOST SECTION
========================================= */

.host-section {
    margin-top: 24px;

    text-align: center;
}


.room-label {
    color: #6b7280;

    font-size: 13px;

    margin-bottom: 5px;
}


.room-code {
    display: inline-block;

    font-size: 28px;

    font-weight: 700;

    letter-spacing: 4px;

    padding:
        9px 14px;

    background: #f3f4f6;

    border-radius: 9px;
}


.qr-wrapper {
    display: flex;

    justify-content: center;

    margin:
        22px 0 12px;
}


#qrCode {
    padding: 10px;

    background: white;

    border:
        1px solid #e5e7eb;

    border-radius: 10px;
}


#qrCode img,
#qrCode canvas {
    display: block;
}


.qr-help {
    color: #6b7280;

    font-size: 13px;

    margin:
        0 0 15px;
}


.waiting-message {
    margin-top: 17px;

    padding: 11px;

    border-radius: 8px;

    background: #fff7ed;

    color: #9a5b00;

    font-size: 13px;
}


/* =========================================
   AUTO JOIN
========================================= */

.auto-join {
    text-align: center;

    margin-top: 20px;

    padding:
        20px 10px;
}


.join-icon {
    font-size: 32px;

    margin-bottom: 7px;
}


.auto-join h3 {
    margin:
        0 0 6px;

    font-size: 17px;
}


.auto-join p {
    margin: 0;

    color: #6b7280;

    font-size: 14px;
}


/* =========================================
   TEXT INPUT
========================================= */

.text-input {
    width: 100%;

    min-height: 230px;

    resize: vertical;

    border:
        1px solid #d7dbe0;

    border-radius: 9px;

    padding: 14px;

    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        Menlo,
        monospace;

    font-size: 14px;

    line-height: 1.55;

    color: #1f2328;

    background: #fafbfc;

    outline: none;
}


.text-input:focus {
    border-color: #8b949e;

    background: white;
}


.input-footer {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    margin-top: 11px;
}


#characterCount {
    color: #8a919a;

    font-size: 12px;
}


/* =========================================
   RECEIVED TEXT
========================================= */

.received-text {
    margin: 0;

    min-height: 150px;

    max-height: 500px;

    overflow: auto;

    padding: 14px;

    border-radius: 9px;

    background: #f6f7f8;

    border:
        1px solid #e2e5e9;

    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        Menlo,
        monospace;

    font-size: 14px;

    line-height: 1.55;

    white-space: pre-wrap;

    word-break: break-word;

    color: #24292f;
}


/* =========================================
   FOOTER
========================================= */

.footer {
    display: flex;

    justify-content: center;

    gap: 8px;

    color: #9aa0a6;

    font-size: 12px;

    padding-top: 5px;
}


/* =========================================
   UTILITY
========================================= */

.hidden {
    display: none !important;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 600px) {

    .app {
        padding:
            22px 12px 35px;
    }


    .header h1 {
        font-size: 26px;
    }


    .card {
        padding: 16px;
    }


    .room-code {
        font-size: 23px;

        letter-spacing: 3px;
    }


    #qrCode img,
    #qrCode canvas {
        width: 230px !important;

        height: 230px !important;
    }


    .text-input {
        min-height: 210px;
    }


    .system-status {
        flex-direction: column;

        align-items: flex-start;
    }

}