/* ==========================================================================
   Gothic Emo JRPG Stylesheet - Mowskito's Realm
   ========================================================================== */

:root {
  --goth-bg-top: #1f1430;
  --goth-bg-bottom: #0d0817;
  --goth-border-silver: #d4d8e8;
  --goth-border-shadow: #08040d;
  --goth-crimson: #c91838;
  --goth-crimson-light: #ff3b5c;
  --goth-purple: #9b4de0;
  --goth-gold: #e5b94c;
  --goth-text: #f0edf7;
  --font-pixel: 'Press Start 2P', 'Courier New', monospace;
  --font-vt: 'VT323', monospace;
  --font-hand: 'Caveat', cursive, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #1a221b;
  font-family: var(--font-pixel);
  color: var(--goth-text);
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -webkit-font-smoothing: none;
}

/* Full Viewport Canvas */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Gothic JRPG Window Frame */
.jrpg-window {
  background: linear-gradient(180deg, var(--goth-bg-top) 0%, var(--goth-bg-bottom) 100%);
  border: 4px solid var(--goth-border-silver);
  border-radius: 6px;
  box-shadow: 
    0 0 0 2px var(--goth-border-shadow),
    inset 0 0 0 2px rgba(255, 255, 255, 0.25),
    0 10px 30px rgba(0, 0, 0, 0.9);
  position: relative;
  padding: 18px 22px;
  color: #f0edf7;
  text-shadow: 2px 2px 0px #000000;
}

/* Crimson Corner Accents */
.jrpg-window::before,
.jrpg-window::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--goth-crimson);
  box-shadow: 0 0 6px var(--goth-crimson-light);
  pointer-events: none;
}
.jrpg-window::before { top: -2px; left: -2px; border-radius: 2px; }
.jrpg-window::after { bottom: -2px; right: -2px; border-radius: 2px; }

/* Speaker Nameplate */
.jrpg-nameplate {
  position: absolute;
  top: -18px;
  left: 18px;
  background: linear-gradient(180deg, #3d1428 0%, #170712 100%);
  border: 2px solid var(--goth-crimson);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 11px;
  color: #ff94a8;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
  letter-spacing: 1px;
}

/* Floating Proximity Prompt Bubble */
.proximity-prompt {
  position: absolute;
  z-index: 50;
  transform: translate(-50%, -100%);
  background: rgba(23, 13, 36, 0.95);
  border: 2px solid var(--goth-crimson);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  animation: promptBob 1.2s infinite ease-in-out;
  transition: opacity 0.2s ease;
}

.proximity-prompt::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: var(--goth-crimson) transparent transparent;
}

.key-badge {
  background: var(--goth-crimson);
  color: #ffffff;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  box-shadow: 1px 1px 0px #000;
}

@keyframes promptBob {
  0%, 100% { transform: translate(-50%, -100%) translateY(0); }
  50% { transform: translate(-50%, -100%) translateY(-6px); }
}

/* Dialog Overlay & Box */
.dialog-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 30px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(1px);
}

.dialog-box {
  width: 90%;
  max-width: 760px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dialog-content {
  margin-top: 8px;
  margin-bottom: 12px;
  min-height: 52px;
}

.dialog-text {
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.5px;
  color: #f0edf7;
}

.dialog-next-arrow {
  position: absolute;
  bottom: 10px;
  right: 18px;
  color: var(--goth-crimson-light);
  font-size: 14px;
  animation: arrowBounce 0.7s infinite alternate ease-in-out;
}

@keyframes arrowBounce {
  from { transform: translateY(0); }
  to { transform: translateY(5px); }
}

/* Password Input Field */
.password-section {
  margin: 12px 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(10, 5, 18, 0.85);
  border: 2px solid #5a3048;
  border-radius: 4px;
  padding: 6px 12px;
  gap: 10px;
}

.input-wrapper:focus-within {
  border-color: var(--goth-crimson-light);
  box-shadow: 0 0 10px rgba(255, 59, 92, 0.5);
}

.input-prompt {
  font-size: 11px;
  color: #ff859d;
  white-space: nowrap;
}

.jrpg-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: #ffffff;
  padding: 4px 0;
  text-shadow: 1px 1px 0px #000;
}

.jrpg-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
}

.btn-toggle-eye {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.btn-toggle-eye:hover { opacity: 1; }

.password-error {
  font-size: 10px;
  color: #ff5277;
  margin-top: 4px;
  animation: shake 0.4s ease-in-out;
}

/* Buttons */
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 8px;
}

.jrpg-btn {
  background: linear-gradient(180deg, #3d1428 0%, #170712 100%);
  border: 2px solid var(--goth-border-silver);
  border-radius: 4px;
  padding: 8px 16px;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 1px 1px 0px #000;
  box-shadow: 2px 2px 0px #000000;
  transition: all 0.1s ease;
}

.jrpg-btn:hover {
  background: linear-gradient(180deg, #611e3f 0%, #2b0c1f 100%);
  border-color: var(--goth-crimson-light);
  color: #ffd6df;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000000;
}

.jrpg-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000000;
}

.cursor-pointer {
  color: var(--goth-crimson-light);
  font-size: 9px;
  opacity: 0;
  transition: opacity 0.1s;
}

.jrpg-btn:hover .cursor-pointer {
  opacity: 1;
  animation: cursorNudge 0.5s infinite alternate;
}

@keyframes cursorNudge {
  from { transform: translateX(0); }
  to { transform: translateX(3px); }
}

/* Reward Modal */
.reward-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 120;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
}

