/* Core Reset */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}

body, button, textarea, input {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  background-color: #121212;
  color: #e0e0e0;
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* App Container: Fills 80% of the screen (Desktop & Mobile) */
.app-container {
  display: flex;
  flex-direction: column;
  width: 85vw;
  height: 80vh;
  max-width: 1000px;
  background: #1a1a1a;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  color: #a0a0a0;
  margin-bottom: 10px;
  padding: 0 4px;
}

#liveMatch {
  color: #4caf50;
  font-weight: bold;
}

/* Large Textarea filling remaining vertical space */
#output {
  width: 100%;
  flex: 1; /* Automatically expands to take up ~50-60% of the app container */
  background: #242424;
  color: #fff;
  border: 1px solid #3d3d3d;
  border-radius: 12px;
  padding: 16px;
  font-size: 1.5rem;
  resize: none;
  outline: none;
  margin-bottom: 16px;
}

/* Script Selector Bar */
.script-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.script-selector button {
  flex: 1;
  padding: 14px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #ccc;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

.script-selector button.active {
  background: #0066cc;
  border-color: #0066cc;
  color: #fff;
}

/* Keyboard Wrapper */
.keyboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* STRICT 2-ROW GRID (5 keys in top row, 5 keys in bottom row) */
.key-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* Exactly 5 columns */
  grid-template-rows: repeat(2, auto);   /* Exactly 2 rows */
  gap: 10px;
  width: 100%;
}

/* Large Key Buttons */
.key-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 65px; /* Large touch/click height */
  background: #333336;
  border: 1px solid #48484a;
  border-radius: 10px;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.key-btn:active {
  background: #545458;
  transform: scale(0.97);
}

.key-btn .sub {
  font-size: 0.75rem;
  color: #8e8e93;
  font-weight: normal;
  margin-top: 2px;
}

/* Action Controls Row */
.action-grid {
  display: flex;
  gap: 10px;
}

.action-btn {
  height: 55px;
  background: #3a3a3c;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.action-btn.space {
  flex: 3;
  background: #007aff;
}

.action-btn:not(.space) {
  flex: 1;
}

.action-btn.danger {
  background: #ff3b30;
}

.action-btn:active {
  opacity: 0.8;
}