:root {
    --primary-color: rgba(255, 255, 255, 0.9);
    --secondary-color: rgba(200, 200, 200, 0.9);
    --background-color: linear-gradient(135deg, #0d0d12 0%, #1a1a24 50%, #0d0d12 100%);
    --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    --glass-blur: blur(35px);
    --panel-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    --text-color: rgba(255, 255, 255, 0.95);
    --text-light: rgba(255, 255, 255, 0.6);
    --success-color: rgba(86, 214, 138, 0.9);
    --highlight-color: #00c8f8;
    --cyan-color: #00c8f8;
    --magenta-color: #e3007b;
    --yellow-color: #ffea00;
    --black-color: #999999;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: padding-bottom 0.3s ease;
}

body.loading { overflow: hidden; }
body.tutorial-active { padding-bottom: 350px !important; }

#page-loader {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #121212; z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    padding: 0 24px; box-sizing: border-box; overflow: hidden;
}
#page-loader.fade-out { opacity: 0; visibility: hidden; }

#page-loader .loader-scaler {
    display: flex; justify-content: center; align-items: center;
    transform-origin: center; transition: transform 0.3s;
    max-width: 100%;
}

#page-loader .loader-container {
    display: flex; align-items: center; justify-content: center;
    flex-wrap: nowrap; opacity: 0; transform: scale(0.95);
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    will-change: transform, opacity;
}

#page-loader.is-loaded .loader-container {
    animation: smoothBootFade 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes smoothBootFade {
    0% { opacity: 0; transform: scale(0.95); }
    30% { opacity: 1; transform: scale(1); }
    100% { opacity: 1; transform: scale(1); }
}

.logo-container { display: flex; align-items: center; position: relative; gap: 12px; flex-shrink: 0; transform: translateZ(0); }

.bracket {
    width: 14px; height: 205px; border: 4px solid #666; border-radius: 6px;
    position: relative; z-index: 2; flex-shrink: 0;
    transition: height 0.7s ease-in-out, border-color 0.7s ease-in-out;
    transform: translateZ(0);
}
.bracket.left { border-right: none; border-top-right-radius: 0; border-bottom-right-radius: 0; transform: translateX(80px); }
.bracket.right { border-left: none; border-top-left-radius: 0; border-bottom-left-radius: 0; transform: translateX(-80px); }

.matrix {
    display: flex; justify-content: center; gap: 25px; padding: 0 15px;
    width: 195px; height: 205px; font-family: 'Montserrat', sans-serif;
    font-size: 32px; font-weight: 600; text-align: center;
    overflow: hidden; transition: height 0.7s ease-in-out;
    transform: translateZ(0);
}
.matrix-col { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.matrix-char {
    display: flex; align-items: center; justify-content: center; width: 30px; height: 40px; margin-bottom: 15px;
    transition: opacity 0.4s ease, color 0.3s ease, height 0.7s ease-in-out, margin 0.7s ease-in-out; overflow: hidden;
    transform: translateZ(0);
}
.matrix-col .matrix-char:last-child { margin-bottom: 0; }

#page-loader.is-loaded .bracket.left { animation: openLeft 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
#page-loader.is-loaded .bracket.right { animation: openRight 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

#page-loader.is-collapsed .bracket { height: 48px; border-color: #8a8a8a; }
#page-loader.is-collapsed .matrix { height: 48px; }
#page-loader.is-collapsed .matrix-char { margin-bottom: 0; }
#page-loader.is-collapsed .matrix-char:not(.target) { height: 0; opacity: 0; padding: 0; border: 0; margin: 0; }

@keyframes openLeft { 0% { transform: translateX(80px); opacity: 0; } 100% { transform: translateX(0) translateZ(0); opacity: 1; } }
@keyframes openRight { 0% { transform: translateX(-80px); opacity: 0; } 100% { transform: translateX(0) translateZ(0); opacity: 1; } }

.background-blur {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--background-color); z-index: -2;
}
.background-blur::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 10% 90%, rgba(0, 200, 248, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 10%, rgba(227, 0, 123, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255, 234, 0, 0.02) 0%, transparent 60%);
    z-index: -1;
}

.app-container {
    display: grid;
    max-width: 1700px; margin: 0 auto; gap: 24px;
    grid-template-columns: 360px 1fr 360px;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
        "header header header"
        "controls matrix axes"
        "seo seo seo"
        "footer footer footer";
}

