@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');
@import url('https://cdn.jsdelivr.net/npm/galmuri@latest/dist/galmuri.css');

:root {
  --lcd-bg: #c7d6a0;
  --lcd-bg2: #b3c489;
  --lcd-dark: #29331c;
  --lcd-mid: #52603a;
  --lcd-line: rgba(41, 51, 28, 0.12);
  --lcd-line-v: rgba(41, 51, 28, 0.096);
  --bezel: #1b1b1b;
  --bezel2: #050505;
  --chrome: #c8c8c0;
  --chrome-hi: #f2f2ec;
  --chrome-lo: #6d6d66;
  --amber: #d8b03a;
  --void-bg: #252914;
  --void-center: #373e1e;
  --font-pix: 'Press Start 2P', 'VT323', monospace;
  --font-mono: 'VT323', 'Press Start 2P', monospace;
}

body.lang-kr {
  --font-pix: 'Galmuri11', 'Press Start 2P', monospace;
  --font-mono: 'Galmuri11', 'VT323', monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  min-height: 100vh;
  background: var(--void-bg);
  background-image: radial-gradient(circle at 50% 20%, var(--void-center) 0%, var(--void-bg) 70%);
  font-family: var(--font-mono);
  color: var(--lcd-dark);
  overflow-x: hidden;
  cursor: default;
  font-size: 16px;
  user-select: none;
}

/* ---------- Scanlines Global ---------- */
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: 
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.12) 0px,
      rgba(0, 0, 0, 0.12) 1px,
      transparent 2px,
      transparent 3px
    ),
    repeating-linear-gradient(
      to right,
      rgba(0, 0, 0, 0.096) 0px,
      rgba(0, 0, 0, 0.096) 1px,
      transparent 2px,
      transparent 3px
    );
  z-index: 999;
  mix-blend-mode: multiply;
}

/* Custom Cursor */
#customCursor {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  display: none;
}

/* Language Switcher */
.lang-switcher {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9000;
  display: flex;
  gap: 6px;
}

.lang-btn {
  width: 34px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--chrome);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 var(--chrome-hi), inset -1px -1px 0 var(--chrome-lo);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.1s ease;
  padding: 0;
}

.lang-btn:hover {
  opacity: 1;
}

.lang-btn.active {
  opacity: 1;
  background: var(--amber);
  box-shadow: inset -1px -1px 0 var(--chrome-hi), inset 1px 1px 0 var(--chrome-lo);
}

.lang-flag {
  width: 22px;
  height: 15px;
  display: block;
  font-weight: bold;
  font-size: 10px;
  line-height: 15px;
  text-align: center;
  color: #000;
  font-family: var(--font-pix);
}

.lang-flag-uk::after { content: "EN"; }
.lang-flag-kr::after { content: "KR"; }

/* Outer Window Frame */
#outerFrame {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 640px;
  z-index: 100;
}

.titlebar {
  background: var(--chrome);
  border: 2px solid #000;
  box-shadow: inset 1px 1px 0 var(--chrome-hi), inset -1px -1px 0 var(--chrome-lo);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  height: 32px;
  font-family: var(--font-pix);
  font-size: 10px;
}

.tb-title {
  color: #000;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tb-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wallet-btn-wrap {
  position: relative;
  display: inline-block;
}

.wallet-btn {
  background: var(--chrome);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 var(--chrome-hi), inset -1px -1px 0 var(--chrome-lo);
  font-family: var(--font-pix);
  font-size: 9px;
  padding: 4px 8px;
  cursor: pointer;
  color: #000;
}

.wallet-btn:hover {
  background: #dbdbc0;
}

.wallet-btn:active {
  box-shadow: inset -1px -1px 0 var(--chrome-hi), inset 1px 1px 0 var(--chrome-lo);
}

.switch-account-hint {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #000;
  color: #fff;
  font-size: 8px;
  font-family: var(--font-pix);
  padding: 2px 4px;
  display: none;
  white-space: nowrap;
}

