/* ========================================
   RESET & BASE STYLES
   ======================================== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: 'Lora', serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
    color: #f5f5f7;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body.about-page {
    background: #0a0a12;
}

body.runes-page {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
}

/* ========================================
   NAVIGATION
   ======================================== */
.nav-buttons {
    position: fixed; 
    top: 30px; 
    right: 30px;
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    z-index: 1000;
}

.nav-button {
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #d1d5db;
    border: 1px solid rgba(91, 155, 213, 0.25);
    border-radius: 14px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Lora', serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(91, 155, 213, 0.1);
    letter-spacing: 0.02em;
}

.nav-button:hover {
    background: rgba(30, 30, 45, 0.95);
    color: #5b9bd5;
    border-color: rgba(91, 155, 213, 0.6);
    transform: translateY(-2px) translateX(-2px);
    box-shadow: 0 8px 24px rgba(91, 155, 213, 0.3), 0 4px 12px rgba(0, 0, 0, 0.5);
}

.nav-button.active {
    color: #7bc9a6;
    border-color: rgba(123, 201, 166, 0.6);
    background: rgba(30, 30, 45, 0.95);
    box-shadow: 0 6px 20px rgba(123, 201, 166, 0.25), 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* ========================================
   CONTAINER & PAGE TRANSITIONS
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: transparent;
    padding: 50px 20px;
    position: relative;
    z-index: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.container.flipping { 
    opacity: 0; 
    transform: rotateY(90deg); 
}

.page { 
    display: none; 
}

.page.active { 
    display: block; 
    animation: pageEnter 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

@keyframes sparkle {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ========================================
   HEADER & BRANDING
   ======================================== */
.header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.logo {
    font-size: 3.5rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    font-family: 'Lora', serif;
    line-height: 1.2;
    color: #5b9bd5;
    text-shadow: 0 4px 20px rgba(91, 155, 213, 0.4);
}

.brand-line {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tagline {
    font-size: 3.2rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    font-family: 'Tangerine', cursive;
    color: #5b9bd5;
    display: flex;
    align-items: baseline;
    line-height: 1;
    text-shadow: 0 2px 15px rgba(91, 155, 213, 0.3);
}

.first-s {
    font-family: 'Italianno', cursive;
    font-size: 4.5rem;
    margin-right: 2px;
    position: relative;
    top: 2px;
}

.pellscr-part {
    font-size: 3.2rem;
    margin-right: 4px;
}

.y-letter {
    font-family: 'Mr De Haviland', cursive;
    font-size: 4.8rem;
    color: #7bc9a6;
    margin-right: 2px;
    position: relative;
    top: 4px;
}

.after-main-y {
    color: #7bc9a6;
    font-size: 3.2rem;
}

/* ========================================
   ABOUT PAGE
   ======================================== */
.about-content {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
    color: #e5e7eb;
    background: rgba(15, 15, 25, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 50px 60px;
    border-radius: 24px;
    border: 1px solid rgba(91, 155, 213, 0.2);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 6px 24px rgba(91, 155, 213, 0.1);
}

.about-content h2 {
    color: #5b9bd5;
    font-size: 1.6rem;
    margin-top: 35px;
    margin-bottom: 15px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.about-content h2:first-of-type {
    margin-top: 0;
}

.about-content p {
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.about-content em {
    color: #7bc9a6;
    font-style: italic;
    font-weight: 500;
}

/* ========================================
   RUNES PAGE - SPELL BUILDER
   ======================================== */
.runes-content {
    max-width: 1400px;
    margin: 0 auto;
}

.spell-builder {
    background: rgba(15, 15, 25, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(91, 155, 213, 0.3);
    padding: 24px 28px;
    margin-bottom: 36px;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(91, 155, 213, 0.15);
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.spell-builder:hover {
    border-color: rgba(91, 155, 213, 0.5);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(91, 155, 213, 0.25);
    transform: translateY(-2px);
}

.spell-builder-label {
    color: #7bc9a6;
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-shadow: 0 2px 8px rgba(123, 201, 166, 0.4);
}

.spell-builder-runes {
    color: #e5e7eb;
    font-size: 15px;
    font-weight: 400;
    min-height: 24px;
    display: flex;
    align-items: center;
}

.spell-builder-runes.empty { 
    color: #6b7280;
    font-style: italic;
}

.spell-builder-button {
    background: linear-gradient(135deg, #5b9bd5 0%, #7bc9a6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Lora', serif;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(91, 155, 213, 0.4), 0 2px 8px rgba(123, 201, 166, 0.2);
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.spell-builder-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.spell-builder-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 155, 213, 0.6), 0 3px 10px rgba(123, 201, 166, 0.4);
}

.spell-builder-button:hover::before {
    left: 100%;
}

.spell-builder-button:active {
    transform: translateY(0);
}

.spell-builder-clear {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.3));
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.25);
}

.spell-builder-clear:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.4));
    box-shadow: 0 5px 16px rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.6);
}

/* ========================================
   RUNES CONTROLS & FILTERS
   ======================================== */
.runes-controls {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.runes-filter {
    padding: 12px 24px;
    min-width: 160px;
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(91, 155, 213, 0.25);
    border-radius: 12px;
    color: #e5e7eb;
    font-size: 14px;
    font-family: 'Lora', serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.runes-filter:hover {
    border-color: rgba(91, 155, 213, 0.5);
    background: rgba(25, 25, 35, 0.95);
    box-shadow: 0 6px 18px rgba(91, 155, 213, 0.2);
    transform: translateY(-1px);
}

.runes-filter:focus {
    outline: none;
    border-color: rgba(91, 155, 213, 0.7);
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
}

/* ========================================
   RUNES TABLE
   ======================================== */
.runes-table-container {
    max-height: 60vh;
    overflow: auto;
    border-radius: 16px;
    border: 1px solid rgba(91, 155, 213, 0.3);
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 6px 24px rgba(91, 155, 213, 0.15);
    scrollbar-width: thin;
    scrollbar-color: rgba(91, 155, 213, 0.5) rgba(255, 255, 255, 0.05);
}

.runes-table-container::-webkit-scrollbar { width: 10px; }
.runes-table-container::-webkit-scrollbar-track { 
    background: rgba(255, 255, 255, 0.05); 
    border-radius: 10px; 
}
.runes-table-container::-webkit-scrollbar-thumb { 
    background: rgba(91, 155, 213, 0.5); 
    border-radius: 10px;
    border: 2px solid rgba(15, 15, 25, 0.85);
}
.runes-table-container::-webkit-scrollbar-thumb:hover { 
    background: rgba(91, 155, 213, 0.7); 
}

.runes-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: 'Lora', serif;
    font-size: 13px;
    color: #e5e7eb;
}

.runes-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(20, 20, 35, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.runes-table th {
    background: rgba(25, 25, 40, 0.98);
    color: #c7d2fe;
    font-weight: 700;
    padding: 16px 18px;
    text-align: left;
    border-bottom: 2px solid rgba(91, 155, 213, 0.4);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.runes-table th:hover {
    background: rgba(35, 35, 50, 0.98);
    color: #5b9bd5;
}

.runes-table th:first-child {
    border-top-left-radius: 16px;
}

.runes-table th:last-child {
    border-top-right-radius: 16px;
}

.runes-table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.runes-table tbody tr {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 15, 25, 0.5);
}

.runes-table tbody tr:hover {
    background: rgba(91, 155, 213, 0.18);
    transform: scale(1.008);
    box-shadow: 0 4px 16px rgba(91, 155, 213, 0.2);
}

.runes-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.025);
}

.runes-table tbody tr:nth-child(even):hover {
    background: rgba(91, 155, 213, 0.18);
}

.rune-name {
    color: #5b9bd5;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(91, 155, 213, 0.3);
}

.rune-type {
    color: #7bc9a6;
    font-style: italic;
    font-size: 12.5px;
    white-space: nowrap;
    font-weight: 600;
}

.rune-runic {
    font-family: 'Mr De Haviland', cursive;
    font-size: 17px;
    color: #9ca3af;
}

.rune-description {
    color: #9ca3af;
    font-size: 12.5px;
    line-height: 1.5;
    max-width: 400px;
}

.rune-tier {
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.25), rgba(123, 201, 166, 0.25));
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 11px;
    display: inline-block;
    color: #c7d2fe;
    font-weight: 700;
    border: 1px solid rgba(91, 155, 213, 0.4);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(91, 155, 213, 0.2);
}

