açık kaynak olarak yaptım herşeyi tek sayfa içerikte mevcuttur.

<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Domain Avcısı</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
    <style>
        :root {
            --bg-primary: #0a0a0a;
            --bg-secondary: #111113;
            --bg-card: #18181b;
            --bg-elevated: #222226;
            --text-primary: #fafafa;
            --text-secondary: #a1a1aa;
            --text-muted: #71717a;
            --accent: #e4e4e7;
            --accent-warm: #f97316;
            --accent-amber: #fbbf24;
            --success: #22c55e;
            --border: #27272a;
            --border-light: #3f3f46;
        }

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

        body {
            font-family: 'Outfit', sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .game-container {
            width: 100%;
            max-width: 480px;
        }

        .screen {
            display: none;
            animation: fadeIn 0.4s ease;
        }

        .screen.active {
            display: block;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes slideUp {
            from { opacity: 0; transform: translateY(24px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20%, 60% { transform: translateX(-6px); }
            40%, 80% { transform: translateX(6px); }
        }

        @keyframes countUp {
            from { opacity: 0; transform: scale(0.8); }
            to { opacity: 1; transform: scale(1); }
        }

        @keyframes confettiFall {
            0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
            100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
        }

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

        @keyframes borderGlow {
            0%, 100% { border-color: var(--border); }
            50% { border-color: var(--accent); }
        }

        .confetti-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            overflow: hidden;
            z-index: 9999;
        }

        .confetti {
            position: absolute;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            animation: confettiFall 2.5s ease-out forwards;
        }

        /* Header */
        .header {
            margin-bottom: 32px;
        }

        .logo-mark {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            margin-bottom: 8px;
        }

        .logo-icon {
            width: 48px;
            height: 48px;
            opacity: 0.9;
        }

        .logo-text {
            font-size: 13px;
            font-weight: 600;
            letter-spacing: 0.2em;
            text-transform: uppercase;
            color: var(--text-muted);
        }

        h1 {
            font-family: 'Source Serif 4', serif;
            font-size: 32px;
            font-weight: 600;
            text-align: center;
            letter-spacing: -0.02em;
            margin-bottom: 4px;
        }

        .tagline {
            text-align: center;
            font-size: 14px;
            color: var(--text-secondary);
            letter-spacing: 0.01em;
        }

        /* Card */
        .card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 28px;
            margin-bottom: 16px;
        }

        /* Buttons */
        .btn {
            display: block;
            width: 100%;
            padding: 16px 24px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: var(--bg-elevated);
            color: var(--text-primary);
            font-family: 'Outfit', sans-serif;
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-bottom: 10px;
            text-align: center;
        }

        .btn:hover {
            background: var(--bg-secondary);
            border-color: var(--border-light);
            transform: translateY(-1px);
        }

        .btn-primary {
            background: var(--text-primary);
            color: var(--bg-primary);
            border-color: var(--text-primary);
        }

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

        .btn-small {
            padding: 12px 18px;
            font-size: 13px;
            width: auto;
            display: inline-block;
        }

        .btn-ghost {
            background: transparent;
            border-color: transparent;
        }

        .btn-ghost:hover {
            background: var(--bg-elevated);
            border-color: transparent;
        }

        /* Input */
        .input-group {
            margin-bottom: 20px;
        }

        .input-label {
            display: block;
            font-size: 12px;
            font-weight: 500;
            color: var(--text-secondary);
            margin-bottom: 8px;
            letter-spacing: 0.02em;
        }

        .input-field {
            width: 100%;
            padding: 14px 16px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: var(--bg-secondary);
            color: var(--text-primary);
            font-family: 'Outfit', sans-serif;
            font-size: 15px;
            transition: all 0.2s ease;
        }

        .input-field:focus {
            outline: none;
            border-color: var(--text-muted);
        }

        .input-field::placeholder {
            color: var(--text-muted);
        }

        /* Mode Selection */
        .mode-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 20px;
        }

        .mode-item {
            padding: 18px;
            border-radius: 12px;
            border: 1px solid var(--border);
            background: var(--bg-secondary);
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .mode-item:hover {
            border-color: var(--border-light);
            transform: translateX(4px);
        }

        .mode-item.disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .mode-item.disabled:hover {
            transform: none;
            border-color: var(--border);
        }

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

        .mode-title {
            font-weight: 600;
            font-size: 15px;
        }

        .mode-badge {
            font-size: 10px;
            font-weight: 600;
            padding: 3px 8px;
            border-radius: 6px;
            background: var(--bg-elevated);
            color: var(--text-muted);
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }

        .mode-badge.active {
            background: rgba(251, 191, 36, 0.15);
            color: var(--accent-amber);
        }

        .mode-badge.soon {
            background: rgba(34, 197, 94, 0.1);
            color: var(--success);
        }

        .mode-desc {
            font-size: 13px;
            color: var(--text-secondary);
            line-height: 1.4;
        }

        /* Stats */
        .stats-row {
            display: flex;
            justify-content: center;
            gap: 32px;
            margin-top: 24px;
            padding-top: 24px;
            border-top: 1px solid var(--border);
        }

        .stat-item {
            text-align: center;
        }

        .stat-value {
            font-size: 20px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            margin-bottom: 2px;
        }

        .stat-value.highlight {
            color: var(--accent-amber);
        }

        .stat-label {
            font-size: 11px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        /* Game Screen */
        .game-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
        }

        .round-badge {
            font-size: 12px;
            font-weight: 500;
            color: var(--text-muted);
        }

        .round-badge strong {
            color: var(--text-primary);
        }

        .score-badge {
            font-size: 12px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .score-badge svg {
            opacity: 0.6;
        }

        /* Timer */
        .timer-container {
            text-align: center;
            margin-bottom: 24px;
        }

        .timer {
            font-family: 'JetBrains Mono', monospace;
            font-size: 56px;
            font-weight: 500;
            color: var(--text-primary);
            line-height: 1;
            margin-bottom: 12px;
            transition: color 0.3s ease;
        }

        .timer.warning {
            color: var(--accent-amber);
        }

        .timer.danger {
            color: #ef4444;
            animation: shake 0.4s ease infinite;
        }

        .timer-bar {
            height: 3px;
            background: var(--border);
            border-radius: 2px;
            overflow: hidden;
        }

        .timer-bar-fill {
            height: 100%;
            background: var(--text-primary);
            border-radius: 2px;
            transition: width 1s linear, background 0.3s ease;
        }

        .timer.warning + .timer-bar .timer-bar-fill {
            background: var(--accent-amber);
        }

        .timer.danger + .timer-bar .timer-bar-fill {
            background: #ef4444;
        }

        /* Category */
        .category-card {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 24px;
            text-align: center;
        }

        .category-label {
            font-size: 10px;
            font-weight: 600;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 12px;
        }

        .category-text {
            font-family: 'Source Serif 4', serif;
            font-size: 18px;
            color: var(--text-primary);
            line-height: 1.4;
            margin-bottom: 12px;
        }

        .difficulty-badge {
            display: inline-block;
            font-size: 11px;
            font-weight: 500;
            padding: 4px 10px;
            border-radius: 6px;
        }

        .difficulty-badge.easy {
            background: rgba(34, 197, 94, 0.1);
            color: var(--success);
        }

        .difficulty-badge.medium {
            background: rgba(251, 191, 36, 0.1);
            color: var(--accent-amber);
        }

        .difficulty-badge.hard {
            background: rgba(239, 68, 68, 0.1);
            color: #ef4444;
        }

        /* Domain Input */
        .domain-input-wrapper {
            display: flex;
            align-items: center;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 3px;
            margin-bottom: 8px;
            transition: all 0.2s ease;
        }

        .domain-input-wrapper:focus-within {
            border-color: var(--text-muted);
        }

        .domain-prefix {
            padding: 12px;
            color: var(--text-muted);
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
        }

        .suggestions-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 36px;
            height: 36px;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .suggestions-btn:hover {
            background: var(--bg-card);
            color: var(--accent-amber);
            border-color: var(--accent-amber);
        }
        }

        .domain-input {
            flex: 1;
            padding: 12px;
            border: none;
            background: transparent;
            color: var(--text-primary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 16px;
        }

        .domain-input:focus {
            outline: none;
        }

        .suggestions-dropdown {
            position: relative;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            border-radius: 8px;
            margin-top: 8px;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.2s ease;
            z-index: 100;
        }

        .suggestions-dropdown.active {
            max-height: 200px;
            overflow-y: auto;
        }

        .suggestions-dropdown.active {
            display: block;
        }

        .suggestion-item {
            padding: 10px 12px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            color: var(--text-secondary);
            border-bottom: 1px solid var(--border);
        }

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

        .suggestion-item:hover {
            background: var(--bg-card);
            color: var(--text-primary);
        }

        .suggestion-item .suggestion-keyword {
            color: var(--accent-amber);
            font-weight: 500;
        }

        .suggestion-ext {
            color: var(--text-muted);
            font-size: 11px;
        }

        .live-feedback {
            display: flex;
            justify-content: space-between;
            font-size: 11px;
            margin-bottom: 16px;
        }

        .char-count {
            font-family: 'JetBrains Mono', monospace;
            color: var(--text-muted);
        }

        .char-count.good { color: var(--success); }
        .char-count.warning { color: var(--accent-amber); }
        .char-count.bad { color: #ef4444; }

        .feedback-text {
            color: var(--text-muted);
        }

        .extension-select {
            display: flex;
            gap: 6px;
            margin-bottom: 20px;
        }

        .ext-btn {
            flex: 1;
            padding: 10px 8px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--bg-secondary);
            color: var(--text-secondary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .ext-btn:hover {
            border-color: var(--border-light);
            color: var(--text-primary);
        }

        .ext-btn.selected {
            background: var(--text-primary);
            color: var(--bg-primary);
            border-color: var(--text-primary);
        }

        .hint-text {
            text-align: center;
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 16px;
        }

        .error-text {
            font-size: 12px;
            color: #ef4444;
            margin-top: 8px;
            text-align: center;
        }

        /* Speed Mode */
        .speed-info {
            background: rgba(251, 191, 36, 0.08);
            border: 1px solid rgba(251, 191, 36, 0.2);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 20px;
            text-align: center;
        }

        .speed-time {
            font-family: 'JetBrains Mono', monospace;
            font-size: 40px;
            font-weight: 600;
            color: var(--accent-amber);
            margin-bottom: 4px;
        }

        .speed-label {
            font-size: 11px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.1em;
        }

        .speed-stats {
            display: flex;
            justify-content: space-around;
            margin-top: 16px;
            padding-top: 16px;
            border-top: 1px solid rgba(251, 191, 36, 0.15);
        }

        .speed-stat-value {
            font-family: 'JetBrains Mono', monospace;
            font-size: 22px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .speed-stat-label {
            font-size: 10px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        /* Result Screen */
        .result-header {
            text-align: center;
            margin-bottom: 24px;
        }

        .result-title {
            font-size: 14px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--success);
            margin-bottom: 16px;
        }

        .result-domain {
            font-family: 'JetBrains Mono', monospace;
            font-size: 22px;
            color: var(--text-primary);
            padding: 16px;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 10px;
            margin-bottom: 24px;
        }

        .score-breakdown {
            margin-bottom: 24px;
        }

        .score-item {
            display: flex;
            justify-content: space-between;
            padding: 10px 0;
            border-bottom: 1px solid var(--border);
            font-size: 14px;
        }

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

        .score-label {
            color: var(--text-secondary);
        }

        .score-value {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 500;
        }

        .score-item.total {
            margin-top: 8px;
            padding-top: 16px;
            border-top: 1px solid var(--border-light);
            border-bottom: none;
            font-size: 16px;
        }

        .score-item.total .score-label,
        .score-item.total .score-value {
            color: var(--text-primary);
            font-weight: 600;
        }

        .result-comment {
            font-family: 'Source Serif 4', serif;
            font-style: italic;
            text-align: center;
            font-size: 15px;
            color: var(--text-secondary);
            padding: 16px;
            background: var(--bg-secondary);
            border-radius: 10px;
            margin-bottom: 24px;
            line-height: 1.5;
        }

        .total-score-display {
            text-align: center;
            font-size: 14px;
            color: var(--text-secondary);
            margin-bottom: 20px;
        }

        .total-score-display h3 {
            font-size: 18px;
            font-weight: 600;
            color: var(--accent-amber);
            margin-top: 4px;
        }

        /* End Screen */
        .end-title {
            text-align: center;
            margin-bottom: 24px;
        }

        .end-title h2 {
            font-family: 'Source Serif 4', serif;
            font-size: 28px;
            margin-bottom: 4px;
        }

        .end-title p {
            color: var(--text-secondary);
            font-size: 14px;
        }

        .trophy-icon {
            width: 80px;
            height: 80px;
            margin: 0 auto 24px;
            display: block;
        }

        .final-score-card {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 24px;
            text-align: center;
            margin-bottom: 24px;
        }

        .final-score-label {
            font-size: 11px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 8px;
        }

        .final-score-value {
            font-family: 'JetBrains Mono', monospace;
            font-size: 48px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .rank-display {
            text-align: center;
            margin-bottom: 24px;
        }

        .rank-label {
            font-size: 11px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 8px;
        }

        .rank-value {
            font-family: 'Source Serif 4', serif;
            font-size: 24px;
            font-weight: 600;
        }

        /* Tabs */
        .tabs {
            display: flex;
            gap: 6px;
            margin-bottom: 16px;
        }

        .tab {
            flex: 1;
            padding: 10px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--text-secondary);
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .tab.active {
            background: var(--bg-elevated);
            border-color: var(--border-light);
            color: var(--text-primary);
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        /* Rounds List */
        .rounds-list {
            margin-bottom: 16px;
        }

        .round-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            background: var(--bg-secondary);
            border-radius: 8px;
            margin-bottom: 6px;
            font-size: 13px;
        }

        .round-domain {
            font-family: 'JetBrains Mono', monospace;
            color: var(--text-primary);
        }

        .round-score {
            font-weight: 600;
            color: var(--success);
        }

        /* Leaderboard */
        .leaderboard-title {
            font-size: 11px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            text-align: center;
            margin-bottom: 12px;
        }

        .leaderboard-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            background: var(--bg-secondary);
            border-radius: 8px;
            margin-bottom: 6px;
        }

        .leaderboard-item.gold {
            background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.05));
            border: 1px solid rgba(251, 191, 36, 0.25);
        }

        .leaderboard-item.silver {
            background: linear-gradient(135deg, rgba(161, 161, 170, 0.15), rgba(161, 161, 170, 0.05));
            border: 1px solid rgba(161, 161, 170, 0.25);
        }

        .leaderboard-item.bronze {
            background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(205, 127, 50, 0.05));
            border: 1px solid rgba(205, 127, 50, 0.25);
        }

        .leaderboard-rank {
            font-weight: 600;
            width: 28px;
        }

        .leaderboard-item.gold .leaderboard-rank { color: var(--accent-amber); }
        .leaderboard-item.silver .leaderboard-rank { color: var(--text-secondary); }
        .leaderboard-item.bronze .leaderboard-rank { color: #cd7f52; }

        .leaderboard-name {
            flex: 1;
            font-size: 13px;
        }

        .leaderboard-score {
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            font-weight: 500;
        }

        /* Achievements */
        .achievements-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }

        .achievement {
            padding: 16px 8px;
            background: var(--bg-secondary);
            border-radius: 10px;
            text-align: center;
            position: relative;
            opacity: 0.25;
            filter: grayscale(1);
            transition: all 0.3s ease;
        }

        .achievement.unlocked {
            opacity: 1;
            filter: grayscale(0);
        }

        .achievement-icon {
            width: 28px;
            height: 28px;
            margin: 0 auto 6px;
            opacity: 0.8;
        }

        .achievement.unlocked .achievement-icon {
            opacity: 1;
        }

        .achievement-title {
            font-size: 10px;
            color: var(--text-muted);
        }

        .achievement.unlocked .achievement-title {
            color: var(--text-secondary);
        }

        /* Share Buttons */
        .share-buttons {
            display: flex;
            gap: 10px;
            margin: 24px 0;
        }

        .share-buttons .btn {
            flex: 1;
            margin-bottom: 0;
        }

        /* Sound Toggle */
        .sound-toggle {
            position: fixed;
            top: 20px;
            right: 20px;
            width: 40px;
            height: 40px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: var(--bg-card);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            z-index: 1000;
        }

        .sound-toggle:hover {
            border-color: var(--border-light);
        }

        .sound-toggle svg {
            width: 18px;
            height: 18px;
            color: var(--text-secondary);
        }

        .sound-toggle.muted {
            opacity: 0.4;
        }

        /* Modal */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.85);
            justify-content: center;
            align-items: center;
            z-index: 1000;
            padding: 20px;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 28px;
            max-width: 380px;
            width: 100%;
            animation: slideUp 0.3s ease;
            position: relative;
        }

        .modal-close {
            position: absolute;
            top: 16px;
            right: 16px;
            width: 32px;
            height: 32px;
            border-radius: 8px;
            border: none;
            background: transparent;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-close svg {
            width: 18px;
            height: 18px;
            color: var(--text-muted);
        }

        .modal h2 {
            font-family: 'Source Serif 4', serif;
            font-size: 22px;
            margin-bottom: 20px;
        }

        .instruction-item {
            display: flex;
            align-items: flex-start;
            gap: 14px;
            margin-bottom: 16px;
        }

        .instruction-number {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background: var(--bg-elevated);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 600;
            flex-shrink: 0;
        }

        .instruction-text {
            font-size: 14px;
            color: var(--text-secondary);
            line-height: 1.5;
            padding-top: 4px;
        }

        .tips-card {
            background: var(--bg-secondary);
            border-radius: 10px;
            padding: 16px;
            margin-top: 20px;
        }

        .tips-title {
            font-size: 11px;
            font-weight: 600;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 12px;
        }

        .tips-list {
            font-size: 13px;
            color: var(--text-secondary);
            line-height: 1.8;
        }

        /* Time Up Overlay */
        .timeup-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.92);
            justify-content: center;
            align-items: center;
            z-index: 999;
        }

        .timeup-overlay.active {
            display: flex;
        }

        .timeup-content {
            text-align: center;
        }

        .timeup-text {
            font-size: 42px;
            font-weight: 700;
            color: #ef4444;
            animation: shake 0.5s ease infinite;
            margin-bottom: 8px;
        }

        .timeup-sub {
            font-size: 14px;
            color: var(--text-muted);
        }

        /* Icon SVG */
        .icon {
            display: inline-block;
            vertical-align: middle;
        }

        /* Responsive */
        @media (max-width: 480px) {
            .card { padding: 20px; }
            h1 { font-size: 26px; }
            .timer { font-size: 48px; }
            .category-text { font-size: 16px; }
            .achievements-grid { grid-template-columns: repeat(2, 1fr); }
        }
    </style>
