:root {
    --bg: #f4f6fb;
    --bg-alt: #ffffff;
    --primary: #fb923c;
    --primary2: #f97316;
    --accent: #facc15;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-soft: #e5e7eb;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
    --radius-lg: 22px;
    --radius-sm: 999px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background: radial-gradient(circle at 0% 0%, #fee2e2, #eff6ff 35%, #f4f6fb);
    color: var(--text-main);
}

/* Page layout */

.page {
    max-width: 1160px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 2.5rem;
}

/* Header inside iframe */

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.tool-header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: radial-gradient(circle at 30% 20%, #ffbe3d, #ff6b6b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

.tool-brand {
    font-weight: 700;
    font-size: 0.95rem;
}

.tool-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tool-header-right .chip-soft {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0f766e;
    font-size: 0.8rem;
}

/* Main tool layout */

.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.1fr);
    gap: 1.5rem;
}

/* Panels */

.panel {
    background: var(--bg-alt);
    border-radius: 26px;
    padding: 1.5rem 1.6rem 1.4rem;
    box-shadow: var(--shadow-soft);
}

.left-panel {
    position: relative;
}

.right-panel {
    display: flex;
    align-items: stretch;
}

/* Left panel content */

.panel-title {
    margin: 0 0 0.3rem;
    font-size: 1.4rem;
}

.panel-subtitle {
    margin: 0 0 0.9rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.example-box {
    background: #f9fafb;
    border-radius: 16px;
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e5e7eb;
}

.example-label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.example-names {
    color: var(--text-muted);
}

textarea#namesInput {
    width: 100%;
    margin-top: 0.25rem;
    border-radius: 14px;
    padding: 0.7rem 0.75rem;
    border: 1px solid var(--border-soft);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 180px;
}

textarea#namesInput:focus {
    outline: none;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 1px #a5b4fc33;
}

.tip {
    margin: 0.45rem 0 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Buttons */

button {
    font-family: inherit;
}

.btn-secondary {
    border: none;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    background: #eff6ff;
    color: #1d4ed8;
}

.btn-secondary:hover {
    background: #dbeafe;
}

.btn-ghost {
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    cursor: pointer;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: var(--text-main);
}

.btn-ghost:hover {
    background: #f3f4f6;
}

/* Right panel / wheel */

.wheel-card {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.wheel-header p {
    margin-top: 0.45rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.wheel-chip {
    display: inline-block;
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    background: #e0fbff;
    font-size: 0.78rem;
    color: #0891b2;
    font-weight: 500;
}

.wheel-wrapper {
    position: relative;
    margin: 1.1rem auto 0.9rem;
    width: 320px;
    height: 320px;
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    display: block;
    margin: 0 auto;
    border-radius: 50%;
    background: #f9fafb;
}

.wheel-pointer {
    position: absolute;
    top: 50%;
    right: -16px;
    transform: translateY(-50%) rotate(90deg);
    width: 0;
    height: 0;

    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 22px solid #3b82f6; /* arrow pointing right */
    
    filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.3));
    z-index: 2;
}


.wheel-actions {
    text-align: center;
    margin-top: 0.4rem;
}

.spin-btn {
    border: none;
    padding: 0.55rem 1.6rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary2), var(--accent));
    color: #ffffff;
    box-shadow: 0 12px 25px rgba(248, 113, 113, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.spin-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 6px 15px rgba(248, 113, 113, 0.35);
}

.spin-btn:disabled {
    opacity: 0.65;
    cursor: default;
}

.spin-status {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.spin-history {
    margin-top: 0.9rem;
    font-size: 0.9rem;
}

#selectedName {
    margin-left: 0.35rem;
    font-weight: 600;
    color: #0f766e;
}

/* Responsive */

@media (max-width: 900px) {
    .tool-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .wheel-wrapper {
        width: 280px;
        height: 280px;
    }
}

@media (max-width: 600px) {
    .page {
        padding-inline: 1rem;
    }

    .panel {
        padding-inline: 1.1rem;
    }

    .tool-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-row button {
        width: 100%;
        justify-content: center;
    }
}
