/* ============================================
   RNG.PL – Full Stylesheet
   ============================================ */

/* ---------- Light Theme (default) ---------- */
:root {
    --bg-color: #f4f6f9;
    --surface-color: #ffffff;
    --surface-alt: #f0f2f5;
    --text-primary: #1a1d23;
    --text-secondary: #6b7280;
    --border-color: #e0e3e8;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --accent-color: #3b82f6;
    --accent-light: rgba(59, 130, 246, 0.1);
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.04);
    --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.06);
    --ring-color: rgba(99, 102, 241, 0.35);
    --transition-speed: 0.25s;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ---------- Dark Theme ---------- */
[data-theme="dark"] {
    --bg-color: #0c0f1a;
    --surface-color: #161b2e;
    --surface-alt: #1c2236;
    --text-primary: #eef0f6;
    --text-secondary: #8890a4;
    --border-color: #2a3048;
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: rgba(129, 140, 248, 0.12);
    --accent-color: #60a5fa;
    --accent-light: rgba(96, 165, 250, 0.12);
    --success-color: #4ade80;
    --warning-color: #fbbf24;
    --danger-color: #f87171;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.4), 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.35);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
    --ring-color: rgba(129, 140, 248, 0.25);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- App Shell ---------- */
.app-container {
    width: 100%;
    max-width: 500px;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
    border: 1px solid var(--border-color);
}

/* ---------- Header ---------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--primary-color);
}

.theme-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.theme-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.lang-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-alt);
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    min-width: 0;
    padding: 12px 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-family: inherit;
}

.tab-btn svg {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: var(--primary-light);
}

.tab-btn:hover svg {
    opacity: 1;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active svg {
    opacity: 1;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 1px;
}

/* ---------- Tab Panes ---------- */
.tab-content-wrapper {
    padding: 24px 20px;
    position: relative;
}

.tab-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tab-pane.hidden {
    display: none;
}

.pane-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.seo-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

/* ---------- Display Area ---------- */
.display-area {
    width: 100%;
    min-height: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--surface-alt);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: inset var(--shadow-xs);
    position: relative;
    overflow: hidden;
    padding: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.big-result {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -2px;
    line-height: 1;
    text-align: center;
    word-break: break-all;
}

.multi-result {
    font-size: 1.8rem;
    letter-spacing: -1px;
}

/* ---------- Controls ---------- */
.controls {
    display: flex;
    gap: 12px;
    width: 100%;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-group label,
.input-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.hint {
    opacity: 0.6;
    font-weight: 400;
}

input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--surface-alt);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--ring-color);
}

textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--surface-alt);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--ring-color);
}

/* ---------- Checkboxes ---------- */
.checkbox-row,
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.pronounce-toggle {
    flex-basis: 100%;
    padding: 8px 12px;
    background-color: var(--primary-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 600;
    transition: border-color 0.2s, background-color 0.2s;
}

.pronounce-toggle:hover {
    border-color: var(--primary-color);
}

/* ---------- Action Buttons ---------- */
.action-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.action-btn:hover {
    opacity: 0.92;
    box-shadow: var(--shadow-md);
}

.action-btn:active {
    transform: scale(0.98);
}

.action-btn.secondary {
    background: none;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.action-btn.secondary:hover {
    background-color: var(--primary-light);
    opacity: 1;
}

.small-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-alt);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.small-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ---------- Dice Grid ---------- */
.dice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.dice-btn {
    padding: 10px 0;
    border: 1px solid var(--border-color);
    background-color: var(--surface-alt);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.dice-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.dice-btn.selected {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

/* Breakdown for dice rolls */
.result-breakdown {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    min-height: 20px;
    line-height: 1.6;
}

.dice-cube {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--surface-color), var(--surface-alt));
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, opacity 0.2s;
    user-select: none;
}
.dice-cube.dice-small { width: 44px; height: 44px; font-size: 1.15rem; }
.dice-cube.dice-tiny { width: 32px; height: 32px; font-size: 0.85rem; border-width: 1px; }

.dice-cube.rolling {
    animation: diceRoll 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(0.3); opacity: 0; }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

/* ---------- Coin Flip ---------- */
.coin-display {
    perspective: 600px;
    min-height: 140px;
}

.coin {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s;
    cursor: pointer;
}

.coin.flipping {
    animation: coinFlip 1s ease-in-out forwards;
}

.coin.flipping-tails {
    animation: coinFlipTails 1s ease-in-out forwards;
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    font-weight: 800;
    backface-visibility: hidden;
    border: 3px solid;
}

.coin-heads {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    border-color: #d97706;
    box-shadow: inset 0 2px 6px rgba(255,255,255,0.3), 0 4px 12px rgba(245,158,11,0.35);
}

.coin-tails {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #1e293b;
    border-color: #475569;
    transform: rotateX(180deg);
    box-shadow: inset 0 2px 6px rgba(255,255,255,0.2), 0 4px 12px rgba(100,116,139,0.35);
}

.coin.coin-small {
    width: 56px;
    height: 56px;
}
.coin.coin-small .coin-face {
    font-size: 1.3rem;
    border-width: 2px;
}

.coin.coin-tiny {
    width: 36px;
    height: 36px;
}
.coin.coin-tiny .coin-face {
    font-size: 0.95rem;
    border-width: 1px;
}

.coin-label-text {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    min-height: 28px;
}

@keyframes coinFlip {
    0%   { transform: rotateX(0deg); }
    100% { transform: rotateX(1800deg); }
}

@keyframes coinFlipTails {
    0%   { transform: rotateX(0deg); }
    100% { transform: rotateX(1980deg); }
}

/* ---------- Wheel of Fortune ---------- */
.wheel-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 18px;
}

