:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 1050px;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

h1 {
    margin-top: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 35px;
}

.builder-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.preview-pane, .form-pane {
    flex: 1;
}

.preview-pane {
    perspective: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 10px;
}

.preview-pane h3 {
    margin-bottom: 15px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

/* True 3D Multi-Layer Physical Block Construction (69mm x 30mm Proportional Ratio) */
.badge-base {
    background-color: #facc15; 
    padding: 6px; 
    border-radius: 12px;
    width: 345px;
    height: 150px;
    /* Deep multi-layered volumetric stacking simulating the solid 3mm side profile */
    box-shadow: 
        0 1px 0 #ca8a04,
        0 2px 0 #ca8a04,
        0 3px 0 #b45309,
        0 4px 0 #b45309,
        0 5px 0 #92400e,
        0 6px 0 #78350f,
        0 7px 0 #451a03,
        0 8px 0 #291102,
        0 20px 40px rgba(0,0,0,0.8),
        0 40px 80px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    transform-style: preserve-3d;
    border: 3px solid rgba(255, 255, 255, 0.5);
    cursor: grab;
    user-select: none;
    will-change: transform;
    box-sizing: border-box;
}

.badge-base:active {
    cursor: grabbing;
}

/* Raised Outer Border Wall Frame */
.badge-base::before {
    content: '';
    position: absolute;
    top: 3px; left: 3px; right: 3px; bottom: 3px;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    pointer-events: none;
    transform: translateZ(8px);
}

/* Inset Name Plate Layer (Lifts forward to show physical 3mm gap) */
.badge-nameplate {
    background-color: #facc15; 
    flex: 1;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: inset 0 6px 12px rgba(0,0,0,0.45), inset 0 -3px 6px rgba(255,255,255,0.4);
    border: 1px solid rgba(0,0,0,0.4);
    transform: translateZ(18px);
    position: relative;
    transform-style: preserve-3d;
}

.badge-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 15px;
}

/* Draggable Content Container (Lifts above name plate for true 3D depth) */
.badge-middle {
    display: flex;
    align-items: center;
    gap: 12px;
    position: absolute;
    top: 35px;
    left: 14px;
    cursor: move;
    touch-action: none;
    padding: 6px;
    border: 1px dashed rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    transform: translateZ(26px);
}

.badge-middle:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.badge-logo-container {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0,0,0,0.05);
    flex-shrink: 0;
    display: none; 
}

.badge-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.badge-text-group {
    flex: 1;
    overflow: hidden;
}

.badge-name {
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Engraving Effects */
.badge-name.effect-embossed, .badge-title.effect-embossed {
    color: #ffffff;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.4), -1px -1px 1px rgba(0,0,0,0.8);
}

.badge-name.effect-cut, .badge-title.effect-cut {
    color: #27272a;
    text-shadow: 0px 1px 1px rgba(255,255,255,0.4);
}

.badge-title {
    font-size: 10px;
    font-weight: 500;
    margin-top: 1px;
}

/* Charm Holes Row with Conical 7mm-to-4mm Countersunk Fillet */
.badge-bottom-row {
    position: absolute;
    bottom: 8px; 
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateZ(20px);
}

.charms-container {
    display: flex;
    width: 100%;
    justify-content: space-evenly;
}

.charm-slot {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    background: radial-gradient(circle, #090d16 35%, #27272a 55%, #713f12 80%, #facc15 100%);
    color: #facc15;
    border-radius: 50%;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.95), 0 1px 2px rgba(255,255,255,0.4);
    border: 1px solid rgba(0,0,0,0.6);
}

.rotate-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 15px;
    text-align: center;
}

/* Fonts */
.badge-base.font-sans { font-family: 'Segoe UI', system-ui, sans-serif; }
.badge-base.font-serif { font-family: 'Georgia', serif; }
.badge-base.font-mono { font-family: 'Courier New', Courier, monospace; }

/* 16-Color Palette Grid Selector */
.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    background: #1e293b;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 4px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: var(--accent);
    transform: scale(1.1);
}

/* Form Styles */
.form-pane {
    background: #0f172a;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

label {
    display: block;
    margin-top: 15px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
}

label:first-of-type {
    margin-top: 0;
}

input[type="text"], input[type="email"], input[type="file"], select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    box-sizing: border-box;
    background: #1e293b;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

input:focus, select:focus {
    border-color: var(--accent);
}

.customization-row {
    display: flex;
    gap: 15px;
}

.customization-row > div {
    flex: 1;
}

.charm-selectors {
    display: flex;
    gap: 8px;
}

.btn-submit {
    background: var(--accent);
    color: #0f172a;
    border: none;
    padding: 12px 20px;
    margin-top: 25px;
    width: 100%;
    border-radius: 6px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: var(--accent-hover);
}

@media (max-width: 768px) {
    .badge-middle {
        position: relative;
        top: auto;
        left: auto;
        margin: 10px 0;
    }
}
@font-face {
    font-family: 'Speedee';
    src: url('/fonts/Speedee-Regular.otf') format('opentype');
    font-weight: normal;
}

@font-face {
    font-family: 'Speedee';
    src: url('/fonts/Speedee-Bold.ttf') format('truetype');
    font-weight: bold;
}