:root {
  --bg: #05050a;
  --panel: rgba(15, 15, 25, 0.7);
  --ink: #ffffff;
  --muted: #a0a5b5;
  --neon-pink: #ff007f;
  --neon-blue: #00f0ff;
  --neon-purple: #8a2be2;
  --glass-border: rgba(255, 255, 255, 0.15);
}

* { box-sizing: border-box; margin: 0; touch-action: manipulation; }
body {
  font: 17px/1.65 "Public Sans", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(138, 43, 226, 0.15), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(0, 240, 255, 0.15), transparent 40%);
  background-attachment: fixed;
  color-scheme: dark;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 🚀 PREVENTS BACKGROUND SCROLLING WHILE EDITING */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

h1, h2, h3 { font-family: Literata, Georgia, serif; line-height: 1.2; }
a { color: var(--neon-blue); text-decoration: none; }
p { max-width: 64ch; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--neon-blue); outline-offset: 3px; }

.wrap { max-width: 1400px; width: 100%; margin: 0 auto; padding: 0 40px; position: relative; z-index: 1; }

header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(5, 5, 10, 0.6);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
.bar { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo { font: 700 24px Literata, serif; color: var(--ink); }
.logo i { font-style: normal; color: var(--neon-pink); text-shadow: 0 0 10px var(--neon-pink); }
nav { display: flex; align-items: center; gap: 25px; font-size: 15px; }
nav a:not(.btn) { color: var(--muted); transition: 0.2s; }
nav a:not(.btn):hover { color: var(--ink); text-shadow: 0 0 8px #fff; }

/* BUTTONS */
.btn {
  display: inline-block; padding: 14px 28px; border-radius: 99px;
  font-weight: 600; text-align: center; border: none;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4), inset 0 2px 0 rgba(255,255,255,0.3);
  transition: all 0.3s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(255, 0, 127, 0.8), inset 0 2px 0 rgba(255,255,255,0.5); }
.btn.blue { background: linear-gradient(135deg, var(--neon-blue), #0055ff); box-shadow: 0 0 15px rgba(0, 240, 255, 0.4), inset 0 2px 0 rgba(255,255,255,0.3); }
.btn.blue:hover { box-shadow: 0 0 30px rgba(0, 240, 255, 0.8), inset 0 2px 0 rgba(255,255,255,0.5); }
.btn.ghost { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); box-shadow: inset 0 0 10px rgba(255,255,255,0.05); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.1); box-shadow: 0 0 20px rgba(255,255,255,0.2); }
.btn.full { display: block; width: 100%; }
.btn.sm { padding: 8px 16px; font-size: 14px; }

/* HERO */
.hero { padding: 80px 0; text-align: center; }
.hero h1 { font-size: clamp(40px, 6vw, 64px); margin-bottom: 20px; letter-spacing: -0.02em; }
.hero h1 span { background: linear-gradient(to right, var(--neon-pink), var(--neon-blue)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0 20px rgba(255, 0, 127, 0.3)); }
.hero p { font-size: 20px; color: var(--muted); margin: 0 auto 40px; max-width: 700px; }

/* PANELS */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px; margin-bottom: 60px; }
.card { background: var(--panel); backdrop-filter: blur(25px); border: 1px solid var(--glass-border); border-radius: 24px; padding: 30px; box-shadow: 0 20px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1); display: flex; flex-direction: column; }
.card:hover { border-color: rgba(255,255,255,0.3); transform: translateY(-5px); }
.card h3 { font-size: 24px; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 16px; margin-bottom: 20px; flex-grow: 1; }

.upload-box { border: 2px dashed rgba(255,255,255,0.2); border-radius: 16px; padding: 40px 20px; text-align: center; cursor: pointer; background: rgba(0,0,0,0.3); transition: 0.3s; }
.upload-box:hover { border-color: var(--neon-blue); background: rgba(0, 240, 255, 0.05); }
.upload-box input { display: none; }
.upload-box span { font-size: 40px; display: block; margin-bottom: 10px; }

