/* Design tokens */
:root {
  --white: #fff;
  --black: #3b3b3b;
  --light-grey: #e4e4e4;
}

/* Global reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
  font-size: 0.8rem;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Utility: visually hide an element while keeping it focusable/functional */
.visually-hidden {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Toolbar: left tool group + centered font-mode group */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  flex-shrink: 0;
}

.toolbar__group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar__group--left {
  flex: 1;
}

.toolbar__separator {
  width: 1px;
  height: 1.5rem;
  background: var(--black);
  margin: 0 0.5rem;
}

.toolbar__file-input {
  display: none;
}

.toolbar__glyph-keys {
  display: none;
}

/* Button: shared style for all toolbar and dialog buttons */
.btn {
  border: 1px solid var(--black);
  background-color: var(--white);
  padding: 0.3rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  text-transform: uppercase;
}

.btn:hover {
  background-color: var(--light-grey);
}

.btn:active {
  background: var(--black);
  color: var(--white);
}

.btn--active {
  background: var(--black);
  color: var(--white);
}

/* Sketch: p5.js canvas mount */
.sketch {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.sketch canvas {
  display: block !important;
}

.sketch__tri-count {
  position: fixed;
  bottom: 14px;
  right: 20px;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--black);
  text-transform: uppercase;
  pointer-events: none;
}

/* Dialog: shared modal used for glyph assignment and overwrite confirmation */
.dialog {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.dialog--visible {
  display: flex;
}

.dialog__panel {
  border: 1px solid var(--black);
  padding: 28px 44px;
  text-align: center;
  background: var(--white);
}

.dialog__label {
  font-size: 8px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--black);
  margin-bottom: 18px;
}

.dialog__input {
  font-family: Helvetica, sans-serif;
  font-size: 48px;
  width: 72px;
  text-align: center;
  border: none;
  outline: none;
  color: var(--black);
  background: transparent;
}

.dialog__hint {
  margin-top: 14px;
  font-size: 7px;
  color: var(--black);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.dialog__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}