header, .controls-panel, .matrix-panel, .axes-panel, .app-footer, .seo-content {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    box-shadow: var(--panel-shadow);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

header { grid-area: header; padding: 25px 35px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }

.header-left { display: flex; align-items: center; gap: 40px; flex-wrap: wrap; justify-content: center; }

.static-matrix {
    display: flex; justify-content: center; gap: 25px; padding: 0 15px;
    height: 48px; font-family: 'Montserrat', sans-serif;
    font-size: 32px; font-weight: 600; text-align: center;
    overflow: hidden; align-items: center;
}
.matrix-char-static { display: flex; align-items: center; justify-content: center; width: 30px; height: 40px; }
.static-bracket { width: 14px; height: 48px; border: 4px solid #8a8a8a; border-radius: 6px; position: relative; z-index: 2; flex-shrink: 0; }
.static-bracket.left { border-right: none; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.static-bracket.right { border-left: none; border-top-left-radius: 0; border-bottom-left-radius: 0; }

.header-title { display: flex; flex-direction: column; justify-content: center; height: 48px; font-family: 'Montserrat', sans-serif; padding-left: 0; }
.header-title span { line-height: 1.2; font-size: 13px; color: #fff; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; }
.header-title span.desc { margin-top: 2px; color: var(--text-light); }

.header-right { display: flex; align-items: center; justify-content: center; }

.controls-panel { grid-area: controls; padding: 35px; }
.matrix-panel { grid-area: matrix; padding: 35px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 500px; }
.axes-panel { grid-area: axes; padding: 35px; }
.app-footer { grid-area: footer; padding: 30px; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.seo-content { grid-area: seo; }

.section-title { font-size: 18px; margin-bottom: 30px; padding-bottom: 12px; font-weight: 500; position: relative; letter-spacing: 0.5px; }

.section-title::after {
    content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.2) 20%, rgba(255,255,255,0.2) 80%, rgba(255,255,255,0.05) 100%);
}

.num-btn, .matrix-options label, .color-preview-wide, .header-title {
    -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}

.control-group { margin-bottom: 30px; }

.color-control { display: flex; align-items: center; margin-bottom: 20px; gap: 18px; flex-wrap: nowrap; }
.color-control label { width: 22px; text-align: center; font-weight: 600; font-size: 15px; flex-shrink: 0; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }

.color-control input[type="range"] {
    flex: 1; height: 3px; border-radius: 10px; -webkit-appearance: none; appearance: none;
    background: rgba(255, 255, 255, 0.06); border: none; outline: none;
    min-width: 50px; cursor: pointer; position: relative;
}

.color-control input[type="range"]::-webkit-slider-runnable-track {
    height: 3px; border-radius: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}

.color-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: #fff; border: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.5);
    transition: transform 0.2s, box-shadow 0.2s; cursor: pointer;
    margin-top: -5.5px;
}
.color-control input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(255,255,255,0.15), 0 4px 16px rgba(0,0,0,0.6); }

.color-control input[type="range"]::-moz-range-track {
    height: 3px; border-radius: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    border: none;
}

.color-control input[type="range"]::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: #fff; border: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.5);
    transition: transform 0.2s, box-shadow 0.2s; cursor: pointer;
}
.color-control input[type="range"]::-moz-range-thumb:hover { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(255,255,255,0.15), 0 4px 16px rgba(0,0,0,0.6); }

#cSlider::-webkit-slider-thumb { background: var(--cyan-color); box-shadow: 0 0 0 3px rgba(0,200,248,0.15), 0 4px 12px rgba(0,0,0,0.5); }
#cSlider::-moz-range-thumb { background: var(--cyan-color); box-shadow: 0 0 0 3px rgba(0,200,248,0.15), 0 4px 12px rgba(0,0,0,0.5); }
#mSlider::-webkit-slider-thumb { background: var(--magenta-color); box-shadow: 0 0 0 3px rgba(227,0,123,0.15), 0 4px 12px rgba(0,0,0,0.5); }
#mSlider::-moz-range-thumb { background: var(--magenta-color); box-shadow: 0 0 0 3px rgba(227,0,123,0.15), 0 4px 12px rgba(0,0,0,0.5); }
#ySlider::-webkit-slider-thumb { background: var(--yellow-color); box-shadow: 0 0 0 3px rgba(255,234,0,0.15), 0 4px 12px rgba(0,0,0,0.5); }
#ySlider::-moz-range-thumb { background: var(--yellow-color); box-shadow: 0 0 0 3px rgba(255,234,0,0.15), 0 4px 12px rgba(0,0,0,0.5); }
#kSlider::-webkit-slider-thumb { background: var(--black-color); box-shadow: 0 0 0 3px rgba(153,153,153,0.15), 0 4px 12px rgba(0,0,0,0.5); }
#kSlider::-moz-range-thumb { background: var(--black-color); box-shadow: 0 0 0 3px rgba(153,153,153,0.15), 0 4px 12px rgba(0,0,0,0.5); }

