/* ===== Global ===== */
:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --card-hover: #243047;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text-main: #e5e7eb;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    padding: 24px;
    margin: 0;
    max-width: 800px;
    margin-inline: auto;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== Typography ===== */
h1 {
    text-align: center;
    margin-bottom: 32px;
    font-weight: 800;
    font-size: 2.5rem;
    letter-spacing: -0.025em;
    background: linear-gradient(to bottom right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    /* Fallback if gradient fails or for simple color requirement: */
    color: #f1f5f9;
}

h2 {
    font-weight: 700;
    margin-top: 0;
    color: #f8fafc;
}

h3 {
    font-weight: 600;
    color: #f1f5f9;
}

/* ===== Form Elements ===== */
input,
select,
textarea {
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ===== Search ===== */
input#search {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    box-sizing: border-box;
    /* Ensure padding doesn't overflow width */
}

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

/* ===== Filter Section ===== */
#filter {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    align-items: center;
    justify-content: center;
}

#filter select,
#filter button {
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
}

#filter button {
    background: var(--card-bg);
    /* Default neutral for secondary actions */
}

/* Highlight primary actions if needed, or keep neutral */
#submitWordBtn {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

#filter button:hover,
#filter select:hover {
    border-color: var(--text-muted);
    background: var(--card-hover);
}

#submitWordBtn:hover {
    background: var(--primary-hover) !important;
}

/* ===== Card ===== */
.card {
    position: relative;
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 16px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.1);
    background: var(--card-hover);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.belongs-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 500;
}

/* ===== Tags ===== */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.2);
    /* Semi-transparent generic blue */
    color: #93c5fd;
    /* Lighter blue text */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.tag:hover {
    background: rgba(37, 99, 235, 0.4);
    border-color: rgba(37, 99, 235, 0.6);
}

/* Specific styling for classification buttons if they differ, reusing .tag style */

/* ===== Mark Button ===== */
.markBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    color: #f59e0b;
    /* Amber 500 */
    font-size: 1.5rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 0;
    line-height: 1;
}

.markBtn:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}

/* ===== Details Page ===== */
#detail,
#about {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#detail h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 12px;
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#pronounceBtn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
}

#pronounceBtn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.05);
}

#dUpdated {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: right;
}

/* ===== Buttons (General) ===== */
button {
    font-family: inherit;
}

#backBtn,
#aboutBackBtn {
    background: transparent;
    color: var(--text-muted);
    padding: 8px 0;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    border: none;
}

#backBtn:hover,
#aboutBackBtn:hover {
    color: var(--text-main);
    transform: translateX(-4px);
    background: transparent;
    /* Override generic hover */
}

/* Primary Action Buttons */
#reportBtn,
#submitReport,
#markDetailBtn,
#confirmSubmitWord {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

#reportBtn:hover,
#submitReport:hover,
#markDetailBtn:hover,
#confirmSubmitWord:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 10px rgba(37, 99, 235, 0.4);
}

#cancelReport,
#cancelSubmitWord {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
}

#cancelReport:hover,
#cancelSubmitWord:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* ===== Submit Form ===== */
#submitWordForm,
#reportForm {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    margin: 32px 0;
}

#submitWordForm h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    margin-top: 0;
}

#submitWordForm p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

#submitWordForm label {
    display: block;
    margin-bottom: 8px;
    margin-top: 20px;
    font-weight: 600;
    color: #cbd5e1;
    font-size: 0.95rem;
}

/* ===== About Page ===== */
.about-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.about-section h3 {
    font-size: 1.25rem;
    margin-top: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    margin-top: 60px;
    padding: 32px 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

#aboutLink {
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

#aboutLink:hover {
    text-decoration: underline;
    color: var(--text-main);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Restore scroll for html/body but keep it styled */
html {
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

/* ===== Contributors Tooltip ===== */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    border-radius: 50%;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.info-icon:hover {
    background: var(--border-color);
    color: var(--text-main);
    border-color: var(--text-main);
}

.info-tooltip {
    display: none;
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    /* position: absolute; removed to keep flow */
    /* z-index: 10; removed */
}