/* Gluecksrad — site-specific styles */

/* Wider layout for wheel + editor side by side */
main {
    max-width: 1060px;
}

/* Language switcher */
.lang-switch {
    display: flex;
    justify-content: flex-end;
    gap: 0;
    margin-bottom: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    width: fit-content;
    margin-left: auto;
}
.lang-btn {
    padding: 0.25rem 0.625rem;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--color-surface);
    color: var(--color-muted);
    border: none;
    border-radius: 0;
    cursor: pointer;
    letter-spacing: 0.05em;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--color-border); }
.lang-btn.active { background: var(--color-primary); color: #fff; }
@media (prefers-color-scheme: dark) {
    .lang-btn.active { background: #4f46e5; }
}

/* Hero */
.hero {
    margin-bottom: 1.5rem;
    text-align: center;
}
.hero p {
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
}

/* Preset pills */
.preset-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.preset-bar label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
    flex-shrink: 0;
}
.preset-bar select {
    width: auto;
    min-width: 180px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Main layout: wheel + editor */
.tool-layout {
    display: grid;
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .tool-layout {
        grid-template-columns: 1fr 340px;
        align-items: start;
    }
}

/* Wheel area */
.wheel-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1 / 1;
}
.wheel-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}
.wheel-container canvas:hover {
    filter: brightness(1.02);
}

