* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #1a1a1a;
  color: #e0e0e0;
  font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
  display: flex;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 420px;
  padding: 24px 14px 18px;
}

h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
  text-align: center;
  letter-spacing: -0.01em;
}

.panel {
  background: #242424;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.panel h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  color: #888;
}

.row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.row label {
  font-size: 9px;
  color: #777;
  display: block;
  margin-bottom: 1px;
}

.row .coord {
  width: 65px;
}

.row input,
.json-box textarea {
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  color: #e0e0e0;
  border-radius: 4px;
  font-size: 12px;
}

.row input {
  padding: 5px 6px;
  width: 100%;
}

.row input:focus {
  outline: none;
  border-color: #666;
}

.sprite-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 5px 7px;
  flex: 1;
}

.sprite-picker:hover {
  border-color: #555;
}

.sprite-picker img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}

.sprite-picker span {
  font-size: 12px;
  color: #ccc;
}

.remove-row {
  background: none;
  border: none;
  color: #a55;
  font-size: 14px;
  cursor: pointer;
  padding: 0 3px;
  line-height: 1;
}

.btn {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #e0e0e0;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}

.btn:hover {
  background: #333;
}

#addRow {
  width: 100%;
  margin-top: 2px;
}

.btn-main {
  display: block;
  width: 100%;
  background: #3a5a8a;
  border-color: #4a6a9a;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px;
}

.btn-main:hover {
  background: #46699e;
}

.warning-banner {
  margin-top: 8px;
  padding: 7px 9px;
  background: #4a3a1a;
  border: 1px solid #7a5a2a;
  border-radius: 5px;
  color: #e0c080;
  font-size: 11px;
  text-align: left;
}

.result-panel {
  text-align: center;
}

.readout {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 2px 0 8px;
}

.readout-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.readout-label {
  font-size: 9px;
  color: #888;
  margin-bottom: 1px;
}

.readout-value {
  font-size: 18px;
  font-weight: 600;
  color: #ffd24a;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #333;
  font-size: 12px;
  text-align: left;
}

.result-row:last-of-type {
  border-bottom: none;
}

.result-row span:last-child {
  font-family: monospace;
}

.sprite-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 14px;
}

.sprite-modal.open {
  display: flex;
}

.sprite-modal-inner {
  background: #242424;
  border-radius: 6px;
  padding: 14px;
  max-width: 320px;
  width: 100%;
}

.sprite-modal-inner h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 12px;
  text-align: center;
}

.compass-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.compass-arrow {
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  color: #e0e0e0;
  width: 34px;
  height: 34px;
  border-radius: 5px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.compass-arrow:hover {
  background: #2a2a2a;
  border-color: #666;
}

.compass-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.compass-display img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.compass-display span {
  font-size: 12px;
  color: #ccc;
  font-family: monospace;
}

.sprite-modal-inner .btn {
  width: 100%;
  margin-top: 6px;
}

.json-box summary {
  font-size: 10px;
  color: #888;
  cursor: pointer;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #333;
}

.json-box[open] summary {
  margin-bottom: 6px;
}

.json-box textarea {
  width: 100%;
  padding: 5px;
  font-family: monospace;
  resize: vertical;
  margin-bottom: 6px;
}

.json-actions {
  display: flex;
  gap: 6px;
}

.json-actions .btn {
  flex: 1;
}

footer {
  text-align: center;
  color: #555;
  font-size: 10px;
  margin-top: 12px;
}

footer a {
  color: #aaa;
  text-decoration: underline;
  transition: color 0.15s ease;
}

footer a:hover {
  color: #fff;
}