.freelance-cta { text-align: center; padding: 60px 20px; background: linear-gradient(180deg, transparent, rgba(255,0,127,0.05)); border-top: 1px solid var(--glass-border); border-radius: 30px; margin-bottom: 60px; }
.freelance-cta h2 { font-size: 36px; margin-bottom: 15px; }
.freelance-cta p { color: var(--muted); margin: 0 auto 30px; }

/* FOOTER */
footer { text-align: center; padding: 40px 0; border-top: 1px solid var(--glass-border); color: var(--muted); font-size: 14px; position: relative; z-index: 1; }
.footer-links { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--neon-blue); }

/* MODALS & FORMS */
.overlay { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.9); backdrop-filter: blur(10px); align-items: center; justify-content: center; padding: 20px; touch-action: none; /* Prevents background touch bleed */ }
.overlay.on { display: flex; }
.modal { background: #111; border: 1px solid var(--glass-border); border-radius: 20px; padding: 30px; max-width: 600px; width: 100%; max-height: 95vh; overflow: auto; position: relative; text-align: left; box-shadow: 0 0 50px rgba(0, 240, 255, 0.1); touch-action: pan-y; /* Allows vertical scrolling inside modal */ }
.modal h3 { font-size: 24px; margin-bottom: 15px; color: #fff; }
.stepno { color: var(--neon-pink); font-weight: 700; font-size: 14px; margin-bottom: 10px; text-transform: uppercase; }
.x { position: absolute; top: 15px; right: 20px; background: none; border: none; color: #fff; font-size: 30px; cursor: pointer; }
.fld { margin-bottom: 16px; display: flex; flex-direction: column; }
.fld label { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: #ddd; }
.fld input, .fld textarea { width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; background: #222; color: #fff; border: 1px solid #444; font-size: 16px; /* Prevents iOS zoom */ }
.fld input:focus, .fld textarea:focus { border-color: var(--neon-blue); outline: none; box-shadow: 0 0 10px rgba(0, 240, 255, 0.3); }
.total { font: 700 20px Literata, serif; margin: 20px 0; color: var(--neon-blue); text-align: center; }
.err { color: #ff4d4d; font-weight: 600; margin-bottom: 12px; font-size: 14px; }
.note { background: rgba(255,0,127,0.1); border-left: 4px solid var(--neon-pink); padding: 15px; margin: 15px 0; border-radius: 0 8px 8px 0; font-size: 14px; color: #ddd; }

/* EDITOR SPECIFIC MODALS */
#tui-image-editor-container { width: 100%; height: 100%; }
.tui-image-editor-main-container { display: flex; flex-direction: column; height: 100%; }
.tui-image-editor-canvas-container { position: relative !important; flex-grow: 1; bottom: auto !important; height: calc(100% - 160px) !important; }
.tui-image-editor-submenu { position: absolute !important; bottom: 0 !important; height: 160px !important; background: #1a1a1a !important; border-top: 1px solid #333; width: 100%; transition: transform 0.3s ease; }
.tui-image-editor-main { background: #111; }
.tui-image-editor-header { background: #1a1a1a; color: white; }

/* Hide the submenu when toggled */
.tui-image-editor-submenu.hidden { transform: translateY(100%) !important; }
.tui-image-editor-canvas-container.expanded { height: 100% !important; }

.handsontable { color: #fff; touch-action: pan-y; }
.handsontable th { background: #222; color: var(--neon-blue); border-color: #444; }
.handsontable td { background: #111; border-color: #333; }
.handsontable td.current { background: #003366; }
.handsontable td.area { background: rgba(0, 240, 255, 0.1); }

/* MOBILE RESPONSIVE FIXES */
@media (max-width: 768px) {
    .wrap, .bar { padding: 0 15px; }
    nav { gap: 15px; }
    .hero h1 { font-size: 36px; }
    .modal { width: 100%; height: 100%; border-radius: 0; padding: 20px; max-height: 100vh; }
    #wordEditorArea { padding: 15px !important; font-size: 16px !important; }
    
    /* Image editor mobile layout */
    .tui-image-editor-canvas-container { height: calc(100% - 200px) !important; }
    .tui-image-editor-submenu { height: 200px !important; }
}