#wheel-svg {
    width: 100%;
    max-width: 340px;
    display: block;
    border-radius: 50%;
    overflow: hidden;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

[data-theme="dark"] #wheel-svg {
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
}

.wheel-pointer {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 28px solid var(--danger-color);
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.wheel-result-text {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    min-height: 30px;
    padding: 4px 0;
}

.wheel-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wheel-entry-actions {
    display: flex;
    gap: 8px;
}

/* ---------- Password Generator ---------- */
.password-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    background-color: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.password-display code {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    word-break: break-all;
    color: var(--primary-color);
    font-weight: 600;
    line-height: 1.4;
}

.copy-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.copy-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.copy-btn.copied {
    border-color: var(--success-color);
    color: var(--success-color);
    background-color: rgba(34, 197, 94, 0.1);
}

.strength-bar-wrapper {
    height: 6px;
    border-radius: 3px;
    background-color: var(--surface-alt);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.4s ease, background-color 0.4s ease;
}

.strength-meter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background-color: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.strength-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.strength-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.strength-entropy {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.strength-crack-time {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.strength-assumptions {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.65;
    margin-top: -2px;
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--surface-alt);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238890a4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--ring-color);
}

.password-multi-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.password-multi-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background-color: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    animation: fadeSlideIn 0.25s ease forwards;
}

.password-multi-item code {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    word-break: break-all;
    color: var(--primary-color);
    font-weight: 600;
    line-height: 1.4;
}

.password-multi-item .copy-btn {
    padding: 5px;
}

.password-multi-item .copy-btn svg {
    width: 14px;
    height: 14px;
}

/* ---------- List Shuffler ---------- */
.list-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.list-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.list-btn-row .action-btn:first-child {
    grid-column: 1 / -1;
}

.list-output {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-output-group {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.list-output-group-title {
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.list-output-item {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.list-output-item:last-child {
    border-bottom: none;
}

.list-output-item.highlighted {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

/* ---------- History List ---------- */
.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 60px;
    overflow: hidden;
}

.history-chip {
    padding: 4px 10px;
    background-color: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.history-chip:first-child {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

/* ---------- Footer ---------- */
.app-footer {
    padding: 14px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background-color: var(--surface-alt);
}

.app-footer p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ---------- Animations ---------- */
@keyframes popIn {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.animate-pop {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes fadeSlideIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeSlideIn 0.3s ease forwards;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
    body {
        padding: 0;
        align-items: stretch;
    }

    .app-container {
        max-width: 100%;
        border-radius: 0;
        border: none;
        min-height: 100vh;
    }

    .tab-btn {
        padding: 10px 10px;
    }

    .tab-btn span {
        font-size: 0.7rem;
    }

    .big-result {
        font-size: 2.8rem;
    }
}
