/* Componentes V2: estrutura e interações adaptadas do editor Arcano. */
.ruby-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(290px, .8fr);
  gap: 18px;
  align-items: start;
  margin-top: 16px;
}
.ruby-builder-editor { min-width: 0; }
.ruby-builder-toolbar,
.ruby-container-head,
.ruby-block-head,
.ruby-builder-footer,
.ruby-modal-head,
.ruby-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ruby-builder-toolbar { padding: 14px 2px; }
.ruby-toolbar-copy { color: #d7b5ed; font-size: 10px; font-weight: 850; letter-spacing: 1.3px; }
.ruby-toolbar-hint { color: #ad9cb9; font-size: 11px; margin: 4px 0 0; }
.ruby-containers { display: grid; gap: 14px; padding-left: 16px; }
.ruby-container-card {
  position: relative;
  min-width: 0;
  padding: 16px;
  border: 1px solid #67517d;
  border-radius: 14px;
  background: linear-gradient(145deg, #2a213d, #1c182a);
  box-shadow: 0 12px 26px #0002;
}
.ruby-container-head { padding-bottom: 11px; border-bottom: 1px solid #544366; }
.ruby-container-head strong { color: #f0dcff; font-size: 13px; font-weight: 850; }
.ruby-container-settings,
.ruby-block-settings {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 13px;
  margin: 12px 0;
}
.ruby-color-label { display: flex; align-items: center; gap: 6px; color: #ceb6de; font-size: 10px; font-weight: 800; }
.ruby-color-label input { width: 34px; height: 30px; border: 1px solid #725a87; border-radius: 7px; background: #201b2b; cursor: pointer; }
.ruby-block-list { display: grid; gap: 9px; min-height: 26px; }
.ruby-block-list:empty { border: 1px dashed #68517b; border-radius: 9px; padding: 13px; background: #b58cff06; }
.ruby-block-card {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid #514064;
  border-radius: 10px;
  background: #1b1729;
}
.ruby-block-head { color: #ded0eb; font-size: 11px; }
.ruby-block-head strong { font-weight: 800; }
.ruby-icon-button {
  flex: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid #604b73;
  border-radius: 7px;
  background: #30253e;
  color: #e8d9f4;
  font-size: 0;
}
.ruby-icon-button::before,.ruby-icon-button::after { content:""; position:absolute; left:50%; top:50%; width:12px; height:2px; border-radius:2px; background:currentColor; transform:translate(-50%,-50%) rotate(45deg); }
.ruby-icon-button::after { transform:translate(-50%,-50%) rotate(-45deg); }
.ruby-icon-button:hover { border-color: #bc8edb; background: #513766; }
.ruby-drag-handle {
  position: absolute;
  left: -17px;
  z-index: 2;
  width: 18px;
  height: 47px;
  border: 1px solid #715586;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(90deg, #674a7d, #382944);
  box-shadow: -4px 3px 11px #0005;
  color: #e6cdf4;
  font-size: 17px;
  cursor: grab;
  touch-action: none;
}
.ruby-container-card > .ruby-drag-handle { top: 24px; }
.ruby-block-card > .ruby-drag-handle { top: 50%; transform: translateY(-50%); }
.ruby-drag-handle:hover { background: linear-gradient(90deg, #9570b4, #543b6d); }
.ruby-drag-handle:active { cursor: grabbing; }
.ruby-drag-source { opacity: .25; }
.ruby-drag-ghost { opacity: .92; transform: scale(1.025) rotate(.5deg); box-shadow: 0 26px 60px #000a; }
.ruby-block-label { display: block; color: #bfa9d3; font-size: 9px; font-weight: 850; letter-spacing: .7px; }
.ruby-block-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; }
.ruby-text-tools { display: grid; gap: 12px; width: 210px; margin-top: 9px; align-self: end; }
.ruby-marker-select { width: 100%; }
.ruby-marker-select .entity-trigger { min-height: 40px; border-color: #8a704c; background: #30251e; color: #f4dfb8; font-size: 11px; }
.ruby-marker-select .entity-trigger:hover,.ruby-marker-select .entity-trigger[aria-expanded="true"] { border-color: #d6a23f; background: #3b2b20; }
.ruby-marker-select .entity-menu { width: max(100%, 270px); right: 0; left: auto; border-color: #8a704c; background: #211a1b; }
.ruby-marker-select .entity-option { white-space: normal; }
.ruby-text-emoji-wrap { position: relative; width: 100%; }
.ruby-text-emoji-wrap .ruby-emoji-toggle { min-height: 40px; border-color: #75583a; }
.ruby-text-emoji-picker { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: min(330px, 80vw); box-shadow: 0 18px 40px #000a; }
.ruby-block-text {
  display: block;
  width: 100%;
  min-height: 68px;
  margin-top: 6px;
  padding: 9px;
  border: 1px solid #66517a;
  border-radius: 8px;
  outline: none;
  background: #120f1b;
  color: #f4eef8;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}
.ruby-block-text:focus { border-color: #b78ed8; box-shadow: 0 0 0 3px #9d70d733; }
.ruby-accessory-button,
.ruby-button-chip,
.ruby-add-button {
  border: 1px solid #6a547f;
  border-radius: 8px;
  background: #342945;
  color: #e8d9f4;
  padding: 9px 11px;
  font-size: 11px;
  font-weight: 750;
}
.ruby-accessory-button:hover,
.ruby-button-chip:hover,
.ruby-add-button:hover { border-color: #ae83da; background: #5b3d7b; }
.ruby-button-list { display: flex; flex-wrap: wrap; gap: 7px; }
.ruby-add-block { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 12px; }
.ruby-add-block span { width: 100%; color: #a993bd; font-size: 9px; font-weight: 850; letter-spacing: 1px; }
.ruby-add-block button {
  padding: 7px 9px;
  border: 1px solid #68517b;
  border-radius: 7px;
  background: #352945;
  color: #e8d9f4;
  font-size: 10px;
  font-weight: 750;
}
.ruby-add-block button:hover:not(:disabled) { border-color: #ae83da; background: #5b3d7b; }
.ruby-add-block button:disabled { opacity: .45; cursor: not-allowed; }
.ruby-builder-footer { padding-top: 17px; margin-top: 16px; border-top: 1px solid #ffffff20; }
.ruby-builder .panel-preview { top: 18px; }
.ruby-switch { display: inline-flex; align-items: center; gap: 8px; color: #dfd0e9; font-size: 11px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.ruby-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ruby-switch-track { position: relative; display: inline-block; flex: none; width: 32px; height: 19px; border: 1px solid #7c6a91; border-radius: 99px; background: #483d55; transition: background .2s, border-color .2s; }
.ruby-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #d8d0e0; transition: transform .2s; }
.ruby-switch input:checked + .ruby-switch-track { border-color: #c7a5f1; background: #9d70d7; }
.ruby-switch input:checked + .ruby-switch-track::after { transform: translateX(13px); background: #fff; }
.ruby-switch input:focus-visible + .ruby-switch-track { outline: 2px solid #f4d69c; outline-offset: 3px; }
.ruby-modal-backdrop { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 18px; background: #080611bd; backdrop-filter: blur(5px); }
.ruby-modal { width: min(100%, 460px); max-height: min(88vh, 790px); overflow-y: auto; border: 1px solid #806497; border-radius: 16px; background: #221a30; box-shadow: 0 25px 80px #000b; color: #f5eafa; }
.ruby-modal-head { padding: 18px 20px; border-bottom: 1px solid #67517d; }
.ruby-modal-head h3 { margin: 0; font-size: 16px; }
.ruby-modal form { padding: 18px 20px 20px; }
.ruby-modal-fields { display: grid; gap: 13px; }
.ruby-modal-field { display: grid; gap: 6px; color: #bfa9d3; font-size: 10px; font-weight: 850; letter-spacing: .6px; }
.ruby-modal-field > input { width: 100%; min-height: 40px; border: 1px solid #6a547f; border-radius: 8px; background: #120f1b; color: #f4eef8; padding: 9px 11px; font-size: 12px; font-weight: 500; letter-spacing: 0; }
.ruby-modal-field > input:focus { outline: none; border-color: #bc8edb; }
.ruby-emoji-toggle { display:flex; align-items:center; gap:8px; width:100%; min-height:38px; padding:7px 10px; border:1px solid #82669a; border-radius:8px; background:#30243e; color:#f0dcff; text-align:left; font-size:11px; font-weight:750; }
.ruby-emoji-toggle:disabled { opacity:.55; cursor:not-allowed; }
.ruby-emoji-toggle img,.ruby-emoji-option img { width:24px; height:24px; flex:none; object-fit:contain; }
.ruby-emoji-picker { padding:9px; border:1px solid #715786; border-radius:9px; background:#171220; }
.ruby-emoji-picker[hidden] { display:none; }
.ruby-emoji-search { width:100%; min-height:35px; padding:7px 9px; border:1px solid #6a547f; border-radius:7px; background:#100c18; color:#f4eef8; font-size:12px; }
.ruby-emoji-clear { width:100%; margin-top:7px; padding:5px 7px; border:0; border-radius:6px; background:transparent; color:#c7adc9; text-align:left; font-size:10px; }
.ruby-emoji-clear:hover { background:#3a2a4c; color:#fff; }
.ruby-emoji-results { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; max-height:190px; margin-top:8px; overflow-y:auto; }
.ruby-emoji-option { display:flex; align-items:center; gap:7px; min-width:0; padding:5px; border:1px solid transparent; border-radius:7px; background:transparent; color:#e8d9f4; font-size:11px; text-align:left; }
.ruby-emoji-option:hover,.ruby-emoji-option:focus-visible { border-color:#8c6aa8; background:#3a2a4c; }
.ruby-emoji-option span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ruby-emoji-empty { grid-column:1/-1; margin:8px; color:#bfa9d3; font-size:11px; }
.ruby-emoji-help { color:#a996ba; font-size:10px; font-weight:500; letter-spacing:0; }
.ruby-modal-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid #67517d; }
.ruby-modal-link,.ruby-modal-remove { width: fit-content; border: 0; background: none; padding: 4px 0; color: #dabdf1; text-align: left; font-size: 11px; font-weight: 750; }
.ruby-modal-link:hover { color: #fff; text-decoration: underline; }
.ruby-modal-remove { color: #ffaaaa; }
.ruby-modal-remove:hover { color: #fff; text-decoration: underline; }
.preview-container { border-left: 4px solid #b58cff; border-radius: 5px; }
.preview-container.no-accent { border-left: 1px solid #414349; }
.preview-container hr.no-line { border-color: transparent; }
.preview-container hr.large { margin: 16px 0; }
.preview-markdown-line.heading-1 { color: #f7f7f8; font-size: 18px; font-weight: 800; line-height: 1.3; margin-bottom: 3px; }
.preview-markdown-line.heading-2 { color: #f7f7f8; font-size: 15px; font-weight: 800; line-height: 1.35; }
.preview-markdown-line.heading-3 { color: #f7f7f8; font-size: 13px; font-weight: 800; }
.preview-markdown-line.muted { color: #aeb2b9; font-size: 10px; }
.preview-markdown-line code { border-radius: 3px; background: #1d1f24; padding: 1px 4px; font-family: ui-monospace, Consolas, monospace; }
.preview-markdown-line strong { color: #f6f6f7; }
.preview-spoiler { position: relative; }
.preview-spoiler .preview-container { filter: blur(4px); }
.preview-spoiler > button { position: absolute; inset: 0; width: 100%; border: 0; border-radius: 6px; background: #20202588; color: #fff; font-size: 11px; font-weight: 800; }
.preview-spoiler.revealed .preview-container { filter: none; }
.preview-spoiler.revealed > button { display: none; }
/* Menus personalizados para todos os selects, mantendo o select nativo como valor. */
.entity-trigger { border-color: #6a547f; background: linear-gradient(145deg, #30263f, #211a30); color: #f3e8fa; font-weight: 700; box-shadow: inset 0 1px #ffffff12, 0 4px 12px #0002; }
.entity-trigger:hover,.entity-trigger[aria-expanded="true"] { border-color: #ad83d5; background: #3b2c50; }
.entity-trigger:focus-visible,.entity-option:focus-visible { outline-color: #d8afec; }
.entity-chip { border-color: #806497; background: #4c375f; color: #f3e8fa; }
.entity-chevron { color: #d6abea; transition: transform .18s; }
.entity-trigger[aria-expanded="true"] .entity-chevron { transform: rotate(180deg); }
.entity-menu { border-color: #806497; background: #21192f; }
.entity-option:hover,.entity-option.selected { background: #514066; }
.entity-option.selected .entity-check { border-color: #d6abea; color: #eac9fa; }
.entity-clear { width: 100%; margin-top: 6px; padding: 8px; border: 1px solid #6a547f; border-radius: 7px; background: #342945; color: #e8d9f4; font-size: 11px; font-weight: 750; }
.entity-clear:hover { background: #5b3d7b; }
.entity-native[aria-hidden="true"] { pointer-events: none; }
@media (max-width: 1120px) { .ruby-builder { grid-template-columns: 1fr; } .ruby-builder .panel-preview { position: static; } }
@media (max-width: 690px) { .ruby-container-card { padding: 12px; } .ruby-block-content { grid-template-columns: 1fr; } .ruby-builder-toolbar { align-items: flex-start; } .ruby-builder-footer { align-items: flex-start; flex-direction: column; } }
@media (max-width: 690px) { .ruby-text-tools { width: 100%; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } .ruby-marker-select .entity-menu { width: 100%; } }
/* Identidade GDI sobre a estrutura visual herdada do editor Ruby. */
.ruby-builder{--ruby-accent:#e5b557}.ruby-toolbar-copy,.ruby-container-head strong{color:#f9d891}.ruby-builder .button.gold,.ruby-modal .button.gold{background:linear-gradient(120deg,#f7d77d,#dba24b);border-color:#f7d77d;color:#24170b}.ruby-builder .button.gold:hover,.ruby-modal .button.gold:hover{background:#ffe29b}.ruby-modal-backdrop{z-index:50}.ruby-modal{background:#211d21;border-color:#a2783e}.ruby-emoji-toggle,.ruby-emoji-search{background:#211a20;border-color:#8b6c45}.ruby-emoji-option:hover,.ruby-emoji-option:focus-visible{background:#4b3829;border-color:#d2a957}
.ruby-container-card{background:linear-gradient(145deg,#28211d,#1b1a1d);border-color:#7d623d}.ruby-block-card{background:#211d20;border-color:#5c4a39}.ruby-container-head,.ruby-block-head{border-color:#6a5035}.ruby-block-text,.ruby-modal-field>input{background:#111014;border-color:#75583a;color:#f3ede1}.ruby-block-text:focus,.ruby-modal-field>input:focus{border-color:#e5b557;box-shadow:0 0 0 3px #e5b55722}.ruby-accessory-button,.ruby-button-chip,.ruby-add-button,.ruby-add-block button{background:#32261f;border-color:#78583b;color:#f5dfbd}.ruby-accessory-button:hover,.ruby-button-chip:hover,.ruby-add-button:hover,.ruby-add-block button:hover:not(:disabled){background:#4b3525;border-color:#d6a650}.ruby-drag-handle:hover{background:linear-gradient(90deg,#dba948,#6d4a20)}.ruby-switch input:checked+.ruby-switch-track{background:#d6a23f;border-color:#f1d186}.ruby-emoji-picker{background:#1b1719;border-color:#806238}
