/* Estilos Office 97 & WordArt Retro */
:root {
  --win-gray: #c0c0c0;
  --win-dark-gray: #808080;
  --win-black: #000000;
  --win-white: #ffffff;
  --win-blue-start: #000080;
  --win-blue-end: #1084d0;
  --bg-teal: #008080;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: none !important;
  -moz-osx-font-smoothing: unset !important;
  font-smooth: never !important;
  text-rendering: geometricPrecision;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

body {
  background-color: var(--bg-teal);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 8px 8px;
  font-family: 'MS Sans Serif', Tahoma, 'Microsoft Sans Serif', Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  user-select: none;
}

/* Lienzo de confeti */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* Ventana Principal Office 97 */
.office-window {
  width: 96%;
  max-width: 1300px;
  margin: 16px auto;
  background: var(--win-gray);
  border: 3px outset var(--win-white);
  box-shadow: 4px 4px 0px #000000;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 90vh;
}

/* Barra de Título Windows 95/98 */
.window-titlebar {
  background: linear-gradient(90deg, var(--win-blue-start) 0%, var(--win-blue-end) 100%);
  color: var(--win-white);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.title-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.word-icon {
  width: 18px;
  height: 18px;
  background: #000080;
  color: #fff;
  border: 1px solid #fff;
  font-family: 'Times New Roman', serif;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1px 1px 0 #000;
}

.title-controls {
  display: flex;
  gap: 3px;
}

.title-btn {
  width: 18px;
  height: 16px;
  background: var(--win-gray);
  border: 2px outset var(--win-white);
  font-size: 10px;
  font-weight: 900;
  line-height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #000;
  padding: 0;
}

.title-btn:active {
  border: 2px inset var(--win-white);
  padding: 1px 0 0 1px;
}

/* Barra de Menú */
.menu-bar {
  display: flex;
  background: var(--win-gray);
  border-bottom: 1px solid var(--win-dark-gray);
  padding: 2px 4px;
  font-size: 12px;
}

.menu-item {
  padding: 3px 8px;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--win-blue-start);
  color: var(--win-white);
}

.menu-item span {
  text-decoration: underline;
}

/* Barras de Herramientas Estilo Office 97 */
.toolbar-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: var(--win-gray);
  padding: 4px 6px;
  border-bottom: 2px groove var(--win-white);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-right: 6px;
  border-right: 1px solid var(--win-dark-gray);
}

.tool-btn {
  background: var(--win-gray);
  border: 2px outset var(--win-white);
  padding: 3px 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: #000;
  min-height: 26px;
}

.tool-btn:hover {
  background: #dfdfdf;
}

.tool-btn:active, .tool-btn.active {
  border: 2px inset var(--win-white);
  background: #d0d0d0;
  padding: 4px 7px 2px 9px;
}

.tool-btn.primary {
  background: #d4e2ff;
  border-color: #8faef5;
}

.toolbar-select {
  background: #fff;
  border: 2px inset var(--win-white);
  font-size: 12px;
  padding: 2px 4px;
  font-family: inherit;
  outline: none;
}

/* Área de Trabajo / Hoja de Documento */
.document-viewport {
  background: #7a8288;
  padding: 24px 16px;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  position: relative;
}

.document-sheet {
  background: #ffffff;
  width: 100%;
  max-width: 1150px;
  min-height: 520px;
  box-shadow: 4px 4px 0px #303030;
  border: 1px solid #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 40px 20px;
  text-align: center;
  overflow: hidden;
}

/* Regla horizontal estilo Word 97 (Abarca 100% de la hoja) */
.ruler-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: #ffffff;
  border-bottom: 2px solid #808080;
  border-top: 1px solid #dfdfdf;
  display: flex;
  align-items: center;
  user-select: none;
  overflow: hidden;
  box-sizing: border-box;
}

.ruler-track {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
}

.ruler-segment {
  width: 36px;
  min-width: 36px;
  height: 100%;
  position: relative;
  border-right: 1px solid #777;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.ruler-label {
  font-size: 8px;
  font-family: 'MS Sans Serif', Tahoma, Arial, sans-serif;
  color: #222;
  line-height: 10px;
  padding-left: 2px;
  font-weight: bold;
}

.ruler-subticks {
  display: flex;
  justify-content: space-evenly;
  align-items: flex-end;
  height: 6px;
  width: 100%;
}

.subtick {
  width: 1px;
  background: #888;
}
.subtick.s25 { height: 2px; }
.subtick.s50 { height: 4px; }
.subtick.s75 { height: 2px; }

