@font-face {
    font-family: 'EditorSerif';
    src: url('GameFonts/EditorSerif-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Narkiss Yair';
    src: url('GameFonts/NarkissYair-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

:root {
    --bg-color: #ffffff;
    --canvas-bg: #072439;
    --accent-color: #5b56a5;
    --secondary-color: #d8b2d4;
    --text-color: #1a1a1a;
    --panel-bg: rgba(0, 0, 0, 0.04);
    --panel-border: rgba(0, 0, 0, 0.1);
    --font-main: 'Narkiss Yair', sans-serif;
    --font-heading: 'Narkiss Yair', sans-serif;
    --font-hand: 'Narkiss Yair', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-header {
    height: 78px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.main-title {
    font-family: 'EditorSerif', serif;
    font-weight: 400;
    font-size: 1.8rem;
    color: #000;
    direction: rtl;
    line-height: 1;
    margin-bottom: 0;
}

.canvas-wrapper {
    width: 100%;
    background: #072439;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 55vh;
    margin: 0;
}

#canvas-container {
    height: 85%;
    max-height: 60vh; 
    aspect-ratio: 1 / 1;
    background: #072439;
    overflow: hidden;
    position: relative;
}

#main-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.controls-panel {
    width: 100%;
    max-width: 1000px;
    padding: 1.6rem 2rem 1.2rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

#controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.sequential-container {
    display: flex;
    align-items: center;
    width: 95vw;
    max-width: 1000px;
    justify-content: space-between;
    position: relative;
}

.slider-box {
    width: 85%; /* Relative to container */
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.control-group {
    position: absolute;
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 0; /* Removing gap to control spacing via margins */
    align-items: center;
}

.control-group.active {
    display: flex;
}

.control-group label {
    font-size: 16pt;
    letter-spacing: 0;
    opacity: 0.9;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--accent-color);
    direction: rtl;
    white-space: nowrap;
    text-align: center;
    width: 100%;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 40px; /* Large hit area for touch */
    background: transparent;
    outline: none;
    cursor: pointer;
}

/* Chrome, Safari, Edge, Opera */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 1px; /* Hairline track */
    background: rgba(216, 178, 212, 0.5);
    border: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    margin-top: -5.5px; /* (1px/2) - (12px/2) = Centered */
    border: none;
    box-shadow: none;
    transition: transform 0.2s ease;
}

/* Firefox */
input[type="range"]::-moz-range-track {
    width: 100%;
    height: 1px;
    background: rgba(216, 178, 212, 0.5);
    border: none;
}

input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    box-shadow: none;
}

.nav-btn {
    background: none;
    border: none;
    width: 44px; /* Large hit area */
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--secondary-color); /* Inactive: #d8b2d4 */
    padding: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.nav-btn:hover:not(:disabled) {
    color: var(--accent-color); /* Active: #5b56a5 */
    transform: scale(1.1);
}

.nav-btn:active:not(:disabled) {
    transform: scale(0.9);
}

.nav-btn:disabled {
    opacity: 0.2;
    cursor: default;
}

.nav-btn svg {
    display: block;
    width: 10px;
    height: 20px;
}

.step-indicator {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--secondary-color);
}

.dot.active {
    background: var(--accent-color);
}

/* Submission Stage Styles */
#submission-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.4s ease;
}

.submission-actions {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    justify-content: center;
}

.action-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 2rem;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.secondary {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.4);
}

#qr-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #fff;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 100;
    text-align: center;
    border: 4px solid #000;
}

.qr-box img {
    width: 120px;
    height: 120px;
}

.qr-box p {
    font-size: 0.7rem;
    margin-top: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
}

#thanks-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 5rem;
    color: var(--accent-color);
    letter-spacing: 0.2rem;
}

.action-bar {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    margin-top: 0.5rem;
}

#reset-btn, #print-btn {
    font-family: var(--font-heading);
    padding: 0.6rem 1.5rem;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.75rem;
}

#reset-btn {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.4);
}

#print-btn {
    background: #000;
    color: #fff;
    border: 1px solid #000;
}

#feedback-container {
    width: 100%;
    text-align: center;
    min-height: 2rem;
}

.feedback-he {
    font-family: var(--font-hand);
    font-size: 1.6rem;
    font-weight: 700;
    direction: rtl;
    color: #000;
}

.hidden {
    display: none !important;
}

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