</head>
<body>
    <!-- Sound Toggle -->
    <button class="sound-toggle" id="sound-toggle" onclick="toggleSound()">
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
            <path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
            <path d="M19.07 4.93a10 10 0 0 1 0 14.14"></path>
        </svg>
    </button>

    <div class="game-container">
        <!-- Screen: Mode Selection -->
        <div id="screen-mode" class="screen active">
            <div class="header">
                <div class="logo-mark">
                    <svg class="logo-icon" viewBox="0 0 48 48" fill="none">
                        <circle cx="24" cy="24" r="20" stroke="currentColor" stroke-width="2" opacity="0.3"/>
                        <circle cx="24" cy="24" r="12" stroke="currentColor" stroke-width="2" opacity="0.5"/>
                        <circle cx="24" cy="24" r="4" fill="currentColor"/>
                        <path d="M24 4v8M24 36v8M4 24h8M36 24h8" stroke="currentColor" stroke-width="2" opacity="0.4"/>
                    </svg>
                </div>
                <h1>Domain Avcısı</h1>
                <p class="tagline">Mükemmel domain adını bul</p>
            </div>

            <div class="card">
                <div class="mode-list">
                    <div class="mode-item" onclick="selectMode('classic')">
                        <div class="mode-header">
                            <span class="mode-title">Classic</span>
                            <span class="mode-badge active">Önerilen</span>
                        </div>
                        <p class="mode-desc">10 tur, her tur 30 saniye. Skorunu oluştur ve rütbe kazan.</p>
                    </div>
                    <div class="mode-item" onclick="selectMode('speed')">
                        <div class="mode-header">
                            <span class="mode-title">Speed</span>
                            <span class="mode-badge">60s</span>
                        </div>
                        <p class="mode-desc">Mümkün olduğunca fazla domain gir. Daha fazla deneme, daha fazla puan.</p>
                    </div>
                    <div class="mode-item disabled">
                        <div class="mode-header">
                            <span class="mode-title">Duel</span>
                            <span class="mode-badge soon">Çok Yakında</span>
                        </div>
                        <p class="mode-desc">Diğer oyuncularla yarış. Jüri oylamasıyla kazanan belirlenir.</p>
                    </div>
                </div>

                <button class="btn btn-ghost" onclick="showModal()">
                    <span style="display: flex; align-items: center; justify-content: center; gap: 8px;">
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                            <circle cx="12" cy="12" r="10"></circle>
                            <path d="M12 16v-4M12 8h.01"></path>
                        </svg>
                        Nasıl Oynanır
                    </span>
                </button>

                <div class="stats-row">
                    <div class="stat-item">
                        <div class="stat-value highlight" id="high-score-display">0</div>
                        <div class="stat-label">En Yüksek Skor</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value" id="total-plays-display">0</div>
                        <div class="stat-label">Oynanan Oyun</div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Screen: Name Input -->
        <div id="screen-name" class="screen">
            <div class="card">
                <h2 style="font-family: 'Source Serif 4', serif; font-size: 22px; margin-bottom: 20px;">Adınızı Girin</h2>
                <div class="input-group">
                    <label class="input-label">Adınız</label>
                    <input type="text" id="player-name-input" class="input-field" placeholder="Oyuncu adı" maxlength="20">
                </div>
                <button class="btn btn-primary" onclick="startGame()">
                    <span style="display: flex; align-items: center; justify-content: center; gap: 8px;">
                        Başla
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="none">
                            <path d="M5 12h14M12 5l7 7-7 7"/>
                        </svg>
                    </span>
                </button>
            </div>
        </div>

        <!-- Screen: Game -->
        <div id="screen-game" class="screen">
            <div class="card">
                <div class="game-header">
                    <div class="round-badge" id="round-badge">Tur <strong id="current-round">1</strong>/10</div>
                    <div class="score-badge">
                        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                            <path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6M18 9h1.5a2.5 2.5 0 0 0 0-5H18M6 9v10a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9M6 9h12"/>
                        </svg>
                        <span id="current-score">0</span>
                    </div>
                </div>

                <div class="timer-container" id="timer-container">
                    <div class="timer" id="timer">30</div>
                    <div class="timer-bar">
                        <div class="timer-bar-fill" id="timer-bar"></div>
                    </div>
                </div>

                <div class="category-card" id="category-card">
                    <div class="category-label">Kategori</div>
                    <div class="category-text" id="category-text"></div>
                    <div class="difficulty-badge" id="difficulty-badge"></div>
                </div>

                <div class="speed-info" id="speed-info" style="display: none;">
                    <div class="speed-label">Kalan Süre</div>
                    <div class="speed-time" id="speed-timer">60</div>
                    <div class="speed-stats" id="speed-stats">
                        <div>
                            <div class="speed-stat-value" id="speed-domains">0</div>
                            <div class="speed-stat-label">Domain</div>
                        </div>
                        <div>
                            <div class="speed-stat-value" id="speed-score">0</div>
                            <div class="speed-stat-label">Skor</div>
                        </div>
                        <div>
                            <div class="speed-stat-value" id="speed-avg">0</div>
                            <div class="speed-stat-label">Ortalama</div>
                        </div>
                    </div>
                </div>

                <div class="domain-input-wrapper" id="domain-wrapper">
                    <span class="domain-prefix">www.</span>
                    <input type="text" id="domain-input" class="domain-input" placeholder="domaininiz" maxlength="63" autocomplete="off">
                    <button type="button" class="suggestions-btn" onclick="toggleSuggestions()" title="Öneri ekle">
                        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                            <path d="M12 5v14M5 12h14"/>
                        </svg>
                    </button>
                </div>
                <div class="suggestions-dropdown" id="suggestions-dropdown"></div>
                <div class="live-feedback">
                    <span class="char-count" id="char-count">0/63</span>
                    <span class="feedback-text" id="char-feedback">Kısa ve akılda kalıcı domainler daha yüksek puan alır</span>
                </div>
                <div class="error-text" id="domain-error"></div>

                <div class="extension-select">
                    <button class="ext-btn selected" data-ext=".com">.com</button>
                    <button class="ext-btn" data-ext=".io">.io</button>
                    <button class="ext-btn" data-ext=".co">.co</button>
                    <button class="ext-btn" data-ext=".net">.net</button>
                    <button class="ext-btn" data-ext=".org">.org</button>
                </div>

                <button class="btn btn-primary" id="submit-btn" onclick="submitDomain()">Gönder</button>
                <p class="hint-text" id="game-hint">Daha kısa domainler daha yüksek puan alır</p>
            </div>
        </div>

        <!-- Screen: Result -->
        <div id="screen-result" class="screen">
            <div class="card">
                <div class="result-header">
                    <div class="result-title">Tur <span id="result-round">1</span> Tamamlandı</div>
                </div>
                <div class="result-domain" id="result-domain"></div>
                <div class="score-breakdown">
                    <div class="score-item">
                        <span class="score-label">Uzunluk</span>
                        <span class="score-value" id="score-length">0/25</span>
                    </div>
                    <div class="score-item">
                        <span class="score-label">Anahtar Kelime</span>
                        <span class="score-value" id="score-keyword">0/25</span>
                    </div>
                    <div class="score-item">
                        <span class="score-label">Okunabilirlik</span>
                        <span class="score-value" id="score-readability">0/20</span>
                    </div>
                    <div class="score-item">
                        <span class="score-label">Uzantı</span>
                        <span class="score-value" id="score-extension">0/10</span>
                    </div>
                    <div class="score-item">
                        <span class="score-label">Yaratıcılık</span>
                        <span class="score-value" id="score-creativity">0/10</span>
                    </div>
                    <div class="score-item">
                        <span class="score-label">Özel</span>
                        <span class="score-value" id="score-special">0/10</span>
                    </div>
                    <div class="score-item total">
                        <span class="score-label">Tur Skoru</span>
                        <span class="score-value" id="score-total">0/100</span>
                    </div>
                </div>
                <div class="result-comment" id="result-comment"></div>
                <div class="total-score-display">
                    Toplam Skor
                    <h3 id="total-score-display">0</h3>
                </div>
                <button class="btn btn-primary" id="next-round-btn" onclick="nextRound()">Sonraki Tur</button>
            </div>
        </div>

        <!-- Screen: End -->
        <div id="screen-end" class="screen">
            <div class="card">
                <div class="end-title">
                    <svg class="trophy-icon" viewBox="0 0 80 80" fill="none">
                        <path d="M20 15h40v10H20z" fill="currentColor" opacity="0.2"/>
                        <path d="M15 15h5v15c0 8 5 15 15 20v-10c-5-5-5-10-5-15V15z" fill="currentColor" opacity="0.6"/>
                        <path d="M65 15h-5v15c0 8-5 15-15 20v-10c5-5 5-10 5-15V15z" fill="currentColor" opacity="0.6"/>
                        <path d="M20 15c0-5 5-10 10-10s10 5 10 10H20z" fill="currentColor" opacity="0.4"/>
                        <path d="M40 45v15M30 55h20" stroke="currentColor" stroke-width="3" stroke-linecap="round"/>
                        <ellipse cx="40" cy="62" rx="15" ry="5" fill="currentColor" opacity="0.2"/>
                    </svg>
                    <h2>Oyun Bitti</h2>
                    <p>Oyuncu: <strong id="end-player-name"></strong></p>
                </div>

                <div class="final-score-card">
                    <div class="final-score-label">Final Skoru</div>
                    <div class="final-score-value" id="end-total-score">0</div>
                </div>

                <div class="rank-display">
                    <div class="rank-label">Rütben</div>
                    <div class="rank-value" id="end-rank"></div>
                </div>

                <div class="tabs">
                    <button class="tab active" onclick="switchTab('summary')">Özet</button>
                    <button class="tab" onclick="switchTab('achievements')">Başarımlar</button>
                </div>

                <div class="tab-content active" id="tab-summary">
                    <div class="rounds-list" id="rounds-summary-list"></div>
                </div>

                <div class="tab-content" id="tab-achievements">
                    <div class="achievements-grid" id="achievements-grid"></div>
                </div>

                <div class="share-buttons">
                    <button class="btn" onclick="restartGame()">Tekrar Oyna</button>
                    <button class="btn btn-primary" onclick="shareResult()">Paylaş</button>
                </div>

                <div class="leaderboard-title">Liderlik Tablosu</div>
                <div id="leaderboard-list"></div>
            </div>
        </div>

        <!-- Time Up Overlay -->
        <div class="timeup-overlay" id="timeup-overlay">
            <div class="timeup-content">
                <div class="timeup-text">Süre Doldu</div>
                <div class="timeup-sub">Sonraki tura hazırlan</div>
            </div>
        </div>

        <!-- Modal: Nasıl Oynanır -->
        <div class="modal-overlay" id="modal-howto">
            <div class="modal">
                <button class="modal-close" onclick="hideModal()">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                        <path d="M18 6L6 18M6 6l12 12"/>
                    </svg>
                </button>
                <h2>Nasıl Oynanır</h2>
                <div class="instruction-item">
                    <div class="instruction-number">1</div>
                    <div class="instruction-text">Bir kategori alacaksın</div>
                </div>
                <div class="instruction-item">
                    <div class="instruction-number">2</div>
                    <div class="instruction-text">Kategoriye uygun yaratıcı bir domain adı düşün</div>
                </div>
                <div class="instruction-item">
                    <div class="instruction-number">3</div>
                    <div class="instruction-text">Her tur 30 saniye (Klasik) veya 60 saniye (Speed)</div>
                </div>
                <div class="instruction-item">
                    <div class="instruction-number">4</div>
                    <div class="instruction-text">Uzunluk, anahtar kelime ve yaratıcılığa göre puan kazan</div>
                </div>
                <div class="instruction-item">
                    <div class="instruction-number">5</div>
                    <div class="instruction-text">Toplam skoruna göre rütbe kazan</div>
                </div>
                <div class="tips-card">
                    <div class="tips-title">İpuçları</div>
                    <div class="tips-list">
                        4-8 karakter optimal aralıktır<br>
                        İki kelime birleştir (örn: YemekHub)<br>
                        .com her zaman en yüksek bonusu verir<br>
                        Kategoriyle ilgili anahtar kelimeler kullan<br>
                        Rakam ve tire kullanmaktan kaçın
                    </div>
                </div>
                <button class="btn btn-primary" onclick="hideModal()" style="margin-top: 20px;">Anladım</button>
            </div>
        </div>
    </div>

    <div class="confetti-container" id="confetti-container"></div>

    <script>
        // Audio
        let audioContext = null;
        let soundEnabled = true;

        function initAudio() {
            if (!audioContext) {
                audioContext = new (window.AudioContext || window.webkitAudioContext)();
            }
        }

        function playSound(type) {
            if (!soundEnabled) return;
            initAudio();
            const osc = audioContext.createOscillator();
            const gain = audioContext.createGain();
            osc.connect(gain);
            gain.connect(audioContext.destination);

            switch(type) {
                case 'tick':
                    osc.frequency.value = 800;
                    gain.gain.value = 0.08;
                    osc.start();
                    osc.stop(audioContext.currentTime + 0.04);
                    break;
                case 'submit':
                    osc.frequency.value = 500;
                    gain.gain.value = 0.12;
                    osc.start();
                    setTimeout(() => osc.frequency.value = 700, 80);
                    osc.stop(audioContext.currentTime + 0.18);
                    break;
                case 'success':
                    osc.type = 'sine';
                    osc.frequency.value = 440;
                    gain.gain.value = 0.15;
                    osc.start();
                    setTimeout(() => osc.frequency.value = 554, 100);
                    setTimeout(() => osc.frequency.value = 659, 200);
                    setTimeout(() => osc.frequency.value = 880, 300);
                    osc.stop(audioContext.currentTime + 0.45);
                    break;
                case 'highscore':
                    osc.type = 'sine';
                    osc.frequency.value = 350;
                    gain.gain.value = 0.18;
                    osc.start();
                    setTimeout(() => osc.frequency.value = 440, 150);
                    setTimeout(() => osc.frequency.value = 550, 300);
                    setTimeout(() => osc.frequency.value = 700, 450);
                    osc.stop(audioContext.currentTime + 0.65);
                    break;
                case 'timeup':
                    osc.type = 'sawtooth';
                    osc.frequency.value = 180;
                    gain.gain.value = 0.12;
                    osc.start();
                    osc.stop(audioContext.currentTime + 0.4);
                    break;
                case 'lowscore':
                    osc.type = 'sine';
                    osc.frequency.value = 180;
                    gain.gain.value = 0.1;
                    osc.start();
                    setTimeout(() => osc.frequency.value = 130, 200);
                    osc.stop(audioContext.currentTime + 0.35);
                    break;
            }
        }

        function toggleSound() {
            soundEnabled = !soundEnabled;
            const btn = document.getElementById('sound-toggle');
            btn.classList.toggle('muted', !soundEnabled);
            localStorage.setItem('domainHunter_sound', soundEnabled);
        }

        // Categories
        const categories = [
            { id: 1, text: "Bir yemek tarifi sitesi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["yemek", "tarif", "mutfak", "lezzet", "food", "recipe", "cook", "chef", "kitchen", "gurme", "besin", "pisir", "firin", "ekmek", "salata", "corba", "anahtar", "yem"] },
            { id: 2, text: "Bir kripto haber sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["kripto", "coin", "bitcoin", "blockchain", "crypto", "trade", "bnb", "eth", "web3", "defi", "nft", "token", "maden", "dijital", "para", "borsa", "finans", "block"] },
            { id: 3, text: "Bir online ayakkabı mağazası için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["ayakkabi", "spor", "kundura", "footwear", "shoe", "boot", "sneaker", "run", "kosu", "yuruyus", "terlik", "calisma", "is", "kobi"] },
            { id: 4, text: "Bir kişisel blog için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["blog", "yazi", "gunluk", "not", "defter", "kisisel", "hayat", "deneyim", "dusunce", "paylas", "ozel", "pers", "view", "life"] },
            { id: 5, text: "Bir yapay zeka aracı için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["ai", "yapay", "zeka", "brain", "smart", "mind", "bot", "neural", "deep", "learn", "auto", "intel", "genius", "cognitive", "robot", "machine", "chat", "gpt", "model", "smart", "think"] },
            { id: 6, text: "Bir seyahat rehberi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["seyahat", "gezi", "yolcu", "tur", "travel", "trip", "go", "adventure", "kesif", "dunya", "ulke", "sehir", "map", "harita", "rota", "dest"] },
            { id: 7, text: "Bir fitness sitesi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["fitness", "spor", "gym", "egzersiz", "kas", "guc", "power", "fit", "saglik", "health", "vucut", "beden", "antreman", "yuzme", "kosu", "bisiklet", "run"] },
            { id: 8, text: "Bir e-kitap platformu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["ekitap", "ebook", "okuma", "kitap", "kutuphane", "yazar", "sayfa", "dijital", "coksatan", "roman", "hikaye", "edebiyat", "yayin", "oku", "read"] },
            { id: 9, text: "Bir müzik uygulaması için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["muzik", "sarki", "ses", "melodi", "note", "rhythm", "beat", "play", "dinle", "list", "calma", "sanatci", "album", "pop", "rock", "caz", "song"] },
            { id: 10, text: "Bir online eğitim platformu için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["egitim", "online", "kurs", "ogren", "learn", "study", "okul", "ders", "video", "akademi", "bilgi", "yetenek", "beceri", "sertifika", "skill"] },
            { id: 11, text: "Bir emlak sitesi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["emlak", "ev", "konut", "daire", "eviniz", "satilik", "kiralik", "muluk", "gayrimenkul", "property", "real", "estate", "home", "house", "apartman", "live"] },
            { id: 12, text: "Bir ikinci el araba sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["araba", "oto", "automobile", "vehicle", "car", "auto", "seri", "ikinciel", "sifir", "sahibinden", "satilik", "model", "marka", "motor", "drive"] },
            { id: 13, text: "Bir sosyal medya platformu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["sosyal", "medya", "social", "ag", "network", "baglanti", "arkadas", "paylas", "takip", "begeni", "yorum", "feed", "duvar", "hesap", "profil", "connect"] },
            { id: 14, text: "Bir hava durumu sitesi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["hava", "havadurumu", "weather", "forecast", "nem", "yagmur", "gunes", "ruzgar", "sicaklik", "derece", "iklim", "storm", "rain", "sun", "sky"] },
            { id: 15, text: "Bir oyun inceleme sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["oyun", "game", "inceleme", "review", "test", "play", "gaming", "ps4", "xbox", "pc", "steam", "nintendo", "kritik", "puan", "star", "score"] },
            { id: 16, text: "Bir teknoloji haber sitesi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["tech", "teknoloji", "haber", "news", "bilgi", "gadget", "cihaz", "yazilim", "donanim", "software", "hardware", "device", "digital", "latest"] },
            { id: 17, text: "Bir online çiçekçi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["cicek", "flower", "gul", "lale", "buket", "celenk", "sepet", "arrangement", "order", "siparis", "teslimat", "dogum", "nikah", "yildonumu", "bloom"] },
            { id: 18, text: "Bir freelancer platformu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["freelancer", "serbest", "is", "gig", "proje", "client", "musteri", "fatura", "odeme", "platform", "pazar", "hizmet", "beceri", "uzman", "work"] },
            { id: 19, text: "Bir podcast platformu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["podcast", "ses", "radyo", "bolum", "episode", "dinleyici", "listener", "subscribe", "kanal", "channel", "yayin", "broadcast", "audio", "talk", "voice"] },
            { id: 20, text: "Bir online eczane için domain bul", difficulty: "hard", difficultyBonus: 10, keywords: ["ecza", "eczane", "ilac", "drug", "medicine", "pharmacy", "saglik", "health", "hap", "merhem", "surup", "recete", "vitamin", "supplement", "pill"] },
            { id: 21, text: "Bir pet shop için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["evcil", "hayvan", "pet", "kopek", "kedi", "kus", "balik", "veteriner", "animal", "shop", "market", "bakim", "yem", "mama", "paw"] },
            { id: 22, text: "Bir iş sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["is", "kariyer", "job", "career", "ilan", "hire", "eleman", "pozisyon", "sirket", "company", "basvuru", "cv", "resume", "maas", "work"] },
            { id: 23, text: "Bir online terapi platformu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["terapi", "psychology", "psikoloji", "danisman", "therapy", "mental", "ruh", "saglik", "health", "dusunce", "duygu", "iyiles", "happiness", "mind"] },
            { id: 24, text: "Bir fotoğraf portfolyosu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["foto", "photography", "fotograf", "kamera", "camera", "photo", "lens", "portfolyo", "galeri", "gorsel", "sanat", "cekim", "moda", "shot"] },
            { id: 25, text: "Bir kahve sipariş uygulaması için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["kahve", "coffee", "cafe", "kaf", "espresso", "latte", "cappuccino", "order", "siparis", "teslimat", "kahvehane", "brew", "bean"] },
            { id: 26, text: "Bir araç kiralama sitesi için domain bul", difficulty: "medium",  difficultyBonus: 5, keywords: ["arac", "kiralik", "rental", "car", "rentals", "drive", "surus", "yolculuk", "soz", "roadtrip", "otobus", "transit", "taksi", "lease"] },
            { id: 27, text: "Bir online kuaför randevu sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["kuaför", "berber", "hair", "sac", "kesim", "boya", "tiras", "guzellik", "beauty", "salon", "appoint", "randevu", "rezervasyon", "cut"] },
            { id: 28, text: "Bir kitap özet sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["kitap", "özet", "summary", "book", "okuma", "anahtar", "onemli", "fikir", "notlar", "distill", "abstract", "concise", "read", "brief"] },
            { id: 29, text: "Bir diyet ve beslenme sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["diyet", "beslenme", "nutrition", "diet", "saglik", "kilo", "zayif", "yemek", "kalori", "besin", "vitamin", "protein", "organik", "fit"] },
            { id: 30, text: "Bir etkinlik bileti sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["bilet", "ticket", "etkinlik", "event", "konser", "festival", "sinema", "tiyatro", "show", "party", "organizasyon", "satis", "sale"] },
            { id: 31, text: "Bir online kurs pazar yeri için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["kurs", "course", "pazar", "marketplace", "ogrenci", "ogretmen", "mentor", "egitim", "platform", "bootcamp", "sertifika", "yetenek", "learn"] },
            { id: 32, text: "Bir vintage giyim mağazası için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["vintage", "retro", "kiyafet", "clothes", "tasarim", "moda", "collection", "elbise", "ayakkabi", "accessory", "import", "secondhand", "style"] },
            { id: 33, text: "Bir girişim haber sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["startup", "girisim", "haber", "news", "funding", "yatirim", "sermaye", "venture", "founders", "tech", "inovasyon", "scale", "build"] },
            { id: 34, text: "Bir online noter hizmeti için domain bul", difficulty: "hard", difficultyBonus: 10, keywords: ["noter", "notary", "ispat", "imza", "onay", "belge", "kurum", "hukuk", "yasal", "ebel", "document", "legal", "sign", "certify"] },
            { id: 35, text: "Bir oyuncak mağazası için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["oyuncak", "toy", "cocuk", "kids", "bebek", "game", "play", "eglence", "fun", "learning", "ogrenme", "activity", "gift", "kid"] },
            { id: 36, text: "Bir astroloji sitesi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["astroloji", "burc", "horoscope", "zodiac", "yildiz", "star", "fal", "iyi", "sans", "fortune", "cosmic", "cosmos", "universe", "sign"] },
            { id: 37, text: "Bir online market için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["market", "online", "alisveris", "shop", "grocery", "yiyecek", "icecek", "taze", "sebze", "meyve", "et", "sut", "urun", "buy"] },
            { id: 38, text: "Bir dil öğrenme uygulaması için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["dil", "language", "learn", "ogren", "kelime", "word", "grammar", "ingilizce", "almanca", "fransizca", "cince", "topluluk", "sozluk", "speak"] },
            { id: 39, text: "Bir sanat galerisi sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["sanat", "art", "galeri", "gallery", "ressam", "tablo", "painting", "sculpture", "heykel", "exhibit", "sergi", "koleksiyon", "display"] },
            { id: 40, text: "Bir sigorta karşılaştırma sitesi için domain bul", difficulty: "hard", difficultyBonus: 10, keywords: ["sigorta", "insurance", "karsilastir", "compare", "teklif", "quote", "fiyat", "price", "saglik", "arac", "konut", "hayat", "protect"] },
            { id: 41, text: "Bir tarif paylaşım topluluğu için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["tarif", "recipe", "paylasim", "community", "yemek", "food", "asci", "chef", "cook", "bake", "mutfak", "kitchen", "gurme", "share"] },
            { id: 42, text: "Bir online mobilya mağazası için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["mobilya", "furniture", "ev", "home", "oturma", "koltuk", "masa", "sandalye", "dolap", "ictasarim", "decoration", "modern", "furnish"] },
            { id: 43, text: "Bir günlük bülten için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["haber", "news", "bulten", "newsletter", "gunluk", "daily", "oku", "read", "abone", "subscribe", "broadcast", "edit", "yayin", "alert"] },
            { id: 44, text: "Bir video düzenleme aracı için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["video", "duzenle", "edit", "montaj", "cut", "trim", "effect", "filter", "color", "ses", "audio", "movie", "film", "clip"] },
            { id: 45, text: "Bir çevre blogu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["cevre", "environment", "surdurulebilirlik", "sustainability", "yesil", "green", "eko", "eco", "doga", "nature", "temiz", "enerji", "planet"] },
            { id: 46, text: "Bir online müzayede sitesi için domain bul", difficulty: "hard", difficultyBonus: 10, keywords: ["muzayede", "auction", "ihal", "bid", "teklif", "acikartirma", "satan", "satis", "zrm", "call", "offer", "winner", "bid"] },
            { id: 47, text: "Bir geliştirici topluluğu için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["yazilimci", "developer", "programci", "coder", "code", "github", "stack", "community", "topluluk", "forum", "acikkaynak", "dev"] },
            { id: 48, text: "Bir online davetiye tasarım sitesi için domain bul", difficulty: "easy", difficultyBonus: 0, keywords: ["davetiye", "invitation", "tasarim", "design", "card", "kart", "dugun", "party", "etkinlik", "template", "nisan", "invite"] },
            { id: 49, text: "Bir akıllı ev ürünleri sitesi için domain bul", difficulty: "medium", difficultyBonus: 5, keywords: ["akilli", "smart", "ev", "home", "iot", "device", "cihaz", "kontrol", "light", "isik", "termostat", "guvenlik", "otomasyon", "connect"] },
            { id: 50, text: "Bir online psikolog platformu için domain bul", difficulty: "hard", difficultyBonus: 10, keywords: ["psikolog", "psychologist", "terapist", "therapist", "mental", "ruh", "saglik", "therapy", "seans", "online", "gorusme", "danismanlik", "mind"] }
        ];

        // Comments
        const comments = {
            high: ["Bu domain milyonlar edebilir!", "GoDaddy kıskanır!", "Domain dehası mısın?", "Biri bunu kapacak!", "Namecheap'te müsait mi kontrol et!"],
            good: ["Oldukça iyi domain!", "Yatırıma değer!", "Hiç fena değil!", "Bunu üzerine startup kurulabilir!", "SEO dostu görünüyor!"],
            medium: ["İyi ama daha iyisini yapabilirsin", "Ortalama domain, daha da geliştir", "Biraz daha düşün", "Fena değil ama harika da değil"],
            low: ["Bu domaini kimse hatırlamayacak", "Daha yaratıcı ol!", "R10'da daha iyisini gördüm", "Domain avcılığı zor iştir, biliyorum"],
            veryLow: ["Buna reklamlar bile tıklamaz", "Klavyeyi rastgele mi karıştırdın?", "Google bunu indexlemeyecek", "Tekrar dene, herkesin kötü günleri var"]
        };

        // Ranks
        const ranks = [
            { min: 0, max: 100, title: "Domain Acemisi" },
            { min: 101, max: 200, title: "Domain Amatörü" },
            { min: 201, max: 350, title: "Domain Tutkunu" },
            { min: 351, max: 500, title: "Domain Taciri" },
            { min: 501, max: 650, title: "Domain Uzmanı" },
            { min: 651, max: 800, title: "Domain Baronu" },
            { min: 801, max: 900, title: "Domain Kralı" },
            { min: 901, max: 1000, title: "Domain Efsanesi" }
        ];

        // Extension points
        const extensionPoints = { ".com": 10, ".io": 8, ".co": 7, ".net": 5, ".org": 3 };

        // Achievements
        const achievements = [
            { id: "first_game", icon: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10 10S17.52 2 12 2z", title: "İlk Oyun", desc: "İlk oyununu tamamla" },
            { id: "perfect_round", icon: "M12 2l3.09 6.26L22 9.27l-5 4.57 1.18 6.88L12 17.77l-6.18 3.95L7 13.84 2 9.27l6.91-1.01L12 2z", title: "Mükemmeliyetçi", desc: "Tek bir turda 95+ puan al" },
            { id: "com_lover", icon: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10 10S17.52 2 12 2zM12 6v6l4 2", title: ".com Aşığı", desc: ".com uzantısını 10 kez seç" },
            { id: "shorty", icon: "M4 4h16v16H4zM8 8h8", title: "Kısa ve Tatlı", desc: "5 karakterden kısa domain gir" },
            { id: "marathon", icon: "M13 2L3 14h9l-1 8 10-12h-5l2-10z", title: "Maraton", desc: "10 oyun oyna" },
            { id: "legend", icon: "M12 2l3.09 6.26L22 9.27l-5 4.57 1.18 6.88L12 17.77l-6.18 3.95L7 13.84 2 9.27l6.91-1.01L12 2z", title: "Efsane", desc: "Toplam 900+ skor al" },
            { id: "speed_demon", icon: "M13 2L3 14h9l-1 8 10-12h-5l2-10z", title: "Hız Şeytanı", desc: "Speed modunda 20+ domain gir" },
            { id: "keyword_king", icon: "M21 21l-6-6m2-2a7 7 0 11-14 14 14 14", title: "Anahtar Kelime Kralı", desc: "Bir turda tam anahtar kelime skoru al" },
            { id: "creative", icon: "M9.663 15.663l-6.663 6.663M15.337 8.337C13.949 5.684 11.332 4 8 4S4 7.373 4 11s2.373 8 6 8c2.829 0 5.314-1.514 6.002-3.631M15 15l6 6", title: "Yaratıcı", desc: "5 kez yaratıcılık bonusu kazan" }
        ];

        // Game state
        let gameState = {
            playerName: "", currentRound: 1, totalRounds: 10, totalScore: 0,
            timeLeft: 30, rounds: [], selectedExtension: ".com", timerInterval: null,
            selectedCategories: [], gameMode: 'classic', speedTimeLeft: 60, speedDomains: 0,
            unlockedAchievements: [], extensionCount: { ".com": 0, ".io": 0, ".co": 0, ".net": 0, ".org": 0 }
        };

        document.addEventListener('DOMContentLoaded', () => {
            updateStats();
            loadSettings();
            setupEventListeners();
        });

        function loadSettings() {
            const lastName = localStorage.getItem('domainHunter_lastPlayer') || '';
            document.getElementById('player-name-input').value = lastName;
            soundEnabled = localStorage.getItem('domainHunter_sound') !== 'false';
            const btn = document.getElementById('sound-toggle');
            btn.classList.toggle('muted', !soundEnabled);
            const saved = localStorage.getItem('domainHunter_achievements');
            if (saved) gameState.unlockedAchievements = JSON.parse(saved);
        }

        function setupEventListeners() {
            document.querySelector('.extension-select').addEventListener('click', (e) => {
                if (e.target.classList.contains('ext-btn')) {
                    document.querySelectorAll('.ext-btn').forEach(btn => btn.classList.remove('selected'));
                    e.target.classList.add('selected');
                    gameState.selectedExtension = e.target.dataset.ext;
                }
            });
            document.getElementById('player-name-input').addEventListener('keypress', (e) => { if (e.key === 'Enter') startGame(); });
            document.getElementById('domain-input').addEventListener('keypress', (e) => { if (e.key === 'Enter') submitDomain(); });
            document.getElementById('domain-input').addEventListener('input', (e) => { updateLiveFeedback(e.target.value); if (e.target.value.length >= 2) showSuggestions(e.target.value); });
            document.addEventListener('click', (e) => {
                if (!e.target.closest('.domain-input-wrapper') && !e.target.closest('.suggestions-dropdown')) {
                    document.getElementById('suggestions-dropdown').classList.remove('active');
                }
            });
        }

        function showSuggestions(domain, showAll = false) {
            const dropdown = document.getElementById('suggestions-dropdown');
            const input = document.getElementById('domain-input');
            if (!showAll && (!domain || domain.length < 2)) { dropdown.classList.remove('active'); return; }
            const category = gameState.selectedCategories[gameState.currentRound - 1];
            if (!category) { dropdown.classList.remove('active'); return; }
            const keywords = category.keywords || [];
            const lowerDomain = domain.toLowerCase();
            let suggestions = [];
            keywords.forEach(kw => {
                if (kw.toLowerCase().startsWith(lowerDomain) && !suggestions.includes(kw)) {
                    suggestions.push(kw);
                }
            });
            if (suggestions.length === 0) {
                keywords.slice(0, 8).forEach(kw => {
                    if (!suggestions.includes(kw)) suggestions.push(kw);
                });
            }
            if (suggestions.length === 0) { dropdown.classList.remove('active'); return; }
            dropdown.innerHTML = suggestions.slice(0, 6).map(s => `
                <div class="suggestion-item" onclick="selectSuggestion('${s}')">
                    <span class="suggestion-keyword">${s}</span>
                    <span class="suggestion-ext">${gameState.selectedExtension}</span>
                </div>
            `).join('');
            dropdown.classList.add('active');
        }

        function selectSuggestion(keyword) {
            const input = document.getElementById('domain-input');
            const current = input.value;
            input.value = current + keyword;
            document.getElementById('suggestions-dropdown').classList.remove('active');
            updateLiveFeedback(input.value);
            input.focus();
        }

        function toggleSuggestions() {
            const dropdown = document.getElementById('suggestions-dropdown');
            dropdown.classList.toggle('active');
            if (dropdown.classList.contains('active')) {
                showSuggestions(document.getElementById('domain-input').value, true);
            }
        }

        function updateLiveFeedback(domain) {
            const charCount = document.getElementById('char-count');
            const feedback = document.getElementById('char-feedback');
            const len = domain.length;
            charCount.textContent = `${len}/63`;
            if (len === 0) { charCount.className = 'char-count'; feedback.textContent = 'Kısa ve akılda kalıcı domainler daha yüksek puan alır'; }
            else if (len <= 5) { charCount.className = 'char-count good'; feedback.textContent = 'Mükemmel uzunluk'; }
            else if (len <= 8) { charCount.className = 'char-count good'; feedback.textContent = 'Harika uzunluk'; }
            else if (len <= 12) { charCount.className = 'char-count warning'; feedback.textContent = 'İyi uzunluk'; }
            else if (len <= 16) { charCount.className = 'char-count warning'; feedback.textContent = 'Biraz uzun'; }
            else { charCount.className = 'char-count bad'; feedback.textContent = 'Çok uzun, puan kaybı'; }
        }

        function showScreen(screenId) {
            document.querySelectorAll('.screen').forEach(s => s.classList.remove('active'));
            document.getElementById(screenId).classList.add('active');
        }

        function showModal() { document.getElementById('modal-howto').classList.add('active'); }
        function hideModal() { document.querySelectorAll('.modal-overlay').forEach(m => m.classList.remove('active')); }

        function updateStats() {
            const highScores = JSON.parse(localStorage.getItem('domainHunter_highScores') || '[]');
            const totalPlays = parseInt(localStorage.getItem('domainHunter_totalGames') || '0');
            document.getElementById('high-score-display').textContent = highScores.length > 0 ? highScores[0].score : 0;
            document.getElementById('total-plays-display').textContent = totalPlays;
        }

        function selectMode(mode) {
            if (mode === 'duello') return;
            gameState.gameMode = mode;
            gameState.totalRounds = mode === 'classic' ? 10 : 999;
            gameState.timeLeft = mode === 'classic' ? 30 : 60;
            showScreen('screen-name');
        }

        function startGame() {
            const nameInput = document.getElementById('player-name-input');
            const playerName = nameInput.value.trim() || 'Anonymous';
            gameState = { ...gameState, playerName, currentRound: 1, totalScore: 0, rounds: [], selectedExtension: ".com", timerInterval: null, selectedCategories: shuffleArray([...categories]).slice(0, 10), speedTimeLeft: gameState.gameMode === 'speed' ? 60 : 30, speedDomains: 0, extensionCount: { ".com": 0, ".io": 0, ".co": 0, ".net": 0, ".org": 0 } };
            localStorage.setItem('domainHunter_lastPlayer', playerName);
            if (gameState.gameMode === 'speed') {
                document.getElementById('round-badge').style.display = 'none';
                document.getElementById('category-card').style.display = 'none';
                document.getElementById('speed-info').style.display = 'block';
                document.getElementById('speed-stats').style.display = 'flex';
                document.getElementById('game-hint').textContent = 'Daha fazla domain = daha fazla puan';
                document.getElementById('submit-btn').textContent = 'Sonraki Domain';
            } else {
                document.getElementById('round-badge').style.display = 'block';
                document.getElementById('category-card').style.display = 'block';
                document.getElementById('speed-info').style.display = 'none';
                document.getElementById('speed-stats').style.display = 'none';
                document.getElementById('game-hint').textContent = 'Daha kısa domainler daha yüksek puan alır';
                document.getElementById('submit-btn').textContent = 'Gönder';
            }
            showScreen('screen-game');
            showCategory();
        }

        function shuffleArray(array) { for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; } return array; }

        function showCategory() {
            const category = gameState.selectedCategories[gameState.currentRound - 1];
            document.getElementById('current-round').textContent = gameState.currentRound;
            document.getElementById('current-score').textContent = gameState.totalScore;
            document.getElementById('category-text').textContent = category.text;
            const badge = document.getElementById('difficulty-badge');
            badge.className = 'difficulty-badge ' + category.difficulty;
            const diffText = { easy: 'Kolay', medium: 'Orta', hard: 'Zor' };
            badge.textContent = diffText[category.difficulty] + (category.difficultyBonus > 0 ? ` (+${category.difficultyBonus})` : '');
            document.getElementById('domain-input').value = '';
            document.getElementById('domain-error').textContent = '';
            updateLiveFeedback('');
            document.querySelectorAll('.ext-btn').forEach(btn => { btn.classList.toggle('selected', btn.dataset.ext === '.com'); });
            gameState.selectedExtension = '.com';
            if (gameState.gameMode === 'classic') startTimer(30);
            else startSpeedTimer();
        }

        function startTimer(seconds) {
            gameState.timeLeft = seconds;
            updateTimerDisplay();
            if (gameState.timerInterval) clearInterval(gameState.timerInterval);
            gameState.timerInterval = setInterval(() => {
                if (gameState.timeLeft <= 5 && gameState.timeLeft > 0) playSound('tick');
                gameState.timeLeft--;
                updateTimerDisplay();
                if (gameState.timeLeft <= 0) { clearInterval(gameState.timerInterval); gameState.gameMode === 'classic' ? showTimeUp() : submitDomain(true); }
            }, 1000);
        }

        function startSpeedTimer() {
            gameState.speedTimeLeft = 60;
            updateSpeedTimerDisplay();
            if (gameState.timerInterval) clearInterval(gameState.timerInterval);
            gameState.timerInterval = setInterval(() => {
                gameState.speedTimeLeft--;
                updateSpeedTimerDisplay();
                if (gameState.speedTimeLeft <= 5) playSound('tick');
                if (gameState.speedTimeLeft <= 0) { clearInterval(gameState.timerInterval); endGame(); }
            }, 1000);
        }

        function updateTimerDisplay() {
            const timer = document.getElementById('timer');
            const timerBar = document.getElementById('timer-bar');
            timer.textContent = gameState.timeLeft;
            timerBar.style.width = (gameState.timeLeft / 30 * 100) + '%';
            timer.classList.remove('warning', 'danger');
            if (gameState.timeLeft <= 5) timer.classList.add('danger');
            else if (gameState.timeLeft <= 10) timer.classList.add('warning');
        }

        function updateSpeedTimerDisplay() { document.getElementById('speed-timer').textContent = gameState.speedTimeLeft; }

        function showTimeUp() {
            playSound('timeup');
            const overlay = document.getElementById('timeup-overlay');
            overlay.classList.add('active');
            setTimeout(() => { overlay.classList.remove('active'); submitDomain(true); }, 1800);
        }

        function submitDomain(timeUp = false) {
            clearInterval(gameState.timerInterval);
            const domainInput = document.getElementById('domain-input');
            const domain = domainInput.value.trim().toLowerCase().replace(/^www\./, '');
            const errorEl = document.getElementById('domain-error');
            if (!timeUp && domain && !validateDomain(domain, errorEl)) return;
            const extension = gameState.selectedExtension;
            const category = gameState.selectedCategories[gameState.currentRound - 1] || categories[0];
            const scores = calculateScore(domain, extension, category);
            gameState.rounds.push({ roundNumber: gameState.currentRound, category, playerDomain: domain || '(empty)', extension, scores: scores.scores, totalRoundScore: scores.total, comment: scores.comment });
            gameState.totalScore += scores.total;
            gameState.speedDomains++;
            gameState.extensionCount[extension]++;
            if (domain) {
                if (scores.total >= 80) playSound('success');
                else if (scores.total < 30) playSound('lowscore');
                else playSound('submit');
            }
            if (scores.total >= 85) createConfetti();
            checkAchievements(domain, scores, extension);
            if (gameState.gameMode === 'speed') {
                document.getElementById('speed-domains').textContent = gameState.speedDomains;
                document.getElementById('speed-score').textContent = gameState.totalScore;
                document.getElementById('speed-avg').textContent = Math.round(gameState.totalScore / gameState.speedDomains);
                gameState.selected = shuffleArray([...categories]);
                document.getElementById('category-text').textContent = gameState.selectedCategories[0].text;
                gameState.currentRound++;
                domainInput.value = '';
                document.getElementById('domain-error').textContent = '';
                updateLiveFeedback('');
                showQuickResult(domain + extension, scores);
                startSpeedTimer();
                domainInput.focus();
            } else { showResult(domain + extension, scores, category); }
        }

        function showQuickResult(domain, scores) {
            const btn = document.getElementById('submit-btn');
            const orig = btn.textContent;
            btn.textContent = `+${scores.total}`;
            btn.style.background = scores.total >= 70 ? '#22c55e' : '#f97316';
            setTimeout(() => { btn.textContent = orig; btn.style.background = ''; }, 800);
        }

        function validateDomain(domain, errorEl) {
            errorEl.textContent = '';
            if (!domain) { errorEl.textContent = 'Lütfen domain girin'; return false; }
            if (domain.length < 2) { errorEl.textContent = 'Domain en az 2 karakter olmalı'; return false; }
            if (domain.length > 63) { errorEl.textContent = 'Domain en fazla 63 karakter olmalı'; return false; }
            if (!/^[a-z0-9-]+$/.test(domain)) { errorEl.textContent = 'Sadece harf, rakam ve tire'; return false; }
            if (domain.startsWith('-') || domain.endsWith('-')) { errorEl.textContent = 'Tire ile başlayamaz veya bitemez'; return false; }
            if (/--/.test(domain)) { errorEl.textContent = 'Ardışık tire kullanılamaz'; return false; }
            return true;
        }

        function calculateScore(domain, extension, category) {
            const scores = { length: 0, keyword: 0, readability: 0, extension: 0, creativity: 0, special: 0 };
            if (!domain) return { scores, total: 0, comment: "No domain entered, wasted opportunity!" };
            if (domain.length <= 5) scores.length = 25;
            else if (domain.length <= 8) scores.length = 20;
            else if (domain.length <= 12) scores.length = 15;
            else if (domain.length <= 16) scores.length = 10;
            else if (domain.length <= 20) scores.length = 5;
            const domainLower = domain.toLowerCase();
            let exactMatches = 0, partialMatches = 0;
            category.keywords.forEach(kw => {
                const kwLower = kw.toLowerCase();
                if (['com', 'net', 'org', 'io', 'co'].includes(kwLower)) return;
                if (domainLower.includes(kwLower)) { if (kwLower.length >= 4) exactMatches++; else partialMatches++; }
            });
            if (exactMatches >= 2) scores.keyword = 25;
            else if (exactMatches >= 1) scores.keyword = 20;
            else if (partialMatches >= 2) scores.keyword = 18;
            else if (partialMatches >= 1) scores.keyword = 12;
            else scores.keyword = 5;
            if (/^[a-z]+$/.test(domain)) scores.readability += 10;
            if (!domain.includes('-')) scores.readability += 5;
            if (!/[0-9]/.test(domain)) scores.readability += 5;
            scores.extension = extensionPoints[extension] || 0;
            const wordPatterns = detectCompoundWords(domain);
            if (wordPatterns.length >= 2 || domain.match(/[a-z][A-Z]|[A-Z][a-z]/)) scores.creativity = 10;
            else if (wordPatterns.length >= 1) scores.creativity = 5;
            const wordCount = domain.split(/[A-Z]|-/).filter(w => w.length > 0).length;
            if (wordCount === 1 && !domain.includes('-')) scores.special += 5;
            if (domain === domain.toLowerCase()) scores.special += 3;
            const reversed = domain.split('').reverse().join('');
            if (domain === reversed && domain.length > 2) scores.special += 10;
            if (domain.length <= 4) scores.special += 2;
            const difficultyBonus = category.difficultyBonus || { easy: 0, medium: 5, hard: 10 }[category.difficulty] || 0;
            let total = scores.length + scores.keyword + scores.readability + scores.extension + scores.creativity + scores.special + difficultyBonus;
            let comment;
            if (total >= 90) comment = comments.high[Math.floor(Math.random() * comments.high.length)];
            else if (total >= 70) comment = comments.good[Math.floor(Math.random() * comments.good.length)];
            else if (total >= 50) comment = comments.medium[Math.floor(Math.random() * comments.medium.length)];
            else if (total >= 30) comment = comments.low[Math.floor(Math.random() * comments.low.length)];
            else comment = comments.veryLow[Math.floor(Math.random() * comments.veryLow.length)];
            return { scores, total: Math.min(total, 100), comment };
        }

        function detectCompoundWords(domain) {
            const fragments = ['hub', 'fy', 'ly', 'er', 'io', 'ly', 'fy', 'tech', 'web', 'net', 'soft', 'data', 'cloud', 'food', 'book', 'shop', 'cart', 'pay', 'live', 'smart', 'auto', 'fast', 'easy', 'pro', 'go'];
            const matches = [];
            fragments.forEach(f => { if (domain.toLowerCase().includes(f)) matches.push(f); });
            return matches;
        }

        function showResult(domain, scores, category) {
            document.getElementById('result-round').textContent = gameState.currentRound;
            document.getElementById('result-domain').textContent = domain;
            document.getElementById('score-length').textContent = `${scores.scores.length}/25`;
            document.getElementById('score-keyword').textContent = `${scores.scores.keyword}/25`;
            document.getElementById('score-readability').textContent = `${scores.scores.readability}/20`;
            document.getElementById('score-extension').textContent = `${scores.scores.extension}/10`;
            document.getElementById('score-creativity').textContent = `${scores.scores.creativity}/10`;
            document.getElementById('score-special').textContent = `${scores.scores.special}/10`;
            document.getElementById('score-total').textContent = `${scores.total}/100`;
            document.getElementById('result-comment').textContent = scores.comment;
            document.getElementById('total-score-display').textContent = gameState.totalScore;
            const nextBtn = document.getElementById('next-round-btn');
            nextBtn.textContent = gameState.currentRound >= gameState.totalRounds ? 'Sonuçları Gör' : 'Sonraki Tur';
            showScreen('screen-result');
        }

        function nextRound() {
            gameState.currentRound++;
            if (gameState.currentRound > gameState.totalRounds) endGame();
            else { showScreen('screen-game'); showCategory(); }
        }

        function checkAchievements(domain, scores, extension) {
            const stats = JSON.parse(localStorage.getItem('domainHunter_stats') || '{}');
            if (!stats.firstGame) { stats.firstGame = true; unlockAchievement('first_game'); }
            if (scores.total >= 95) unlockAchievement('perfect_round');
            if (extension === '.com') { stats.comCount = (stats.comCount || 0) + 1; if (stats.comCount >= 10) unlockAchievement('com_lover'); }
            if (domain && domain.length < 5) unlockAchievement('shorty');
            if (scores.scores.keyword >= 25) unlockAchievement('keyword_king');
            if (scores.scores.creativity >= 10) { stats.creativeCount = (stats.creativeCount || 0) + 1; if (stats.creativeCount >= 5) unlockAchievement('creative'); }
            stats.gamesPlayed = (stats.gamesPlayed || 0) + 1;
            if (stats.gamesPlayed >= 10) unlockAchievement('marathon');
            if (gameState.gameMode === 'speed' && gameState.speedDomains >= 20) unlockAchievement('speed_demon');
            if (gameState.totalScore >= 900) unlockAchievement('legend');
            localStorage.setItem('domainHunter_stats', JSON.stringify(stats));
        }

        function unlockAchievement(id) {
            if (gameState.unlockedAchievements.includes(id)) return;
            gameState.unlockedAchievements.push(id);
            localStorage.setItem('domainHunter_achievements', JSON.stringify(gameState.unlockedAchievements));
        }

        function createConfetti() {
            const container = document.getElementById('confetti-container');
            const colors = ['#e4e4e7', '#f97316', '#fbbf24', '#22c55e', '#ef4444'];
            for (let i = 0; i < 40; i++) {
                const confetti = document.createElement('div');
                confetti.className = 'confetti';
                confetti.style.left = Math.random() * 100 + '%';
                confetti.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
                confetti.style.animationDelay = Math.random() * 0.5 + 's';
                confetti.style.animationDuration = (2 + Math.random() * 1.5) + 's';
                container.appendChild(confetti);
                setTimeout(() => confetti.remove(), 3500);
            }
        }

        function endGame() {
            const highScores = JSON.parse(localStorage.getItem('domainHunter_highScores') || '[]');
            const totalGames = parseInt(localStorage.getItem('domainHunter_totalGames') || '0');
            const isNewHighScore = highScores.length < 10 || gameState.totalScore > highScores[highScores.length - 1].score;
            highScores.push({ name: gameState.playerName, score: gameState.totalScore, date: new Date().toISOString().split('T')[0], mode: gameState.gameMode });
            highScores.sort((a, b) => b.score - a.score);
            const topScores = highScores.slice(0, 10);
            localStorage.setItem('domainHunter_highScores', JSON.stringify(topScores));
            localStorage.setItem('domainHunter_totalGames', (totalGames + 1).toString());
            const rank = ranks.find(r => gameState.totalScore >= r.min && gameState.totalScore <= r.max) || ranks[ranks.length - 1];
            if (isNewHighScore && gameState.totalScore >= 500) { playSound('highscore'); createConfetti(); createConfetti(); }
            document.getElementById('end-player-name').textContent = gameState.playerName;
            document.getElementById('end-total-score').textContent = gameState.totalScore;
            document.getElementById('end-rank').textContent = rank.title;
            if (gameState.gameMode === 'classic') {
                document.getElementById('rounds-summary-list').innerHTML = gameState.rounds.map(r => `<div class="round-item"><span class="round-domain">${r.roundNumber}. ${r.playerDomain}${r.extension}</span><span class="round-score">${r.totalRoundScore} puan</span></div>`).join('');
            } else {
                document.getElementById('rounds-summary-list').innerHTML = `<div class="round-item"><span class="round-domain">Speed Modu - ${gameState.speedDomains} domain</span><span class="round-score">${gameState.totalScore} puan</span></div>`;
            }
            const achievementsGrid = document.getElementById('achievements-grid');
            achievementsGrid.innerHTML = achievements.map(a => `<div class="achievement ${gameState.unlockedAchievements.includes(a.id) ? 'unlocked' : ''}"><svg class="achievement-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="${a.icon}"/></svg><div class="achievement-title">${a.title}</div></div>`).join('');
            const leaderboardList = document.getElementById('leaderboard-list');
            leaderboardList.innerHTML = topScores.map((s, i) => { let medalClass = ''; if (i === 0) medalClass = 'gold'; else if (i === 1) medalClass = 'silver'; else if (i === 2) medalClass = 'bronze'; return `<div class="leaderboard-item ${medalClass}"><span class="leaderboard-rank">${i + 1}.</span><span class="leaderboard-name">${s.name}</span><span class="leaderboard-score">${s.score} puan</span></div>`; }).join('');
            showScreen('screen-end');
        }

        function switchTab(tab) {
            document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
            document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
            document.querySelector(`.tab[onclick="switchTab('${tab}')"]`).classList.add('active');
            document.getElementById(`tab-${tab}`).classList.add('active');
        }

        function restartGame() { showScreen('screen-mode'); }

        function shareResult() {
            const rank = ranks.find(r => gameState.totalScore >= r.min && gameState.totalScore <= r.max) || ranks[ranks.length - 1];
            const text = `Domain Avcısı\n\nSkor: ${gameState.totalScore}/1000\nRütbe: ${rank.title}\n\n#DomainAvcısı`;
            if (navigator.clipboard) { navigator.clipboard.writeText(text).then(() => { alert('Panoya kopyalandı!'); }); }
        }
    </script>
</body>
</html>