/* ========================================
   FORM STYLES
   ======================================== */
.status {
    padding: 18px 28px;
    border-radius: 16px;
    margin-bottom: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid transparent;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.status.success {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.status.error {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.form-section { 
    margin-bottom: 40px; 
}

.form-group { 
    margin-bottom: 32px; 
}

label {
    display: block;
    margin-bottom: 14px;
    font-weight: 600;
    color: #e5e7eb;
    font-size: 0.98rem;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 2;
}

textarea, input {
    width: 100%;
    padding: 18px 22px;
    border: 1px solid rgba(91, 155, 213, 0.2);
    border-radius: 14px;
    font-size: 16px;
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #f5f5f7;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Lora', serif;
    position: relative;
    z-index: 2;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.7;
}

textarea:focus, input:focus {
    outline: none;
    border-color: rgba(91, 155, 213, 0.6);
    background: rgba(25, 25, 35, 0.95);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(91, 155, 213, 0.15);
    transform: translateY(-1px);
}

textarea::placeholder, input::placeholder {
    color: #6b7280;
    font-style: italic;
}

.inline-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.cast-btn {
    background: linear-gradient(135deg, #5b9bd5 0%, #5b9bd5 35%, #6fa8bd 50%, #7bc9a6 65%, #7bc9a6 100%);
    color: white;
    padding: 20px 40px;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    margin-top: 20px;
    position: relative;
    overflow: hidden;
    font-family: 'Lora', serif;
    box-shadow: 0 8px 32px rgba(91, 155, 213, 0.5), 0 4px 16px rgba(123, 201, 166, 0.4);
    letter-spacing: 0.03em;
}

.cast-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s;
}

.cast-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 56px rgba(91, 155, 213, 0.7), 0 8px 28px rgba(123, 201, 166, 0.6), 0 0 100px rgba(91, 155, 213, 0.4);
}

.cast-btn:hover::before { 
    left: 100%; 
}

.cast-btn:active { 
    transform: translateY(-1px); 
}

.loading {
    display: none;
    text-align: center;
    color: #86868b;
    font-style: italic;
    padding: 40px;
    font-size: 1.1rem;
}

.loading::after {
    content: '✨';
    animation: sparkle 1.5s ease-in-out infinite;
    margin-left: 10px;
}

/* ========================================
   RESULT TABLES
   ======================================== */
#result {
    position: relative;
    z-index: 10;
    width: 100%;
    margin-top: 30px;
}

.result-table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(91, 155, 213, 0.35);
    background: rgba(15, 15, 25, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(91, 155, 213, 0.15);
    padding: 0;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(91, 155, 213, 0.5) rgba(255, 255, 255, 0.05);
}

.result-table-wrapper::-webkit-scrollbar {
    height: 10px;
}

.result-table-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.result-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(91, 155, 213, 0.5);
    border-radius: 8px;
    border: 2px solid rgba(15, 15, 25, 0.75);
}