.number-input-wrapper {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px; padding: 4px 4px; gap: 2px;
    flex-shrink: 0; min-width: 110px; backdrop-filter: blur(4px);
}
.number-input-wrapper input[type="number"] {
    background: transparent; border: none; color: white; text-align: center;
    width: 46px; font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 500;
    -moz-appearance: textfield; appearance: none; flex-shrink: 0; padding: 4px 2px;
    letter-spacing: 0.5px;
}
.number-input-wrapper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-input-wrapper input[type="number"]:focus { outline: none; }

.num-btn {
    background: transparent; border: none; color: rgba(255, 255, 255, 0.5);
    width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
    font-size: 18px; font-weight: 300; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
    line-height: 1; position: relative;
}
.num-btn:hover { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.9); }
.num-btn:active { transform: scale(0.92); background: rgba(255, 255, 255, 0.12); }

.color-preview-wide {
    width: 100%; height: 75px; border: none; border-radius: 14px;
    display: flex; justify-content: center; align-items: center; font-size: 16px; font-weight: 600;
    box-shadow: inset 0 2px 15px rgba(0,0,0,0.5), 0 0 30px rgba(0,0,0,0.2);
    transition: background-color 0.3s; text-align: center; padding: 0 10px; flex-direction: column;
    position: relative; overflow: hidden;
}
.color-preview-wide::before {
    content: ''; position: absolute; inset: 0;
    border-radius: 14px; pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.color-preview-wide span { position: relative; z-index: 1; text-shadow: 0 1px 4px rgba(0,0,0,0.3); }

.disclaimer-text { font-size: 10px; opacity: 0.6; margin-top: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

.matrix-size-control { margin-top: 30px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.matrix-size-control label { font-size: 15px; font-weight: 500; }

.axis-sub-title { margin-bottom: 20px; font-size: 15px; font-weight: 500; text-align: left; color: var(--text-color); opacity: 0.9; }

.axis-steps-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 12px; margin-bottom: 35px; }
.axis-steps-grid-2col:last-child { margin-bottom: 0; }
.axis-steps-grid-2col .color-control { margin-bottom: 0; gap: 8px; }
.axis-steps-grid-2col .number-input-wrapper { min-width: unset; width: 100%; max-width: 105px; margin-left: auto; padding: 4px; gap: 4px; }
.axis-steps-grid-2col .number-input-wrapper input[type="number"] { width: 32px; font-size: 14px; padding: 0; }
.axis-steps-grid-2col .num-btn { width: 26px; height: 26px; font-size: 16px; border-radius: 6px; }

.matrix-options { width: 100%; display: flex; justify-content: center; padding-top: 20px; margin-top: 15px; }

.toggle-switch {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    -webkit-user-select: none; user-select: none;
}
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.toggle-track {
    position: relative; width: 40px; height: 22px; flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08); border-radius: 11px;
    transition: background 0.25s cubic-bezier(0.2, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.toggle-thumb {
    position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
    background: rgba(255, 255, 255, 0.5); border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.2, 0, 0.2, 1), background 0.25s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .toggle-track { background: rgba(0, 200, 248, 0.3); border-color: rgba(0, 200, 248, 0.2); }
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); background: var(--highlight-color); box-shadow: 0 2px 8px rgba(0, 200, 248, 0.3); }
.toggle-switch:hover .toggle-track { background: rgba(255, 255, 255, 0.12); }
.toggle-switch input:checked:hover + .toggle-track { background: rgba(0, 200, 248, 0.4); }
.toggle-label { font-size: 14px; font-weight: 500; color: var(--text-light); letter-spacing: 0.3px; }

.matrix-wrapper { flex: 1; width: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; padding: 0; min-height: 0; box-sizing: border-box; border-radius: 12px; }

.matrix-layout { display: grid; grid-template-columns: 45px auto 45px; grid-template-rows: auto 45px; gap: 15px; width: max-content; margin: 0 auto; padding: 0; }

.y-axis-container { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; border-right: 1px dashed rgba(255, 255, 255, 0.15); padding: 10px 15px 10px 0; color: rgba(255, 255, 255, 0.5); }

.matrix-container { grid-column: 2; grid-row: 1; display: inline-grid; gap: 0; box-shadow: 0 15px 45px rgba(0,0,0,0.6); border-radius: 8px; overflow: hidden; transition: transform 0.2s; max-width: 100%; background: rgba(0,0,0,0.5); }

.axis-origin { grid-column: 1; grid-row: 2; display: flex; align-items: flex-start; justify-content: flex-end; padding-right: 15px; padding-top: 15px; font-size: 24px; font-weight: 600; color: rgba(255, 255, 255, 0.4); line-height: 1; }

.x-axis-container { grid-column: 2; grid-row: 2; display: flex; align-items: flex-start; justify-content: space-between; border-top: 1px dashed rgba(255, 255, 255, 0.15); padding: 15px 0 0 10px; color: rgba(255, 255, 255, 0.5); }

.axis-sign { font-size: 18px; font-weight: 600; line-height: 1; }
.axis-title { font-size: 11px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }
.y-axis-title { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }

.seo-content {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px;
    padding: 24px;
}
.seo-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px; padding: 20px;
}
.seo-item h2 {
    font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
    margin-bottom: 10px; color: var(--text-color);
}
.seo-item p, .seo-item li {
    font-size: 12px; line-height: 1.6;
    color: rgba(255, 255, 255, 0.55); margin-bottom: 4px;
}
.seo-item ol { padding-left: 18px; }
.seo-item li { margin-bottom: 2px; }