.reward-box {
  width: 90%;
  max-width: 600px;
  text-align: center;
  padding: 28px 24px;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.reward-sparkles-header {
  font-size: 11px;
  color: var(--goth-crimson-light);
  letter-spacing: 2px;
  margin-bottom: 14px;
  animation: pulseCrimson 1.5s infinite;
}

@keyframes pulseCrimson {
  0%, 100% { color: #ff3b5c; text-shadow: 0 0 8px #c91838; }
  50% { color: #ffffff; text-shadow: 0 0 16px #ff3b5c; }
}

.reward-icon-container {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.treasure-glow {
  position: absolute;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(201, 24, 56, 0.8) 0%, rgba(100, 10, 30, 0) 70%);
  border-radius: 50%;
  animation: spinGlow 4s linear infinite;
}

@keyframes spinGlow {
  from { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.15); }
  to { transform: rotate(360deg) scale(1); }
}

.treasure-icon-large {
  font-size: 40px;
  z-index: 2;
  animation: floatTreasure 2s ease-in-out infinite;
}

@keyframes floatTreasure {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.reward-title {
  font-size: 15px;
  color: #ff99ae;
  margin-bottom: 16px;
  text-shadow: 2px 2px 0px #000;
}

.reward-content {
  font-family: var(--font-vt);
  font-size: 26px;
  line-height: 1.4;
  color: #ffffff;
  background: rgba(10, 5, 18, 0.85);
  border: 2px solid #5a3048;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 18px;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

/* Purrever Question & Choices */
.purrever-section {
  border-top: 2px dashed #61223f;
  padding-top: 16px;
  margin-top: 12px;
}

.purrever-question {
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1.6;
  color: #ff859d;
  margin-bottom: 16px;
  text-align: center;
  text-shadow: 2px 2px 0px #000;
  animation: pulsePink 2s infinite ease-in-out;
}

@keyframes pulsePink {
  0%, 100% { color: #ff859d; }
  50% { color: #ffc2cf; }
}

.purrever-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.yes-btn {
  padding: 10px 24px;
  font-size: 12px;
  min-width: 100px;
  justify-content: center;
}

/* Fullscreen Purrever Dark Overlay */
.purrever-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background-color: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeToDark 0.7s ease forwards;
}

@keyframes fadeToDark {
  from { opacity: 0; }
  to { opacity: 1; }
}

.purrever-image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  background-color: #000000;
  image-rendering: auto;
  border-radius: 8px;
  box-shadow: 0 0 35px rgba(255, 255, 255, 0.15);
  animation: zoomCat 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomCat {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.purrever-hint {
  margin-top: 14px;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #ff99ae;
  letter-spacing: 1px;
  text-shadow: 0 0 8px #ff3b5c;
  animation: pulsePink 1.5s infinite;
}

/* ==========================================================================
   Goofy Cartoon "Partners in Crime" Contract Modal
   ========================================================================== */
.contract-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  padding: 16px;
  animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.contract-box {
  background: #fdf5e2;
  background-image: radial-gradient(#eddcb9 15%, transparent 16%);
  background-size: 16px 16px;
  border: 6px solid #824d26;
  border-radius: 12px;
  box-shadow: 
    0 0 0 4px #4a2810,
    0 15px 40px rgba(0, 0, 0, 0.95),
    inset 0 0 25px rgba(168, 114, 52, 0.3);
  position: relative;
  width: 95%;
  max-width: 650px;
  padding: 30px 24px 22px 24px;
  color: #2b180a;
  text-align: center;
}

/* Wax Seal on top corner */
.contract-wax-seal {
  position: absolute;
  top: -20px;
  right: 18px;
  background: radial-gradient(circle, #e62242 0%, #8f0d23 100%);
  border: 3px solid #ff7b92;
  border-radius: 50%;
  width: 65px;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: var(--font-pixel);
  font-size: 8px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  transform: rotate(12deg);
  text-shadow: 1px 1px 0 #000;
}

.contract-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.contract-stars {
  color: #d48b26;
  font-size: 12px;
}

.contract-title {
  font-family: var(--font-pixel);
  font-size: 13px;
  color: #5c2c09;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.contract-subtitle {
  font-family: var(--font-hand);
  font-size: 20px;
  color: #8c4711;
  margin-bottom: 16px;
  font-weight: bold;
}

.contract-body {
  background: rgba(255, 255, 255, 0.65);
  border: 2px dashed #ab7341;
  border-radius: 8px;
  padding: 16px 14px;
  margin-bottom: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contract-clause {
  font-family: var(--font-pixel);
  font-size: 9px;
  line-height: 1.7;
  color: #2b180a;
}

.clause-num {
  color: #c91838;
  font-weight: bold;
}

.contract-clause strong {
  color: #8f0d23;
}

/* Signatures */
.contract-signatures {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 0 8px;
}

.sig-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 42%;
}

.sig-line {
  font-family: var(--font-hand);
  font-size: 24px;
  color: #1a2254;
  border-bottom: 2px solid #3d2412;
  width: 100%;
  padding-bottom: 2px;
  font-weight: bold;
  transform: rotate(-2deg);
}

.sig-label {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #6b3e1c;
  margin-top: 6px;
}

.sig-stamp {
  width: 60px;
  display: flex;
  justify-content: center;
}

.stamp-circle {
  border: 3px dashed #c91838;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c91838;
  font-family: var(--font-pixel);
  font-size: 7px;
  font-weight: bold;
  transform: rotate(-15deg);
  opacity: 0.85;
}

.contract-btn {
  background: linear-gradient(180deg, #c91838 0%, #7d0b1f 100%);
  border: 3px solid #ffd23f;
  border-radius: 6px;
  padding: 10px 20px;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), 2px 2px 0 #000;
  transition: all 0.1s ease;
  text-shadow: 1px 1px 0 #000;
}

.contract-btn:hover {
  background: linear-gradient(180deg, #e8274b 0%, #9e102b 100%);
  transform: scale(1.04);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), 3px 3px 0 #000;
}

.contract-btn:active {
  transform: scale(0.96);
}

/* Top Right Toolbar & Help Modal */
.top-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 80;
  display: flex;
  gap: 8px;
}

.retro-tool-btn {
  background: linear-gradient(180deg, #2b1228 0%, #120612 100%);
  border: 2px solid var(--goth-border-silver);
  border-radius: 6px;
  color: #ffffff;
  padding: 6px 10px;
  font-family: var(--font-pixel);
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 2px 2px 0px #000;
  transition: all 0.1s;
}

.retro-tool-btn:hover {
  border-color: var(--goth-crimson-light);
  color: #ffc2cf;
  transform: translateY(-1px);
}

.help-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 110;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
}

.help-box {
  width: 90%;
  max-width: 560px;
  padding: 24px;
}

.help-content {
  font-size: 11px;
  line-height: 1.7;
  margin: 12px 0 16px 0;
}

.help-content h3 {
  color: #ff859d;
  font-size: 12px;
  margin: 8px 0 8px 0;
}

.help-list {
  list-style: none;
  padding-left: 4px;
}

.help-list li {
  margin-bottom: 6px;
}

.key-tag {
  background: #3d1428;
  border: 1px solid #7a2c53;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 9px;
  margin: 0 2px;
}

.help-hint {
  background: rgba(10, 5, 18, 0.6);
  border-left: 3px solid var(--goth-crimson-light);
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 10px;
  color: #ffccd7;
}

/* Mobile Controls */
.mobile-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100vw;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 60;
  pointer-events: none;
}

.dpad-container, .mobile-action-container {
  pointer-events: auto;
}

.dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dpad-middle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dpad-center {
  width: 44px;
  height: 44px;
  background: rgba(23, 13, 36, 0.75);
  border-radius: 4px;
}

.dpad-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(180deg, #3d1428 0%, #170712 100%);
  border: 2px solid var(--goth-border-silver);
  border-radius: 6px;
  color: #ffffff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0px #000;
  touch-action: manipulation;
}

.dpad-btn:active {
  background: var(--goth-crimson);
  color: #fff;
}

.mobile-action-btn {
  width: 80px;
  height: 80px;
  background: linear-gradient(180deg, #c91838 0%, #5e0b1a 100%);
  border: 3px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  font-family: var(--font-pixel);
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.8), 2px 2px 0px #000;
  touch-action: manipulation;
}

.mobile-action-btn small {
  font-size: 8px;
  opacity: 0.8;
}

.mobile-action-btn:active {
  transform: scale(0.92);
  background: #ff3b5c;
}

.hidden {
  display: none !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake-element {
  animation: shake 0.4s ease-in-out;
}

@media (max-width: 600px) {
  .dialog-box {
    width: 95%;
    padding: 12px 14px;
  }
  .dialog-text {
    font-size: 11px;
  }
  .jrpg-btn {
    padding: 6px 12px;
    font-size: 10px;
  }
  .contract-title {
    font-size: 10px;
  }
  .contract-subtitle {
    font-size: 16px;
  }
  .contract-clause {
    font-size: 8px;
  }
  .sig-line {
    font-size: 18px;
  }
  .top-toolbar .tool-label {
    display: none;
  }
}

/* ==========================================================================
   Lockpick Minigame Overlay
   z-index 115: above dialog (100) but below reward modal (120)
   ========================================================================== */
.lockpick-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 115;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(4px);
  animation: fadeLockpickIn 0.25s ease forwards;
}

@keyframes fadeLockpickIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#lockpickCanvas {
  image-rendering: auto;
  cursor: pointer;
  touch-action: none;
}

