/* ============================================================
   LETREIRO LED — style.css
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:   #080810;
  --bg-card:   #0e0e1a;
  --bg-card2:  #13132050;
  --border:    #2a2a45;
  --accent:    #39ff14;
  --accent-glow: rgba(57,255,20,0.35);
  --text-main: #e8e8f0;
  --text-dim:  #6b6b8e;
  --radius:    14px;
  --radius-sm: 8px;
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  font-size: 16px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ---- Screens ---- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.screen.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* ---- App Screen ---- */
#app-screen {
  background: var(--bg-deep);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#app-screen::-webkit-scrollbar { width: 4px; }
#app-screen::-webkit-scrollbar-track { background: transparent; }
#app-screen::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---- Header ---- */
.app-header {
  padding: env(safe-area-inset-top, 20px) 20px 12px;
  padding-top: max(env(safe-area-inset-top, 20px), 20px);
  background: linear-gradient(180deg, #000 0%, transparent 100%);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow), 0 0 30px var(--accent-glow);
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent), 0 0 20px var(--accent-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}
.logo-dot:last-child { animation-delay: 1s; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

/* ---- Editor Area ---- */
.editor-area {
  padding: 16px 16px max(env(safe-area-inset-bottom, 20px), 20px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* ---- Input ---- */
.input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  height: 56px;
}

.input-wrapper {
  position: relative;
  flex: 1;
}

.msg-input {
  width: 100%;
  height: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  padding: 16px 60px 16px 14px;
  resize: none;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.3;
  overflow: hidden;
}
.msg-input::placeholder { color: var(--text-dim); }
.msg-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 0 12px rgba(57,255,20,0.05);
}

.char-counter {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 14px;
  font-size: 0.72rem;
  color: var(--text-dim);
  pointer-events: none;
}

/* ---- Play Button ---- */
.btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1a4a00 0%, #0d3300 100%);
  color: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 1.5px var(--accent), 0 0 20px var(--accent-glow), 0 4px 20px rgba(0,0,0,0.4);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.btn-play::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(57,255,20,0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn-play:hover::before, .btn-play:active::before { opacity: 1; }
.btn-play:hover { transform: translateY(-1px); box-shadow: 0 0 0 1.5px var(--accent), 0 0 30px rgba(57,255,20,0.5), 0 8px 30px rgba(0,0,0,0.4); }
.btn-play:active { transform: translateY(1px); }

.play-icon { width: 22px; height: 22px; filter: drop-shadow(0 0 6px var(--accent)); }

/* ---- Section Title ---- */
.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* ---- Shortcuts ---- */
.shortcuts-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.shortcut-btn {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 10px 6px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}
.shortcut-btn:hover, .shortcut-btn:active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  background: rgba(57,255,20,0.06);
}

/* ---- Settings Panel ---- */
.settings-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-row {
  display: flex;
  gap: 16px;
}
.settings-row .setting-group {
  flex: 1;
  min-width: 0;
}

.setting-group { display: flex; flex-direction: column; gap: 10px; }

.setting-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.setting-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  color: var(--accent);
}

/* ---- Mode Selector ---- */
.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mode-btn {
  background: var(--bg-card2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 12px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 600;
  transition: all var(--transition);
}
.mode-icon { font-size: 1.2rem; }
.mode-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(57,255,20,0.08);
  box-shadow: 0 0 14px var(--accent-glow);
}
.mode-btn:not(.active):hover { border-color: #444; color: var(--text-main); }

/* ---- Steppers ---- */
.stepper-control {
  display: flex;
  align-items: center;
  background: var(--bg-card2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  justify-content: space-between;
  height: 44px;
}
.stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.stepper-btn:active {
  transform: scale(0.9);
}
.stepper-btn:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 10px var(--accent-glow);
}
.stepper-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
  text-align: center;
  flex: 1;
}

/* ---- Color Palette ---- */
.color-palette, .bg-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.18); }
.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(255,255,255,0.5);
  transform: scale(1.12);
}

/* ---- Display Screen ---- */
#display-screen {
  background: #000;
  cursor: none;
  touch-action: none;
}
#display-screen.active { display: flex; align-items: center; justify-content: center; }

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

@media (orientation: portrait) {
  #display-screen.active #marquee-canvas {
    width: 100vh;
    height: 100vw;
    width: 100svh;
    height: 100svw;
    transform: rotate(90deg);
    transform-origin: center;
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
  }
}

.btn-close {
  position: fixed;
  top: max(env(safe-area-inset-top, 14px), 14px);
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 100;
  opacity: 0;
}
#display-screen:hover .btn-close,
.btn-close:focus { opacity: 1; }
#display-screen.show-ui .btn-close { opacity: 1; }
.btn-close svg { width: 18px; height: 18px; }
.btn-close:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); color: #fff; }

/* ---- Responsive ---- */
@media (min-width: 480px) {
  .shortcuts-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
@media (min-width: 600px) {
  .editor-area { padding: 20px 24px max(env(safe-area-inset-bottom, 24px), 24px); }
  .settings-panel { padding: 24px 20px; }
}