/* Deslizadores de Sangría Word 97 */
.ruler-slider {
  position: absolute;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 6px;
  line-height: 6px;
  color: #000;
  pointer-events: none;
}

.ruler-left-slider {
  left: 12px;
}

.ruler-right-slider {
  right: 12px;
}

.slider-arrow-down {
  font-size: 6px;
  color: #000;
}

.slider-arrow-up {
  font-size: 6px;
  color: #000;
}

.slider-box {
  width: 8px;
  height: 3px;
  background: #c0c0c0;
  border: 1px solid #000;
  margin-top: 1px;
}

/* Cuadro delimitador de selección WordArt */
.wordart-selection-box {
  position: relative;
  padding: 30px 40px;
  margin: 20px 0;
  border: 1px dashed #000080;
  background: rgba(255, 255, 255, 0.2);
  display: inline-block;
  max-width: 95%;
  transition: transform 0.2s ease;
}

/* Tiradores de redimensionamiento Office 97 */
.handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #000080;
  border: 1px solid #fff;
}
.handle.tl { top: -5px; left: -5px; cursor: nwse-resize; }
.handle.tc { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle.tr { top: -5px; right: -5px; cursor: nesw-resize; }
.handle.ml { top: 50%; left: -5px; transform: translateY(-50%); cursor: ew-resize; }
.handle.mr { top: 50%; right: -5px; transform: translateY(-50%); cursor: ew-resize; }
.handle.bl { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle.bc { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle.br { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* ========================================================
   ESTILOS WORDART OFFICE 97
   ======================================================== */

.wordart-banner {
  margin: 0;
  padding: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1.15;
  display: inline-block;
  word-break: keep-all;
  overflow-wrap: normal;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wordart-banner .word {
  display: inline;
  white-space: nowrap;
  word-break: keep-all;
}

.mobile-break {
  display: none;
}

.desktop-space {
  display: inline;
}

/* Tamaños */
.size-grande {
  font-size: clamp(2.5rem, 6vw, 4.8rem);
}
.size-gigante {
  font-size: clamp(3.2rem, 8.5vw, 6.8rem);
}
.size-colosal {
  font-size: clamp(3.8rem, 11vw, 8.8rem);
}

/* ESTILO 1: CLÁSICO ARCOÍRIS 3D (Rainbow - El más emblemático de Office 97) */
.style-rainbow {
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-style: italic;
  background: linear-gradient(
    90deg,
    #ff0000 0%,
    #ff7700 15%,
    #ffee00 30%,
    #00dd00 48%,
    #0099ff 68%,
    #7a00ff 85%,
    #ff00aa 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 1px 0px #000000)
          drop-shadow(2px 2px 0px #000000)
          drop-shadow(3px 3px 0px #2a0845)
          drop-shadow(4px 4px 0px #2a0845)
          drop-shadow(5px 5px 0px #1a0033)
          drop-shadow(6px 6px 0px #1a0033)
          drop-shadow(7px 7px 0px #000000)
          drop-shadow(8px 8px 0px #000000);
  transform: perspective(500px) skewX(-7deg) rotateX(10deg);
}

/* ESTILO 2: ATARDECER EXTRUIDO (Sunset 3D) */
.style-sunset {
  font-family: 'Impact', 'Arial Black', sans-serif;
  background: linear-gradient(to bottom, #ffff66 0%, #ff6600 55%, #cc0000 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 1px 0px #660000)
          drop-shadow(2px 2px 0px #660000)
          drop-shadow(3px 3px 0px #4d0000)
          drop-shadow(4px 4px 0px #4d0000)
          drop-shadow(5px 5px 0px #330000)
          drop-shadow(6px 6px 0px #330000)
          drop-shadow(7px 7px 0px #1a0000)
          drop-shadow(8px 8px 0px #000000);
  transform: perspective(600px) rotateX(15deg) scaleY(1.15);
}

/* ESTILO 3: AZUL PERSPECTIVA 3D (Deep Ocean 3D Tilt) */
.style-tilt3d {
  font-family: 'Arial Black', 'Impact', sans-serif;
  background: linear-gradient(180deg, #7be5ff 0%, #0088cc 45%, #004488 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 1px 0px #002244)
          drop-shadow(2px 2px 0px #002244)
          drop-shadow(3px 3px 0px #001933)
          drop-shadow(4px 4px 0px #001933)
          drop-shadow(5px 5px 0px #001122)
          drop-shadow(6px 6px 0px #001122)
          drop-shadow(7px 7px 0px #000b14)
          drop-shadow(8px 8px 0px #000000);
  transform: perspective(400px) rotateX(25deg) rotateZ(-4deg) skewX(-4deg);
}

/* ESTILO 4: CROMADO METÁLICO (Silver Chrome 1997) */
.style-chrome {
  font-family: 'Impact', 'Arial Black', sans-serif;
  letter-spacing: 4px;
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #d9e2ec 35%,
    #486581 48%,
    #102a43 50%,
    #9fb3c8 54%,
    #ffffff 80%,
    #627d98 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 1px 0 #102a43)
          drop-shadow(2px 2px 0 #102a43)
          drop-shadow(3px 3px 0 #0b1a29)
          drop-shadow(4px 4px 0 #0b1a29)
          drop-shadow(5px 5px 0 #050d14)
          drop-shadow(6px 6px 0 #000000);
  transform: perspective(500px) scale(1.05) rotateY(-5deg);
}

/* ESTILO 5: RADICAL COMIC (Pop Art 90s) */
.style-radical {
  font-family: 'Comic Sans MS', 'Trebuchet MS', cursive, sans-serif;
  font-style: italic;
  color: #ffeb3b;
  -webkit-text-stroke: 2px #000000;
  text-shadow: 
    2px 2px 0 #ff0055,
    4px 4px 0 #ff0055,
    6px 6px 0 #ff0055,
    8px 8px 0 #000000,
    10px 10px 0 #000000;
  transform: rotate(-3deg) scale(1.05);
}

/* ESTILO 6: VAPORWAVE / NEON 97 (Laser Synth) */
.style-laser {
  font-family: 'Trebuchet MS', 'Arial Black', sans-serif;
  background: linear-gradient(135deg, #00ffff 0%, #ff00ff 50%, #ffff00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 1px 0 #ff00ff)
          drop-shadow(2px 2px 0 #770077)
          drop-shadow(4px 4px 0 #330033)
          drop-shadow(6px 6px 0 #000000);
  transform: perspective(450px) rotateX(15deg) skewX(6deg);
}

/* ESTILO 7: HORIZON ORO & ESMERALDA */
.style-gold {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-weight: 900;
  background: linear-gradient(180deg, #fff3a8 0%, #d4af37 40%, #aa7c11 70%, #553c00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 1px 0 #3a2800)
          drop-shadow(2px 2px 0 #3a2800)
          drop-shadow(4px 4px 0 #241900)
          drop-shadow(6px 6px 0 #000000);
  transform: scaleY(1.2) scaleX(0.95);
}

/* Animaciones Retro */
.anim-wobble {
  animation: retroWobble 4s ease-in-out infinite alternate;
}

@keyframes retroWobble {
  0% {
    transform: perspective(500px) rotateX(10deg) rotateY(-8deg) skewX(-4deg);
  }
  50% {
    transform: perspective(500px) rotateX(-5deg) rotateY(10deg) skewX(4deg);
  }
  100% {
    transform: perspective(500px) rotateX(12deg) rotateY(5deg) skewX(-6deg);
  }
}

.anim-wave {
  animation: retroWave 3s ease-in-out infinite;
}

@keyframes retroWave {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-15px) scale(1.04) rotate(1deg);
  }
}

.anim-pulse {
  animation: retroPulse 1.8s ease-in-out infinite alternate;
}

@keyframes retroPulse {
  0% {
    transform: scale(0.96);
    filter: brightness(0.95);
  }
  100% {
    transform: scale(1.06);
    filter: brightness(1.2) drop-shadow(0 0 15px rgba(255,255,0,0.6));
  }
}

/* Subtítulo / Decoraciones Festivas */
.banner-decorations {
  margin-top: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  font-size: 18px;
  font-family: 'Comic Sans MS', cursive, sans-serif;
  color: #333;
}

.party-badge {
  background: #ffeb3b;
  border: 2px dashed #e91e63;
  padding: 6px 14px;
  font-weight: bold;
  box-shadow: 3px 3px 0 #000;
  transform: rotate(-2deg);
}

/* Barra Flotante de Herramientas WordArt (WordArt Toolbar) */
.wordart-floating-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--win-gray);
  border: 3px outset var(--win-white);
  box-shadow: 4px 4px 15px rgba(0,0,0,0.5);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 1000;
}

.wordart-toolbar-title {
  background: var(--win-blue-start);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Ventana de Clippy (El Asistente de Office) */
.clippy-container {
  position: fixed;
  bottom: 65px;
  right: 50px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.clippy-bubble {
  background: #ffffe1;
  border: 1px solid #000;
  border-radius: 0;
  padding: 8px 12px;
  width: 240px;
  font-size: 11px;
  color: #000;
  box-shadow: 2px 2px 0 #000000;
  position: relative;
  margin-bottom: 14px;
  line-height: 1.4;
  text-align: left;
}

.clippy-bubble::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 9px solid #000;
}

.clippy-bubble::before {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid #ffffe1;
  z-index: 1;
}

.clippy-bubble-btns {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clippy-bubble-btn {
  background: var(--win-gray);
  border: 2px outset var(--win-white);
  padding: 3px 6px;
  text-align: left;
  font-size: 11px;
  cursor: pointer;
  border-radius: 0;
  font-family: inherit;
}
.clippy-bubble-btn:hover {
  background: #d4e2ff;
}
.clippy-bubble-btn:active {
  border: 2px inset var(--win-white);
  padding: 4px 5px 2px 7px;
}

.clippy-avatar {
  width: 102px;
  cursor: pointer;
  filter: drop-shadow(2px 2px 0px #000000);
  transition: transform 0.2s ease;
  animation: clippyBounce 6s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clippy-img {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

@media (max-width: 768px) {
  .mobile-break {
    display: block !important;
  }
  .desktop-space {
    display: none !important;
  }
  .wordart-banner .word {
    display: block !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
  }
  .wordart-banner {
    letter-spacing: 1px;
    line-height: 1.25;
    padding: 6px 2px;
  }
  .wordart-selection-box {
    padding: 16px 6px;
    max-width: 98%;
  }
  .document-sheet {
    padding: 35px 6px 20px 6px;
    min-height: auto;
  }
  .size-grande {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }
  .size-gigante {
    font-size: clamp(2.2rem, 9.5vw, 3.4rem);
  }
  .size-colosal {
    font-size: clamp(2.6rem, 11vw, 4.2rem);
  }
  .clippy-container {
    bottom: 25px;
    right: 20px;
  }
  .clippy-bubble {
    width: 200px;
  }
  .clippy-avatar {
    width: 85px;
  }
}

@keyframes clippyBounce {
  0%, 90%, 100% {
    transform: translateY(0);
  }
  95% {
    transform: translateY(-8px);
  }
}

/* Modal Galería de WordArt (Office 97 WordArt Gallery) */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.open {
  display: flex;
}

.wordart-gallery-dialog {
  background: var(--win-gray);
  border: 3px outset var(--win-white);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.6);
  width: 90%;
  max-width: 650px;
  padding: 4px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  background: #ffffff;
  border: 2px inset var(--win-white);
  padding: 12px;
  max-height: 380px;
  overflow-y: auto;
  margin: 10px 0;
}

.gallery-card {
  height: 80px;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  background: #fdfdfd;
  transition: all 0.15s;
}

.gallery-card:hover {
  background: #eef3ff;
  border-color: #99b4d1;
}

.gallery-card.selected {
  border: 2px solid #000080;
  background: #cce8ff;
  box-shadow: inset 0 0 4px rgba(0,0,128,0.3);
}

.gallery-card-preview {
  font-size: 14px;
  font-weight: 900;
  pointer-events: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 6px;
}

.dialog-btn {
  background: var(--win-gray);
  border: 2px outset var(--win-white);
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-width: 75px;
}

.dialog-btn:active {
  border: 2px inset var(--win-white);
}

/* Barra de Estado inferior */
.status-bar {
  display: flex;
  background: var(--win-gray);
  border-top: 2px groove var(--win-white);
  padding: 2px 4px;
  font-size: 11px;
  gap: 4px;
}

.status-cell {
  border: 1px inset var(--win-white);
  padding: 1px 6px;
  background: var(--win-gray);
}
.status-cell.grow {
  flex: 1;
}

/* Modo pantalla completa para el banner */
body.fullscreen-mode .office-window {
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: none;
  box-shadow: none;
}
body.fullscreen-mode .document-viewport {
  padding: 0;
}
body.fullscreen-mode .document-sheet {
  width: 100%;
  height: 100%;
  max-width: none;
  min-height: none;
  border: none;
}

/* ========================================================
   EFECTO MONITOR CRT 1997 / NO-HD (SVGA 800x600)
   ======================================================== */
.crt-screen-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99998;
  background: 
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.14) 0px,
      rgba(0, 0, 0, 0.14) 1px,
      transparent 1px,
      transparent 2px
    ),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.28) 100%);
  mix-blend-mode: multiply;
  opacity: 1;
}

.crt-screen-effect.off {
  display: none;
}
