* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

#watermark {
    position: fixed;
    top: 10px;
    left: 10px;
    color: rgba(255, 255, 255, 0);
    font-size: 10px;
    font-family: 'Courier New', monospace;
    z-index: 1000;
    pointer-events: auto;
    user-select: none;
    width: 20px;
    height: 20px;
    transition: color 0.3s ease;
    cursor: default;
    white-space: nowrap;
}

#watermark:hover {
    color: rgba(255, 255, 255, 0.7);
}

#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    text-align: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

#loading.hidden {
    opacity: 0;
    pointer-events: none;
}

#aphorism-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Settings UI */
#settings-toggle {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom));
    right: max(16px, env(safe-area-inset-right));
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 3000;
    font-size: 18px;
    line-height: 40px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#settings-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.95);
}

#settings-panel {
    position: fixed;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px);
    right: max(16px, env(safe-area-inset-right));
    width: 280px;
    max-width: calc(100% - 32px);
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    padding: 12px;
    z-index: 3000;
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#settings-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.settings-title {
    font-weight: bold;
}

#settings-close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

#settings-close:hover {
    background: rgba(0,0,0,0.06);
}

.settings-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.settings-row + .settings-row {
    border-top: 1px solid rgba(0,0,0,0.06);
}

.settings-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-input input[type="range"] {
    width: 140px;
    touch-action: none;
}

.settings-input .value {
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    text-align: right;
}

.settings-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

.linklike {
    background: transparent;
    border: none;
    color: #1e3c72;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
}

.linklike:hover {
    background: rgba(0,0,0,0.06);
}

/* Improve keyboard focus visibility */
#settings-toggle:focus-visible,
#settings-close:focus-visible,
#settings-reset:focus-visible,
.settings-input input[type="range"]:focus-visible {
    outline: 2px solid #2a5298;
    outline-offset: 2px;
    border-radius: 6px;
}

#settings-panel:focus {
    outline: none;
}

.aphorism {
    position: absolute;
    max-width: 300px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    color: #333;
    font-size: 16px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    pointer-events: auto;
    cursor: grab;
    backdrop-filter: blur(10px);
    user-select: none;
}

.aphorism.fade-in {
    opacity: 1;
    transform: scale(1);
}

.aphorism.fade-out {
    opacity: 0;
    transform: scale(0.8);
}

.aphorism:hover {
    opacity: 1 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.95);
    animation-play-state: paused;
}

.aphorism .author {
    margin-top: 10px;
    font-style: italic;
    font-size: 14px;
    color: #666;
}

@keyframes gentle-float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.aphorism.floating {
    animation: gentle-float 3s ease-in-out infinite;
}

.aphorism.dragging {
    cursor: grabbing;
    transition: none;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.95);
}