/* Runes — incantation keyboard + letter cipher + prompt forge */

#panel-runes.panel {
  padding: 0.75rem 1rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
  color: var(--text, #f0ebe3);
}

.ru-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ru-top h2 {
  margin: 0 0 0.35rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.75rem;
  letter-spacing: 0.06em;
  color: #e8d5a3;
}

.ru-hint {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted, #a89f90);
}

.ru-hint a {
  color: #c9a227;
}

.ru-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .ru-grid {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }
}

.ru-card {
  background: linear-gradient(160deg, rgba(18, 14, 22, 0.95), rgba(10, 12, 18, 0.98));
  border: 1px solid rgba(201, 162, 39, 0.28);
  border-radius: 12px;
  padding: 0.9rem 1rem 1.1rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ru-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9a227;
}

.ru-label {
  display: block;
  margin: 0.35rem 0 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted, #a89f90);
}

.ru-english,
.ru-runes,
.ru-prompt,
.ru-filler {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid rgba(245, 240, 232, 0.16);
  background: rgba(6, 8, 12, 0.9);
  color: #f5f0e8;
  font: inherit;
  padding: 0.55rem 0.65rem;
  resize: vertical;
}

.ru-english:focus,
.ru-runes:focus,
.ru-prompt:focus,
.ru-filler:focus {
  outline: none;
  border-color: rgba(201, 162, 39, 0.65);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.18);
}

.ru-runes {
  font-size: 1.35rem;
  line-height: 1.55;
  letter-spacing: 0.12em;
  min-height: 5.5rem;
  font-family: "Segoe UI Historic", "Noto Sans Runic", "Segoe UI Symbol", serif;
}

.ru-english {
  min-height: 4.5rem;
  font-size: 1rem;
  line-height: 1.45;
}

.ru-prompt {
  min-height: 9rem;
  font-size: 0.86rem;
  line-height: 1.45;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.ru-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.ru-actions .btn-secondary,
.ru-actions .btn-cast {
  margin: 0;
}

.ru-kb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.ru-mode {
  display: inline-flex;
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.ru-mode button {
  border: 0;
  background: transparent;
  color: var(--text-muted, #a89f90);
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.ru-mode button.active {
  background: rgba(201, 162, 39, 0.22);
  color: #f0e6c8;
}

.ru-kb {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.65rem, 1fr));
  gap: 0.35rem;
  max-height: 22rem;
  overflow: auto;
  padding: 0.25rem;
  scrollbar-width: thin;
}

.ru-key {
  appearance: none;
  position: relative;
  border: 1px solid rgba(245, 240, 232, 0.14);
  border-radius: 8px;
  background: rgba(22, 18, 28, 0.95);
  color: #f3ead4;
  font-size: 1.35rem;
  line-height: 1;
  min-height: 3.15rem;
  cursor: pointer;
  font-family: "Segoe UI Historic", "Noto Sans Runic", "Segoe UI Symbol", serif;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.ru-key-seal {
  position: absolute;
  top: 0.12rem;
  right: 0.18rem;
  font-size: 0.55rem;
  line-height: 1;
  opacity: 0.72;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", sans-serif;
}

.ru-key-glyph {
  display: block;
  transform: rotate(var(--ru-tilt, 0deg));
  font-size: 1.32rem;
}

.ru-key:hover,
.ru-key:focus-visible {
  border-color: rgba(201, 162, 39, 0.7);
  background: rgba(40, 32, 18, 0.95);
  outline: none;
  transform: translateY(-1px);
}

.ru-key.mapped {
  outline: 1px solid rgba(100, 200, 150, 0.55);
  outline-offset: -1px;
}

.ru-key.selected {
  border-color: #c9a227;
  background: rgba(80, 60, 20, 0.55);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.25);
}

.ru-key-meta {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: rgba(230, 220, 190, 0.55);
  font-family: "DM Sans", system-ui, sans-serif;
  margin-top: 0.15rem;
  text-transform: uppercase;
}

.ru-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.4rem;
}

.ru-map-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem;
  border-radius: 8px;
  border: 1px solid rgba(245, 240, 232, 0.1);
  background: rgba(8, 10, 14, 0.7);
}

.ru-map-cell label {
  font-size: 0.72rem;
  color: var(--text-muted, #a89f90);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ru-map-cell input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  font-size: 1.25rem;
  border: 1px solid rgba(245, 240, 232, 0.14);
  border-radius: 6px;
  background: rgba(4, 6, 10, 0.9);
  color: #f3ead4;
  font-family: "Segoe UI Historic", "Noto Sans Runic", serif;
  padding: 0.25rem;
}

.ru-map-cell input:focus {
  outline: none;
  border-color: #c9a227;
}

.ru-map-section-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9a227;
  margin: 0.35rem 0 0.15rem;
}