.color-cell { display: flex; justify-content: center; align-items: center; flex-direction: column; border: 1px solid rgba(255, 255, 255, 0.03); transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.2s; overflow: hidden; }
.color-cell:hover { transform: scale(1.15); z-index: 10; border: 1px solid rgba(255,255,255,0.4); border-radius: 6px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }

.color-value { font-size: 8px; font-weight: 500; text-align: center; line-height: 1.1; pointer-events: none; word-break: break-word; max-width: 95%; padding: 2px; }

.glass-btn {
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06);
    color: white; padding: 12px 24px; border-radius: 12px; cursor: pointer;
    font-family: 'Montserrat', sans-serif; font-weight: 500; transition: all 0.3s;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    letter-spacing: 0.3px; font-size: 14px;
}
.glass-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.12); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.glass-btn:active { transform: translateY(0); }

.export-button {
    width: 100%; max-width: 320px; padding: 18px; font-size: 15px; font-weight: 600;
    background: linear-gradient(135deg, rgba(0, 200, 248, 0.15), rgba(0, 200, 248, 0.04));
    border: 1px solid rgba(0, 200, 248, 0.2); box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-radius: 14px; transition: all 0.25s cubic-bezier(0.2, 0, 0.2, 1);
    color: #ffffff !important; cursor: pointer; font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.5px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.export-button:hover { box-shadow: 0 12px 35px rgba(0, 200, 248, 0.15); transform: translateY(-2px); border-color: rgba(0, 200, 248, 0.3); background: linear-gradient(135deg, rgba(0, 200, 248, 0.2), rgba(0, 200, 248, 0.06)); }
.export-button:active { transform: translateY(0); }
.export-button:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; border-color: rgba(255,255,255,0.05); background: rgba(255,255,255,0.03); }

.app-info { display: flex; gap: 15px; font-size: 13px; font-weight: 400; color: rgba(255, 255, 255, 0.5); flex-wrap: wrap; justify-content: center; text-align: center; }

.legal-disclaimer { font-size: 11px; color: rgba(255,255,255,0.35); text-align: center; max-width: 650px; margin: 0 auto; line-height: 1.6; padding: 0 15px; }