.result-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(91, 155, 213, 0.7);
}

/* Main Result Table */
.result table {
    width: 100%;
    min-width: 900px;
    table-layout: auto;
    border-collapse: collapse;
    border-spacing: 0;
    font-family: 'Lora', serif;
    background: transparent;
}

/* Compact cells */
.result table th,
.result table td {
    padding: 10px 14px;
    white-space: nowrap;
}

/* Table Headers - Sleek and compact */
.result table th {
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.28), rgba(123, 201, 166, 0.22));
    color: #d1d5db;
    font-weight: 600;
    text-align: center;
    border: 1px solid rgba(91, 155, 213, 0.25);
    font-size: 11.5px;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    vertical-align: middle;
    line-height: 1.3;
    text-transform: none;
}

/* First header rounded corner */
.result table thead tr:first-child th:first-child {
    border-top-left-radius: 14px;
}

/* Last header rounded corner */
.result table thead tr:first-child th:last-child {
    border-top-right-radius: 14px;
}

/* Table Body Cells */
.result table tbody td {
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
    color: #d1d5db;
    font-size: 12px;
}

/* Table Body Rows */
.result table tbody tr {
    background: rgba(20, 20, 35, 0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.result table tbody tr:hover {
    background: rgba(91, 155, 213, 0.15);
    transform: scale(1.001);
    box-shadow: 0 2px 8px rgba(91, 155, 213, 0.2);
}

.result table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.025);
}

.result table tbody tr:nth-child(even):hover {
    background: rgba(91, 155, 213, 0.15);
}

/* Last row rounded corners */
.result table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 14px;
}

.result table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 14px;
}

/* Hide any tbody th elements that shouldn't be there */
.result table tbody th {
    display: none;
}

/* Effect Number styling - First column */
.result table tbody td:first-child {
    color: #7bc9a6;
    font-weight: 700;
    font-size: 13px;
}

/* Runes column - allow wrapping for long spell chains */
.result table tbody td:nth-child(3) {
    color: #5b9bd5;
    font-weight: 600;
    text-align: left;
    padding-left: 16px;
    white-space: normal;
    max-width: 280px;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Number columns - better readability */
.result table tbody td:nth-child(2),
.result table tbody td:nth-child(4),
.result table tbody td:nth-child(5),
.result table tbody td:nth-child(6),
.result table tbody td:nth-child(7),
.result table tbody td:nth-child(9),
.result table tbody td:nth-child(10) {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* Fade in animation */
.result table {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ========================================
   RUNE SELECTION HIGHLIGHT
   Add this to your main.css file
   ======================================== */

.runes-table tbody tr.rune-selected {
    background: rgba(123, 201, 166, 0.15) !important;
    border-left: 3px solid rgba(123, 201, 166, 0.6);
}

.runes-table tbody tr.rune-selected:hover {
    background: rgba(123, 201, 166, 0.25) !important;
}

.runes-table tbody tr.rune-selected .rune-name {
    color: #7bc9a6;
    font-weight: 700;
}

/* Optional: Show selection count badge */
.runes-table tbody tr.rune-selected::after {
    content: "×" attr(data-selection-count);
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(123, 201, 166, 0.3);
    color: #7bc9a6;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.runes-table tbody tr {
    position: relative;
}