.ru-map-cell-multi .ru-map-multi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.ru-map-multi-rune {
  font-size: 1.25rem;
  font-family: "Segoe UI Historic", "Noto Sans Runic", serif;
}

.ru-assign-hud {
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: rgba(60, 45, 15, 0.35);
  font-size: 0.82rem;
  color: #f0e6c8;
  font-family: ui-monospace, Consolas, monospace;
}

.ru-new-block-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 0.65rem;
}

.ru-new-block-row .ru-label {
  margin: 0;
  min-width: 6rem;
}

.ru-new-block-row .ru-filler {
  margin-top: 0.2rem;
  min-width: 5rem;
}

.ru-status {
  margin: 0.4rem 0 0;
  min-height: 1.2em;
  font-size: 0.8rem;
  color: #b8a88a;
}

.ru-status.ok {
  color: #8fd4a8;
}

.ru-status.err {
  color: #e8a090;
}

.ru-preview {
  margin-top: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px dashed rgba(201, 162, 39, 0.35);
  background: rgba(12, 10, 8, 0.65);
  font-size: 1.2rem;
  letter-spacing: 0.14em;
  line-height: 1.6;
  min-height: 2.5rem;
  word-break: break-word;
  font-family: "Segoe UI Historic", "Noto Sans Runic", serif;
  color: #f0e6c8;
}

.ru-preview-empty {
  opacity: 0.45;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
  font-family: "DM Sans", system-ui, sans-serif;
}

.ru-source {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: rgba(180, 170, 150, 0.7);
}

.ru-assign-hint {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: #c9b896;
}

body.ru-tab-active #panel-runes {
  display: block;
}

.ru-card-wide {
  grid-column: 1 / -1;
}

.ru-im-lang {
  margin: 0.4rem 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: 8px;
  background: rgba(8, 10, 14, 0.7);
  font-size: 0.78rem;
  line-height: 1.45;
  color: #d4c4a8;
}

.ru-im-alpha {
  display: block;
  margin-top: 0.35rem;
  font-family: "Segoe UI Historic", "Noto Sans Runic", serif;
  letter-spacing: 0.04em;
  color: #f0e6c8;
  word-break: break-word;
}

.ru-im-log {
  max-height: 18rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  padding: 0.35rem;
}

.ru-im-msg {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(245, 240, 232, 0.1);
}

.ru-im-me {
  background: rgba(40, 32, 18, 0.55);
  margin-left: 1.5rem;
}

.ru-im-them {
  background: rgba(12, 22, 28, 0.7);
  margin-right: 1.5rem;
}

.ru-im-who {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9a227;
  margin-bottom: 0.2rem;
}

.ru-im-plain {
  font-size: 0.92rem;
  color: #f5f0e8;
  margin-bottom: 0.25rem;
}

.ru-im-runes {
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  color: #e8d5a3;
  font-family: "Segoe UI Historic", "Noto Sans Runic", serif;
}

.ru-spell-slots {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

@media (min-width: 720px) {
  .ru-spell-slots {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ru-spell-slot {
  border: 1px solid rgba(245, 240, 232, 0.12);
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(6, 8, 12, 0.75);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ru-spell-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9a227;
}

.ru-spell-slot select,
.ru-spell-slot input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid rgba(245, 240, 232, 0.14);
  background: rgba(4, 6, 10, 0.95);
  color: #f0ebe3;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.4rem;
}

.ru-spell-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #0a0908;
  border: 1px solid rgba(245, 240, 232, 0.1);
  display: none;
}

.ru-spell-thumb.show {
  display: block;
}

.ru-spell-title {
  font-size: 0.78rem;
  color: rgba(230, 220, 200, 0.85);
  min-height: 1.2em;
  line-height: 1.3;
}

.ru-gen-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0.5rem 0 0.35rem;
  align-items: flex-end;
}

.ru-aspect-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted, #a89f90);
}

.ru-select {
  min-width: 6.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(245, 240, 232, 0.16);
  background: rgba(6, 8, 12, 0.95);
  color: #f0ebe3;
  font: inherit;
}

.ru-preview-media {
  margin-top: 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 39, 0.28);
  background: #0a0908;
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.ru-preview-img,
.ru-preview-video {
  display: block;
  max-width: 100%;
  max-height: 28rem;
  width: auto;
  height: auto;
  margin: 0 auto;
}

.ru-preview-empty-media {
  margin: 1rem;
  font-size: 0.85rem;
  color: rgba(180, 170, 150, 0.65);
  text-align: center;
}

.ru-actions .btn-cast:disabled,
.ru-actions .btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
