/* Minimalist Monochrome Design Tokens */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-fast: 0.15s ease;
  --transition-slow: 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-bounce: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: default;
}

body {
  background-color: #000000;
  color: #ffffff;
  font-family: var(--font-sans);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fullscreen Screen System */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 20;
}

/* Setup Screen */
.setup-container {
  width: 90%;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding: 2.5rem 0;
  margin: auto;
}

.setup-title {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.setup-subtitle {
  font-size: 0.8rem;
  color: #8e8e93;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: -1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.input-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: #8e8e93;
  letter-spacing: 0.05em;
}

.input-label a {
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.input-label a:hover {
  color: #ffffff;
}

.cipher-info {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: #8e8e93;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: -1rem;
}

.cipher-info a {
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.cipher-info a:hover {
  color: #ffffff;
}

#message-input, #shift-input {
  width: 100%;
  height: 46px;
  background-color: transparent;
  border: 1px solid #2c2c2e;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  transition: border-color var(--transition-fast) ease;
}

#message-input:focus, #shift-input:focus {
  border-color: #ffffff;
}

/* Buttons */
.btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border: 1px solid #2c2c2e;
  background-color: transparent;
  color: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-height: 44px;
  touch-action: manipulation;
}

.btn * {
  cursor: pointer;
}

.btn:hover {
  background-color: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

/* Puzzle Screen (Gameplay Layout) */
#puzzle-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0 1.5rem 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.svg-container {
  flex: 1 1 auto;
  width: 90vw;
  height: auto;
  aspect-ratio: 1 / 1;
  max-width: 500px;
  max-height: 500px;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto;
  touch-action: none;
}

#puzzle-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Interactive SVG Node classes */
.node-group {
  transform-origin: 300px 300px;
}

.node-group.spinning {
  transition: transform var(--transition-bounce);
}

.node-wrapper {
  cursor: pointer;
  touch-action: manipulation;
}

.node-touch-target {
  fill: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

/* Letter Circles */
.node-circle {
  fill: #000000;
  stroke: #ffffff;
  stroke-width: 1.5;
  transition: fill var(--transition-fast), stroke var(--transition-fast), stroke-width var(--transition-fast);
}

.node-wrapper:hover .node-circle {
  stroke-width: 2.25;
}

/* Correct Fills */
.node-group.solved-node .node-circle {
  fill: #ffffff !important;
  stroke: none !important;
}

/* Letter Texts */
.node-text {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 18px;
  fill: #ffffff;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  transition: fill var(--transition-fast), font-weight var(--transition-fast);
}

.node-group.solved-node .node-text {
  fill: #000000 !important;
  font-weight: 700 !important;
}

/* Selected outer dashed ring */
.node-highlight {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.node-wrapper.selected-node .node-highlight {
  opacity: 1;
}

/* ESC Hint in Corner */
.esc-hint {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #444444;
  letter-spacing: 0.1em;
  opacity: 0.7;
  pointer-events: none;
}

/* Victory Screen */
.victory-container {
  width: 90%;
  max-width: 480px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.victory-title {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.victory-message {
  font-size: 0.85rem;
  color: #8e8e93;
  margin-top: -1.5rem;
}

.summary-box {
  background-color: #0a0a0a;
  border: 1px solid #2c2c2e;
  padding: 1.5rem;
}

.summary-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #8e8e93;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-text {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  word-break: break-all;
}

/* Intro Animation Helpers */
.node-group.hidden-node {
  opacity: 0 !important;
  pointer-events: none !important;
}

.node-group.intro-solid-node {
  opacity: 1 !important;
  pointer-events: none !important;
}

.node-group.intro-solid-node .node-circle {
  fill: #ffffff !important;
  stroke: none !important;
}

.node-group.intro-solid-node .node-text {
  opacity: 0 !important;
}

/* Typing decoder styles */
.decoder-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 90%;
  max-width: 500px;
  margin: 1.5rem auto 1rem auto;
  flex-shrink: 0;
}

.typing-box {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  color: #ffffff;
  text-align: center;
  min-height: 2.5rem;
  text-transform: uppercase;
  font-weight: 700;
  word-break: break-all;
  flex-grow: 1;
}

.btn-shift {
  background: none;
  border: 1px solid #2c2c2e;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.1s active;
  flex-shrink: 0;
  touch-action: manipulation;
}

.btn-shift:hover {
  opacity: 1;
  border-color: #ffffff;
}

.btn-shift:active {
  transform: scale(0.9);
}



/* Typing Highlight animation overlay */
.node-group.typing-highlight {
  z-index: 50;
}

.node-group.typing-highlight .node-circle {
  fill: #ffffff !important;
  stroke: #ffffff !important;
  transform: scale(1.25) !important;
  transition: transform 0.15s ease, fill 0.15s ease;
}

.node-group.typing-highlight .node-text {
  fill: #000000 !important;
  font-weight: 700 !important;
}

/* Center Key Text Style */
.center-key-text {
  fill: #ffffff;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Clean number inputs to match monochrome textboxes */
input[type="number"] {
  -appearance: textfield;
  -moz-appearance: textfield;
  text-align: center;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Puzzle Header and Navigation */
.puzzle-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  box-sizing: border-box;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  gap: 0.5rem;
}

.btn-give-up, .btn-new-puzzle, .btn-share {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  border: 1px solid #2c2c2e;
  background-color: transparent;
  color: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-height: 32px;
  padding: 0.4rem 1.2rem;
  opacity: 0.55;
  touch-action: manipulation;
}

.btn-give-up:hover, .btn-new-puzzle:hover, .btn-share:hover {
  opacity: 1;
  border-color: #ffffff;
  background-color: #ffffff;
  color: #000000;
}