#btnReloadAll {
  background: var(--chrome);
  border: 1px solid #000;
  width: 24px;
  height: 22px;
  font-weight: bold;
  cursor: pointer;
}

/* LOCK SCREEN */
#lockscreen {
  position: fixed;
  inset: 0;
  background: var(--void-bg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#lockscreen.hidden {
  display: none;
}

.phone-icon {
  width: 80px;
  height: 140px;
  background: #111;
  border: 4px solid var(--lcd-dark);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 10px rgba(199, 214, 160, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
  margin-bottom: 24px;
  transition: transform 0.2s ease;
}

#lockscreen:hover .phone-icon {
  transform: scale(1.05);
}

.screen-glimmer {
  width: 56px;
  height: 56px;
  background: var(--lcd-bg);
  border: 2px solid var(--lcd-dark);
  box-shadow: inset 0 0 8px var(--lcd-dark);
  animation: pulseGlimmer 2s infinite ease-in-out;
}

@keyframes pulseGlimmer {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; filter: brightness(1.2); }
}

.keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 12px;
}

.keys span {
  width: 12px;
  height: 8px;
  background: var(--lcd-dark);
  border-radius: 1px;
}

.press-key {
  font-family: var(--font-pix);
  font-size: 14px;
  color: var(--lcd-bg);
  text-shadow: 0 0 8px var(--lcd-bg);
  animation: blinkKey 1.2s infinite;
  margin-bottom: 8px;
}

@keyframes blinkKey {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.press-sub {
  font-family: var(--font-pix);
  font-size: 10px;
  color: var(--lcd-mid);
  letter-spacing: 2px;
}

/* BOOT LOG */
#bootlog {
  position: fixed;
  inset: 0;
  background: #000;
  color: var(--lcd-bg);
  font-family: var(--font-mono);
  font-size: 18px;
  padding: 40px;
  z-index: 1900;
  display: none;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-y: auto;
}

#bootlog.active {
  display: block;
}

.bootlog-skip-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: var(--font-pix);
  font-size: 10px;
  color: var(--lcd-mid);
  cursor: pointer;
  animation: blinkKey 1s infinite;
}

/* MAIN STAGE */
#stage {
  margin-top: 60px;
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
  padding: 0 16px;
}

.win {
  width: 100%;
  max-width: 640px;
  background: var(--chrome);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000, inset 2px 2px 0 var(--chrome-hi), inset -2px -2px 0 var(--chrome-lo);
}

.win-body {
  padding: 12px;
  background: var(--chrome-lo);
}

.lcd {
  background: var(--lcd-bg);
  border: 3px solid var(--lcd-dark);
  box-shadow: inset 2px 2px 8px rgba(0,0,0,0.3);
  padding: 16px;
  color: var(--lcd-dark);
  position: relative;
}

.brand {
  text-align: center;
  margin-bottom: 12px;
}

.brand h1 {
  font-family: var(--font-pix);
  font-size: 24px;
  margin: 0;
  line-height: 1.2;
  letter-spacing: 2px;
  color: var(--lcd-dark);
}

.brand .sub {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--lcd-mid);
  margin-top: 4px;
}

.divider {
  border: none;
  border-top: 2px dashed var(--lcd-dark);
  margin: 14px 0;
}

/* Preview Row */
.preview-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.preview-screen {
  width: 160px;
  height: 120px;
  background: var(--lcd-bg2);
  border: 2px solid var(--lcd-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 1px 1px 4px rgba(0,0,0,0.2);
}

#phoneCanvas {
  width: 160px;
  height: 120px;
  image-rendering: pixelated;
}