.notification {
    position: fixed; bottom: 30px; left: 50%; padding: 15px 25px; border-radius: 12px;
    background: rgba(30, 30, 30, 0.95); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.1); z-index: 10000;
    transform: translate(-50%, 150%);
    transition: transform 0.4s cubic-bezier(0.2, 0, 0.2, 1);
    max-width: 320px; white-space: normal; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); font-weight: 400;
}
.notification.show { transform: translate(-50%, 0); }
.notification.error { border-bottom: 4px solid #ff4757; }
.notification.success { border-bottom: 4px solid var(--success-color); }
.notification.warning { border-bottom: 4px solid #ffa502; }

.progress-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); z-index: 10000; justify-content: center;
    align-items: center; flex-direction: column; backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    padding: 0 20px; box-sizing: border-box; text-align: center;
}
.progress-overlay .logo-container { transform: scale(0.5); margin-bottom: 5px; }
.progress-overlay .bracket { transform: translateX(0); border-color: #8a8a8a; opacity: 1; }
.progress-overlay .matrix { opacity: 1; }

.tutorial-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.75); z-index: 9998; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.3s; }
.tutorial-backdrop.show { opacity: 1; display: block; }

.tutorial-modal {
    display: none; position: absolute;
    background: rgba(30, 30, 30, 0.95); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px; padding: 18px 24px;
    z-index: 10000; width: calc(100% - 40px); max-width: 480px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}
.tutorial-modal.show { opacity: 1; display: block; }

.tutorial-close { position: absolute; top: 8px; right: 12px; background: transparent; border: none; color: #aaa; font-size: 24px; cursor: pointer; transition: color 0.2s; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; touch-action: manipulation;}
.tutorial-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
.tutorial-content { margin-top: 5px; }
.tutorial-content h3 { margin-bottom: 8px; font-size: 16px; color: var(--text-color); font-weight: 600; }
.tutorial-content p { font-size: 13px; font-weight: 400; color: var(--text-light); line-height: 1.4; margin-bottom: 0; min-height: 38px; }
.tutorial-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; }
.tutorial-dots { display: flex; gap: 8px; }
.tutorial-dots .dot { width: 8px; height: 8px; background: rgba(255,255,255,0.2); border-radius: 50%; transition: 0.3s; }
.tutorial-dots .dot.active { background: var(--highlight-color); transform: scale(1.3); }
.tutorial-buttons { display: flex; gap: 10px; }
.tutorial-highlight { position: relative !important; z-index: 9999 !important; box-shadow: 0 0 0 2px var(--highlight-color), 0 0 30px rgba(0, 200, 248, 0.2) !important; border-color: var(--highlight-color) !important; background: rgba(30,30,30,0.9) !important; }

@keyframes bootPopMobile {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(0.7); opacity: 1; }
    100% { transform: scale(0.65); opacity: 1; }
}

@media (max-width: 1350px) {
    .app-container { grid-template-columns: 1fr 1fr; grid-template-areas: "header header" "controls axes" "matrix matrix" "seo seo" "footer footer"; }
    .seo-content { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    #page-loader .loader-scaler { filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.7)); animation: bootPopMobile 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
    header { justify-content: center; padding: 25px 20px; }
    .header-title { padding-left: 0; text-align: center; margin-top: 10px; width: 100%; align-items: center; }
    .header-left { flex-direction: column; gap: 15px; }
    .header-right { width: 100%; margin-top: 15px; display: flex; justify-content: center; }
    #helpBtn { width: 100%; justify-content: center; }
    .app-container { grid-template-columns: 1fr; grid-template-areas: "header" "controls" "axes" "matrix" "seo" "footer"; gap: 10px; }
    header, .controls-panel, .matrix-panel, .axes-panel, .app-footer { padding: 20px 15px; border-radius: 16px; }
    .section-title { text-align: center; }
    .matrix-panel { min-height: 380px; padding: 20px 0; }
    .matrix-layout { padding: 10px 0; gap: 12px; }
    .y-axis-container { padding: 5px 10px 5px 0; }
    .x-axis-container { padding: 10px 0 0 5px; }
    .axis-origin { padding-right: 10px; padding-top: 10px; font-size: 18px; }
    .color-control { flex-wrap: nowrap; gap: 10px; }
    .matrix-size-control { flex-direction: column; align-items: center; gap: 12px; }
    .matrix-size-control label { text-align: center; }
    .axis-steps-grid-2col { gap: 12px 10px; }
    .number-input-wrapper { gap: 4px; padding: 4px; min-width: unset; margin-left: 0; }
    .number-input-wrapper input[type="number"] { width: 38px; font-size: 14px; }
    .num-btn { width: 28px; height: 28px; font-size: 18px; border-radius: 6px; }
}

@media (max-width: 480px) {
    @keyframes bootPopMobile {
        0% { transform: scale(0.3); opacity: 0; }
        60% { transform: scale(0.6); opacity: 1; }
        100% { transform: scale(0.55); opacity: 1; }
    }
}