/* Spin button */
.spin-btn {
    padding: 0.875rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 100px;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-md);
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    min-width: 200px;
}
.spin-btn:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}
.spin-btn:active {
    transform: translateY(0) scale(0.98);
}
.spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Settings bar */
.settings-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.75rem 0;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.setting-item label {
    cursor: pointer;
    user-select: none;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.toggle-switch:checked {
    background: var(--color-primary);
}
.toggle-switch::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.toggle-switch:checked::before {
    transform: translateX(16px);
}

/* Icon buttons */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.icon-btn:hover {
    background: var(--color-border);
    border-color: var(--color-muted);
}
@media (prefers-color-scheme: dark) {
    .icon-btn { background: var(--color-surface); color: var(--color-text); }
    .icon-btn:hover { background: var(--color-border); }
}
.icon-btn.muted {
    opacity: 0.5;
}

/* Editor panel */
.editor-panel {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.editor-panel h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entry-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-radius: 100px;
}

.entries-textarea {
    width: 100%;
    min-height: 180px;
    padding: 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.entries-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.entries-textarea::placeholder {
    color: var(--color-muted);
    opacity: 0.6;
}

/* Quick add row */
.quick-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.quick-add input {
    flex: 1;
    min-width: 0;
}
.quick-add button {
    flex-shrink: 0;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
}

/* Editor actions */
.editor-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.editor-actions button {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover {
    background: var(--color-border);
}
@media (prefers-color-scheme: dark) {
    .btn-secondary { background: var(--color-surface); color: var(--color-text); }
    .btn-secondary:hover { background: var(--color-border); }
}

.btn-danger {
    background: var(--color-surface);
    color: #dc2626;
    border: 1px solid var(--color-border);
}
.btn-danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
}
@media (prefers-color-scheme: dark) {
    .btn-danger { color: #f87171; background: var(--color-surface); }
    .btn-danger:hover { background: #1c1917; border-color: #f87171; }
}

/* History section */
.history-section {
    margin-top: 0.75rem;
}
.history-section summary {
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--color-text);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-top: 1px solid var(--color-border);
}
.history-section summary::-webkit-details-marker { display: none; }
.history-section summary::after {
    content: "^";
    font-size: 0.75rem;
    color: var(--color-muted);
    transition: transform 0.2s;
    transform: rotate(180deg);
}
.history-section[open] summary::after {
    transform: rotate(0);
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    max-height: 240px;
    overflow-y: auto;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8125rem;
}
.history-item:last-child {
    border-bottom: none;
}
.history-num {
    color: var(--color-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
    min-width: 2rem;
}
.history-entry {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-time {
    color: var(--color-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}
.history-empty {
    color: var(--color-muted);
    font-size: 0.8125rem;
    padding: 0.5rem 0;
}
.history-actions {
    margin-top: 0.5rem;
}
.history-actions button {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
}

/* Result overlay */
.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.result-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.result-card {
    background: var(--color-surface-raised);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 420px;
    width: calc(100% - 2rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.result-overlay.visible .result-card {
    transform: scale(1);
}

.result-label {
    font-size: 0.875rem;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.result-winner {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    word-break: break-word;
}
.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}
.result-actions button {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    border-radius: var(--radius);
    min-width: 0;
}

/* Share section */
.share-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}
.share-section button {
    width: 100%;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--color-text);
    color: var(--color-bg);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 10002;
    pointer-events: none;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Fullscreen mode */
.is-fullscreen main {
    max-width: 100%;
    padding: 1rem;
}
.is-fullscreen .hero,
.is-fullscreen .preset-bar,
.is-fullscreen .editor-panel,
.is-fullscreen .content-section,
.is-fullscreen .site-footer,
.is-fullscreen footer,
.is-fullscreen .accordion,
.is-fullscreen .fb-btn {
    display: none !important;
}
.is-fullscreen .tool-layout {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 0 auto;
}
.is-fullscreen .wheel-container {
    max-width: 90vh;
}
.is-fullscreen .settings-bar {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    padding: 0.5rem 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 50;
}

/* Content sections */
.content-section {
    margin-top: 2.5rem;
}
.content-section h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}
.content-section p {
    font-size: 0.9375rem;
    line-height: 1.7;
}

/* Use case cards */
.usecase-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}
@media (min-width: 768px) {
    .usecase-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.usecase-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.usecase-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.usecase-card p {
    font-size: 0.85rem;
    margin-bottom: 0;
}

/* FAQ / accordion */
.accordion {
    margin-top: 2rem;
}
.accordion details {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.accordion summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
    content: "^";
    transition: transform 0.2s;
    font-size: 0.875rem;
    color: var(--color-muted);
    transform: rotate(180deg);
}
.accordion details[open] summary::after {
    transform: rotate(0);
}
.accordion .accordion-body {
    padding: 0 1.25rem 1.25rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-muted);
}

/* Related tools */
.related-tools {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}
@media (min-width: 768px) {
    .related-tools {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Mobile responsive */
@media (max-width: 767px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    .wheel-container {
        max-width: 340px;
    }
    .result-winner {
        font-size: 1.75rem;
    }
    .result-card {
        padding: 2rem 1.5rem;
    }
    .settings-bar {
        gap: 0.5rem;
    }
    .toast {
        bottom: 1rem;
        max-width: calc(100% - 2rem);
    }
}

@media (max-width: 480px) {
    .wheel-container {
        max-width: 280px;
    }
    .settings-bar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    .spin-btn { font-size: 1rem; padding: 0.75rem 2rem; }
    .editor-panel h2 { font-size: 1.0625rem; }
    .entries-textarea { font-size: 0.875rem; }
    .quick-add input { font-size: 16px; } /* prevent iOS zoom */
}

/* Touch targets: ensure all interactive elements ≥ 44px */
@media (pointer: coarse) {
    .spin-btn { min-height: 48px; }
    .icon-btn { min-width: 44px; min-height: 44px; }
    .preset-bar select { min-height: 44px; }
    #speed-select { min-height: 44px; }
}

/* Print styles */
@media print {
    .wheel-area,
    .settings-bar,
    .toast,
    .result-overlay,
    .site-footer,
    footer,
    .fb-btn,
    .share-section,
    .editor-actions,
    .quick-add,
    .history-section {
        display: none !important;
    }
    .editor-panel {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    body {
        background: #fff;
        color: #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    .result-card {
        transform: scale(1) !important;
    }
}
