* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

::-webkit-scrollbar {
    width: 0;
    height: 0;
}

:root {
    --text-color: #333;
    --text-secolor: #555;
    --bg-color: rgba(255, 255, 255, 0.72);
    --bg-secolor: rgba(255, 255, 255, 0.5);
    --transition: 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

:root.dark {
    --text-color: #ddd;
    --text-secolor: #bbb;
    --bg-color: rgba(10, 10, 20, 0.72);
    --bg-secolor: rgba(10, 10, 20, 0.5);
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 40px;
    background: var(--bg-color);
    position: relative;
    background-size: cover;
    background-position: center;
    transition: background-image 0.3s ease;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: -1;
    transition: background 0.5s ease;
    pointer-events: none;
}

/* 夜间模式：半透明黑色遮罩 */
:root.dark body::after {
    background: rgba(0, 0, 0, 0.5);
}

/* ===== 右上角控制按钮 ===== */
.control-buttons {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1;
    display: flex;
    gap: 10px;
}

.control-buttons button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--bg-secolor);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.control-buttons button:active {
    transform: scale(0.92);
    background: var(--bg-color)
}

.control-buttons svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color)
}

.search input::placeholder {
    color: #888;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    pointer-events: none;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 600px;
    max-height: calc(100% - 96px);
    background: var(--bg-color);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 32px 32px 0 0;
    z-index: 3;
    transition: transform var(--transition);
    padding: 20px 24px 40px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

.bottom-sheet.active {
    transform: translateX(-50%) translateY(0);
}

.bottom-sheet .handle {
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: #888;
    margin: 0 auto 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: var(--text-color);
}

.sheet-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.nav-row {
    display: flex;
    gap: 10px;
    flex-direction: row;
    align-items: center;
    margin-bottom: 12px;
}

.nav-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.nav-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: var(--bg-secolor);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    text-align: center;
    min-height: 64px;
}

.nav-tile:active {
    transform: scale(0.94);
    background: var(--bg-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-tile .tile-icon {
    font-size: 24px;
    line-height: 1.2;
    margin-bottom: 2px;
}

.nav-tile .tile-label {
    font-size: 12px;
    color: var(--text-secolor);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toggle {
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.1);
}

.music-wrapper {
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secolor);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.music-wrapper iframe {
    display: block;
    width: calc(100% + 20px);
    height: 100px;
    border: none;
    margin: -10px 0 0 -10px;
}

:root.dark .music-wrapper iframe {
    filter: invert(0.85) hue-rotate(180deg);
}

.sakana-widget-ctrl {
    display: none !important;
}

:root.dark .sakana-widget canvas {
    filter: brightness(0.9);
}

#sakana-widget {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: var(--bg-secolor);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    min-height: 80px;
    min-width: 80px;
}

#sakana-widget .sakana-widget {
    margin: 0 auto !important;
}

@media (max-width: 599px) {
    #sakana-widget {
        display: none !important;
    }
}

.card {
    background: var(--bg-secolor);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}

.input:focus {
    border-color: var(--text-color);
}

.input-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

.btn {
    margin: 4px 2px;
    padding: 8px 20px;
    border: none;
    border-radius: 12px;
    color: var(--text-color);
    background-color: var(--bg-color);
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    line-height: 1.5;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: scale(0.94);
    opacity: 0.8;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
    border-radius: 16px;
}

.btn svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    flex-shrink: 0;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--text-secolor);
    font-size: 12px;
    font-weight: 500;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-secolor);
    border-top-color: var(--text-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.output {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-color);
    white-space: pre-wrap;
    /* 保留换行和空格 */
    word-break: break-all;
    /* 长文本换行 */
    min-height: 60px;
    max-height: 300px;
    overflow-y: auto;
}

svg {
    fill: var(--text-color)
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}