@font-face {
  font-family: 'G2-Erika-Mono';
  src: url('G2-Erika-Mono.otf') format('opentype');
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffffff;
}

main {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

canvas {
  display: block;
}

/* Web3 Slider Styles */
input[type="range"] {
  -webkit-appearance: none;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: rgba(0, 102, 255, 0.1);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #0066ff;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #0077ff;
}

/* Slider value display */
.slider-value {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: #0066ff;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  background: rgba(0, 102, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 102, 255, 0.2);
  white-space: nowrap;
}

/* Toggle Switch Styles */
.toggle-button {
  position: fixed;
  top: 195px !important;
  left: 20px;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: #0066ff;
  padding: 0;
  min-width: 120px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  border-radius: 12px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.switch::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: #0066ff;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle-button[data-active="true"] .switch::after {
  left: 22px;
}

.toggle-button[data-active="true"] .switch {
  background: rgba(0, 102, 255, 0.2);
}

.color-buttons {
  position: static;
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.color-button {
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.color-button:hover {
  transform: scale(1.1);
}

.color-button.active {
  border: 2px solid #000;
  transform: scale(1.1);
}

.control-buttons {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 8px;
  flex-direction: column;
}

.control-button {
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  color: #0066ff;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  justify-content: center;
}

.control-button:hover {
  background: #0066ff;
  color: #fff;
}

.control-button.active {
  background: #0066ff;
  color: #fff;
}

.size-control {
  display: flex;
  align-items: center;
  gap: 0;
  height: 40px;
  margin: 0;
  padding: 0;
}

.size-button {
  border-radius: 0;
  height: 40px;
  min-width: 40px;
  font-size: 14px;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  color: #0066ff;
  cursor: pointer;
  font-family: 'G2-Erika-Mono', monospace;
  transition: all 0.3s ease;
  border-left: none;
  border-right: none;
}

.size-button:first-child {
  border-radius: 4px 0 0 4px;
  border-left: 1px solid rgba(0, 102, 255, 0.2);
  border-right: none;
}
.size-button:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
  border-right: 1px solid rgba(0, 102, 255, 0.2);
}
.size-button:nth-child(2) {
  border-left: 1px solid rgba(0, 102, 255, 0.2);
  border-right: 1px solid rgba(0, 102, 255, 0.2);
}

.size-button:hover, .size-button:focus {
  background: #0066ff;
  color: #fff;
  z-index: 1;
}

.size-button.active, .size-button.active:hover, .size-button.active:focus {
  background: #0066ff !important;
  color: #fff !important;
  border: 1.5px solid #0066ff !important;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,102,255,0.10);
}

.size-display {
  min-width: 24px;
  text-align: center;
  color: #0066ff;
  font-family: 'G2-Erika-Mono', monospace;
}

.console-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 240px;
  background: rgba(0, 102, 255, 0.05);
  border: 1px solid rgba(0, 102, 255, 0.2);
  border-radius: 4px;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  color: #0066ff;
  padding: 15px;
  overflow-y: auto;
  box-sizing: border-box;
  scrollbar-width: none;  /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
  margin-bottom: 85px; /* Gap between console and export button */
}

.console-panel::-webkit-scrollbar {
  display: none;  /* Chrome, Safari, Opera */
}

.console-panel h3 {
  margin: 0 0 10px 0;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  font-weight: normal;
}

.connection-info {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(0, 102, 255, 0.1);
}

.connection-info:last-child {
  border-bottom: none;
}

.dot-info {
  margin-left: 22px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.connection-header {
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-preview {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 102, 255, 0.2);
}

.export-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
}

.export-button {
  width: 100%;
  background: #0066ff;
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-button:hover {
  background: #0052cc;
}

.shortcuts-info {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  position: fixed;
  bottom: 20px;
  left: 76px;
  z-index: 30;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  color: #0066ff;
  padding: 0;
  line-height: 2.2;
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  text-transform: uppercase;
}

.show-shortcuts {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.help-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  color: #0066ff;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: none;
}

.help-button:hover, .help-button:focus {
  background: #0066ff;
  color: #fff;
  transition: all 0.3s ease;
}

.shortcuts-info h3 {
  margin: 0 0 10px 0;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  font-weight: normal;
}

.shortcuts-info div {
  display: flex;
  align-items: center;
  margin: 0;
  white-space: nowrap;
}

.shortcuts-info span.key {
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  background: rgba(0, 102, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
  border: 1px solid rgba(0, 102, 255, 0.2);
  text-transform: uppercase;
  min-width: 48px;
  text-align: center;
  display: inline-block;
}

.grid-toggle-button {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  color: #0066ff;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-toggle-button:hover {
  background: rgba(0, 102, 255, 0.2);
}

.action-control {
  display: flex;
  align-items: center;
  gap: 0;
  height: 40px;
  width: 120px;
  margin: 0;
  padding: 0;
}

.action-button {
  border-radius: 0;
  height: 40px;
  min-width: 40px;
  font-size: 14px;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  color: #0066ff;
  cursor: pointer;
  font-family: 'G2-Erika-Mono', monospace;
  transition: all 0.3s ease;
  border-left: none;
  border-right: none;
}

.action-button:first-child {
  border-radius: 4px 0 0 4px;
  border-left: 1px solid rgba(0, 102, 255, 0.2);
  border-right: none;
}
.action-button:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
  border-right: 1px solid rgba(0, 102, 255, 0.2);
}
.action-button:nth-child(2) {
  border-left: 1px solid rgba(0, 102, 255, 0.2);
  border-right: 1px solid rgba(0, 102, 255, 0.2);
}

.action-button:hover, .action-button:focus {
  background: #0066ff;
  color: #fff;
  z-index: 1;
}

.style-control {
  display: flex;
  justify-content: center;
  gap: 0;
}

.style-button {
  width: 60px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(0, 102, 255, 0.2);
  background: rgba(0, 102, 255, 0.1);
  color: #0066ff;
  cursor: pointer;
  font-size: 20px;
  line-height: 40px;
  text-align: center;
  transition: all 0.3s ease;
}

.style-button:first-child {
  border-radius: 4px 0 0 4px;
  border-right: none;
}

.style-button:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

.style-button:hover, .style-button:focus {
  background: #0066ff;
  color: #fff;
  z-index: 1;
}

.style-button.active, .style-button.active:hover, .style-button.active:focus {
  background: #0066ff !important;
  color: #fff !important;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,102,255,0.10);
}

/* Add dark mode styles */
body.dark-mode {
  background: #1a1a1a;
}

body.dark-mode .control-button,
body.dark-mode .action-button,
body.dark-mode .size-button,
body.dark-mode .style-button {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

body.dark-mode .control-button:hover,
body.dark-mode .action-button:hover,
body.dark-mode .size-button:hover,
body.dark-mode .style-button:hover {
  background: #fff;
  color: #1a1a1a;
}

body.dark-mode .control-button.active,
body.dark-mode .action-button.active,
body.dark-mode .size-button.active,
body.dark-mode .style-button.active {
  background: #fff;
  color: #1a1a1a;
}

body.dark-mode .console-panel {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

body.dark-mode .connection-info {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .help-button {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

body.dark-mode .help-button:hover {
  background: #fff;
  color: #1a1a1a;
}

body.dark-mode .shortcuts-info {
  color: #fff;
}

body.dark-mode .shortcuts-info .key {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .export-button {
  background: #fff;
  color: #1a1a1a;
}

body.dark-mode .export-button:hover {
  background: rgba(255, 255, 255, 0.9);
}

body.dark-mode .size-button.active,
body.dark-mode .size-button.active:hover,
body.dark-mode .size-button.active:focus,
body.dark-mode .style-button.active,
body.dark-mode .style-button.active:hover,
body.dark-mode .style-button.active:focus {
  background: #fff !important;
  color: #1a1a1a !important;
  border: 1.5px solid #fff !important;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

body.dark-mode .color-button {
  border: 2px solid #1a1a1a;
}
body.dark-mode .color-button:hover,
body.dark-mode .color-button.active {
  border: 2px solid #fff;
}

.letter-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0;
  margin-top: 0;
  width: 120px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.letter-selector.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.letter-button {
  width: 36px;
  height: 36px;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  color: #0066ff;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.letter-button:hover {
  background: #0066ff;
  color: #fff;
}

.letter-button.active {
  background: #0066ff;
  color: #fff;
}

.letter-button::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(0, 102, 255, 0.2);
  transition: all 0.3s ease;
  opacity: 0;
}

.letter-button.has-drawing::after {
  background: #0066ff;
  opacity: 1;
}

.letter-button:hover::after {
  transform: scale(1.2);
}

.letter-button.active::after {
  background: #fff;
}

/* Dark mode styles */
body.dark-mode .letter-button {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

body.dark-mode .letter-button:hover,
body.dark-mode .letter-button.active {
  background: #fff;
  color: #1a1a1a;
}

body.dark-mode .letter-button::after {
  background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .letter-button.has-drawing::after {
  background: #fff;
}

body.dark-mode .letter-button.active::after {
  background: #1a1a1a;
}

body.dark-mode .text-preview {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

body.dark-mode .text-preview::placeholder {
  color: #fff;
  opacity: 0.7;
}

body.dark-mode .text-preview:focus {
  border-color: #fff;
}

.text-preview {
  width: 120px;
  height: 36px;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.2);
  color: #0066ff;
  border-radius: 4px;
  font-family: 'G2-Erika-Mono', monospace;
  font-size: 14px;
  padding: 0 8px;
  margin: 0;
  box-sizing: border-box;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.text-preview.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.text-preview::placeholder {
  color: #0066ff;
  opacity: 0.7;
}

.text-preview:focus {
  outline: none;
  border: 1.5px solid #0066ff;
}

/* Prevent text selection */
* {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.shortcuts-info.no-animate {
  transition: none !important;
}
