body {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    background-color: #eee;
    padding: 0;
    min-height: 100vh;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

header {
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #1f2937;
    padding: 10px;
    width: 100%;
    color: white;
    text-align: center;
}

h1 {
    margin-top: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 2em;
}

.ip-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: space-between;
    justify-content: space-between;
    align-items: center;
    box-sizing: content-box;
    margin-top: 40px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 0.5px solid lightgray;
    border-radius: 12px;
    background-color: #fff;
    padding: 20px;
    width: 90%;
    max-width: 550px;
}

.ip-text {
    flex: 1;
    font-size: 1.2rem;
    word-break: break-word;
}

.copy-btn {
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    padding: 10px 16px;
    width: 5em;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.copy-btn:hover, .copy-btn:focus {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #0056b3;
}

.copy-btn.success {
    background-color: #28a745;
    padding: 10px;
}

.copy-btn.error {
    background-color: #dc3545;
}

.last-refresh {
    margin: 50px 0 0 0;
    font-style: italic;
}

.ip-toast {
    display: none;
    position: fixed;
    opacity: 0;
    z-index: 1000;
    transition: opacity 0.5s ease, transform 0.5s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    background-color: #87cefabd;
    padding: 12px 20px;
    color: #1c1c1c;
    font-family: sans-serif;
}

.ip-toast.show {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.ip-toast-close {
    cursor: pointer;
    margin: 0;
    margin-left: 10px;
    border: none;
    background: none;
    color: #333;
    font-size: 18px;
}

footer {
    position: fixed;
    bottom: 0;
    box-sizing: border-box;
    border-top: 1px solid #ddd;
    background-color: lightsteelblue;
    padding: 10px;
    width: 100%;
    font-size: 0.9em;
    text-align: center;
}

footer p {
    margin: 0;
}

a {
    text-decoration: none;
}

a:hover, a:focus {
    border-bottom: 2px solid #0056b3;
}

button {
    -ms-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}

.spinner {
    display: inline-block;
    vertical-align: middle;
    opacity: 1;
    animation: spin 0.6s linear infinite;
    transition: opacity 0.3s ease;
    box-sizing: content-box;
    margin-right: 0.5em;
    border: 0.2em solid rgba(0, 0, 0, 0.1);
    border-top: 0.2em solid #3b82f6;
    border-radius: 50%;
    width: 1em;
    height: 1em;
}

.shortcut-hint {
    text-decoration: underline;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .ip-toast {
        bottom: 100px;
        transform: translateX(-50%);
        padding: 8px;
        font-size: smaller;
    }

    .ip-toast-close {
        margin: 0;
    }
}

@media (min-width: 769px) {
    .ip-toast {
        top: 20px;
        right: 20px;
        transform: translateY(-20px);
    }
}

@media (max-width: 600px) {
    header {
        margin: 0;
        background-color: #0c192b;
        color: #e0e0e0;
    }

    h1 {
        font-size: 1.5rem;
    }

    .ip-text {
        margin: 0;
        font-size: 1rem;
        word-break: break-all;
    }

    .ip-container {
        margin-top: 15%;
        width: 80%;
    }

    .copy-btn {
        box-sizing: border-box;
        margin: 0 0 0 5px;
        padding: 11px;
        min-width: 7em;
        font-size: 12px;
    }

    .copy-btn:hover, .copy-btn:focus {
        transform: scale(1);
    }

    .last-refresh {
        margin: 20% 0 0 0;
        width: 90%;
        text-align: center;
    }

    footer {
        box-sizing: border-box;
        padding: 20px;
        width: 100%;
    }

    .spinner {
        border-width: 0.15em;
        width: 0.8em;
        height: 0.8em;
    }

    .shortcut-hint {
        text-decoration: none;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    a {
        color: lightblue;
    }

    .ip-container {
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.05);
        background-color: #2c2c2c;
    }

    .ip-toast {
        background-color: #013b5ecc;
        color: #fff;
    }

    .ip-toast-close {
        color: #fff;
    }

    .copy-btn {
        background-color: #0c42b8;
        color: #fff;
    }

    .copy-btn:hover, .copy-btn:focus {
        box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
        background-color: #002f96;
    }

    .copy-btn.success {
        background-color: #34c759;
    }

    .copy-btn.error {
        background-color: #ff3b30;
    }

    .spinner {
        border: 0.2em solid rgba(255, 255, 255, 0.2);
        border-top: 0.2em solid #fff;
    }

    footer {
        background-color: darkslategray;
        color: #ccc;
    }

    footer a {
        color: white
    }
}