.preview-info {
  flex: 1;
  font-family: var(--font-pix);
  font-size: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-info .lbl {
  color: var(--lcd-mid);
}

.preview-info .val {
  color: var(--lcd-dark);
  font-weight: bold;
}

.blurb {
  font-family: var(--font-mono);
  font-size: 19px;
  line-height: 1.3;
  margin-bottom: 16px;
  background: rgba(41, 51, 28, 0.08);
  padding: 10px;
  border-left: 3px solid var(--lcd-dark);
}

/* Menu Buttons */
.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.menu-btn {
  background: var(--lcd-bg2);
  border: 2px solid var(--lcd-dark);
  padding: 10px 14px;
  font-family: var(--font-pix);
  font-size: 12px;
  color: var(--lcd-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: all 0.1s ease;
  box-shadow: 2px 2px 0 var(--lcd-dark);
}

.menu-btn:hover {
  background: var(--lcd-dark);
  color: var(--lcd-bg);
}

.menu-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--lcd-dark);
}

.menu-btn .num {
  margin-right: 8px;
  opacity: 0.7;
}

.wl-notify-badge {
  background: #cc0000;
  color: #fff;
  font-size: 9px;
  font-family: var(--font-pix);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 28px;
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-pix);
  font-size: 9px;
  background: var(--lcd-dark);
  color: var(--lcd-bg);
  padding: 6px 10px;
  margin-top: 8px;
}

#sigBars i {
  display: inline-block;
  width: 3px;
  height: 8px;
  background: var(--lcd-bg);
  margin-left: 2px;
}

.blinkcursor {
  animation: blinkKey 0.8s infinite;
}

/* Modal Overlays */
.api-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.api-modal-overlay.active {
  display: flex;
}

.api-modal {
  width: 100%;
  max-width: 440px;
}

.api-modal-body {
  padding: 16px;
  background: var(--lcd-bg);
  border: 3px solid var(--lcd-dark);
}

.api-modal-label {
  font-family: var(--font-pix);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
  color: var(--lcd-dark);
}

/* Swap Card */
.swap-card {
  background: var(--lcd-bg2);
  border: 2px solid var(--lcd-dark);
  padding: 10px;
  margin-bottom: 8px;
}

.swap-card-label {
  font-family: var(--font-pix);
  font-size: 9px;
  color: var(--lcd-mid);
  margin-bottom: 6px;
}

.swap-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.swap-input {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--lcd-dark);
  width: 60%;
  outline: none;
}

.swap-output-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: bold;
}

.swap-token-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--lcd-dark);
  color: var(--lcd-bg);
  padding: 4px 8px;
  font-family: var(--font-pix);
  font-size: 10px;
}

.swap-arrow-row {
  text-align: center;
  font-family: var(--font-pix);
  font-size: 16px;
  margin: 4px 0;
}

.swap-rate-line {
  font-family: var(--font-pix);
  font-size: 8px;
  color: var(--lcd-mid);
  text-align: center;
  margin: 10px 0;
}

.swap-send-btn {
  width: 100%;
  justify-content: center;
}

.add-funds-footer {
  font-family: var(--font-mono);
  font-size: 14px;
  margin-top: 12px;
  color: #880000;
  line-height: 1.2;
}

/* Checkbox & Inputs */
.wl-field {
  margin-bottom: 12px;
}

.wp-section-title {
  font-family: var(--font-pix);
  font-size: 10px;
  margin-bottom: 4px;
}

.wp-handle-input {
  width: 100%;
  background: var(--lcd-bg2);
  border: 2px solid var(--lcd-dark);
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--lcd-dark);
  outline: none;
}

.wl-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 16px;
}

.custom-checkbox {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
}

.custom-checkbox input {
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: var(--lcd-bg2);
  border: 2px solid var(--lcd-dark);
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--lcd-dark);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--lcd-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.wl-post-link {
  color: var(--lcd-dark);
  font-weight: bold;
}

.wl-hint {
  font-family: var(--font-pix);
  font-size: 9px;
  margin-top: 8px;
  text-align: center;
}

/* Mint Quantity */
.mint-qty-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  background: var(--lcd-dark);
  color: var(--lcd-bg);
  border: none;
  width: 28px;
  height: 28px;
  font-family: var(--font-pix);
  font-size: 14px;
  cursor: pointer;
}

.qty-val {
  font-family: var(--font-pix);
  font-size: 14px;
  width: 24px;
  text-align: center;
}

.mint-info-box {
  background: var(--lcd-bg2);
  border: 2px solid var(--lcd-dark);
  padding: 10px;
  font-family: var(--font-pix);
  font-size: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Chat Widget */
.chat-widget {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 300px;
  z-index: 6000;
  display: flex;
  flex-direction: column;
  border: 2px solid #000;
  background: var(--chrome);
  box-shadow: 3px 3px 0 #000;
}

.chat-widget.minimized .chat-body {
  display: none;
}

.chat-titlebar {
  cursor: pointer;
  position: relative;
}

.chat-body {
  background: var(--lcd-bg);
  padding: 8px;
  border-top: 2px solid #000;
}

.chat-messages {
  height: 160px;
  overflow-y: auto;
  border: 2px solid var(--lcd-dark);
  background: var(--lcd-bg2);
  padding: 6px;
  font-family: var(--font-mono);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}

.chat-msg {
  line-height: 1.2;
}

.chat-msg .sender {
  font-weight: bold;
  font-family: var(--font-pix);
  font-size: 9px;
}

.chat-quota {
  font-family: var(--font-pix);
  font-size: 8px;
  color: var(--lcd-mid);
  margin-bottom: 6px;
  text-align: right;
}

.chat-input-row {
  display: flex;
  gap: 4px;
}

.chat-input-row input {
  flex: 1;
  font-size: 15px;
  padding: 4px 6px;
}

.wp-handle-btn {
  background: var(--lcd-dark);
  color: var(--lcd-bg);
  border: none;
  font-family: var(--font-pix);
  font-size: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

/* Slide-out Wallet Panel */
.wallet-reopen-btn {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 14px;
  height: 60px;
  background: var(--amber);
  border: 2px solid #000;
  border-right: none;
  cursor: pointer;
  z-index: 4000;
}

.wallet-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 4400;
  display: none;
}

.wallet-panel-overlay.active {
  display: block;
}

.wallet-panel {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--chrome);
  border-left: 3px solid #000;
  z-index: 4500;
  transition: right 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.wallet-panel.active {
  right: 0;
}

.wp-tab-label {
  position: absolute;
  left: -28px;
  top: 100px;
  transform: rotate(-90deg);
  background: var(--chrome);
  border: 2px solid #000;
  border-bottom: none;
  padding: 4px 10px;
  font-family: var(--font-pix);
  font-size: 9px;
}

.wallet-panel-body {
  padding: 16px;
  background: var(--lcd-bg);
  flex: 1;
  overflow-y: auto;
  border-top: 2px solid #000;
}

.wp-heading {
  font-family: var(--font-pix);
  font-size: 11px;
  word-break: break-all;
}

.wp-section {
  margin-bottom: 16px;
}

.wp-handle-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.wp-line {
  font-family: var(--font-mono);
  font-size: 17px;
  margin-top: 4px;
}

.wp-addfunds-btn {
  margin-top: 6px;
  width: 100%;
}

/* Toast Notifications */
#toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--lcd-dark);
  color: var(--lcd-bg);
  font-family: var(--font-pix);
  font-size: 10px;
  padding: 8px 16px;
  border: 2px solid var(--lcd-bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 9999;
  display: none;
}

#toast.show {
  display: block;
  animation: fadeInOut 2.5s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  font-family: var(--font-pix);
  font-size: 10px;
  color: var(--lcd-mid);
}

footer a {
  color: var(--lcd-bg);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .preview-row {
    flex-direction: column;
  }
  .preview-screen {
    width: 100%;
    height: 140px;
  }
  #phoneCanvas {
    width: 100%;
    height: 140px;
  }
  .chat-widget {
    left: 8px;
    right: 8px;
    width: auto;
  }
}
