/* Styles for the codes drawer (js/tools/codes.js) and the dev extras (js/tools/devextra.js).
   Uses the tokens in style.css. */

.codes-val { font-family: var(--mono); font-size: .85rem; color: var(--ink-3); }
.codes-val.over { color: var(--bad); font-weight: 700; }

/* Morse */
.morse-play { display: flex; align-items: center; gap: 18px; min-height: 84px; }
.morse-lamp {
  width: 72px; height: 72px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--panel-2), var(--bg-2));
  border: 2px solid var(--line); transition: background .03s, box-shadow .03s;
}
.morse-lamp.on {
  background: radial-gradient(circle at 35% 35%, #fff6d8, var(--g-codes) 70%);
  box-shadow: 0 0 28px 6px color-mix(in srgb, var(--g-codes) 60%, transparent);
  border-color: var(--g-codes);
}
.morse-now { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; color: var(--ink); white-space: pre; min-width: 0; overflow: hidden; }
.morse-key {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; min-height: 150px; border-radius: 22px; border: 2px dashed var(--line);
  background: var(--bg-2); color: var(--ink); font: inherit; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.morse-key strong { font-size: 1.5rem; }
.morse-key span { color: var(--ink-3); font-size: .9rem; }
.morse-key.on { background: color-mix(in srgb, var(--g-codes) 30%, var(--bg-2)); border-style: solid; border-color: var(--g-codes); }
.morse-tapped { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .08em; word-break: break-all; min-height: 1.6em; color: var(--ink-2); }
.morse-taptext { min-height: 1.5em; word-break: break-word; }
.morse-chart, .nato-chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.nato-chart { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.morse-chart div, .nato-chart div { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: var(--bg-2); }
.morse-chart b, .nato-chart b { min-width: 1.4em; color: var(--g-codes); }
.morse-chart span { white-space: nowrap; letter-spacing: .06em; font-family: var(--mono); }

/* Braille */
.input.braille-text { font-family: "Apple Braille", "Segoe UI Symbol", "DejaVu Sans", system-ui, sans-serif; font-size: 2rem; line-height: 1.4; letter-spacing: .05em; }
.bcells { display: flex; flex-wrap: wrap; gap: 8px; }
.bcells:empty { display: none; }
.bbreak { flex-basis: 100%; height: 0; }
.bcell { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 6px 4px; border-radius: 8px; background: var(--bg-2); }
.bcell span { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); }
.bdots { display: grid; grid-template-columns: repeat(2, 10px); grid-template-rows: repeat(3, 10px); gap: 4px; }
.bdots i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); }
.bdots i.on { background: var(--ink); border-color: var(--ink); }
.braille-big { display: none; }
@media print {
  body.codes-printing * { visibility: hidden !important; }
  body.codes-printing .braille-big, body.codes-printing .braille-big * { visibility: visible !important; }
  body.codes-printing .braille-big {
    display: block; position: absolute; left: 0; top: 0; width: 100%;
    font-size: 64pt; line-height: 1.3; color: #000; background: #fff; white-space: pre-wrap; word-break: break-all;
  }
}

/* Cipher cracker */
.crack-list { display: flex; flex-direction: column; gap: 8px; }
.crack-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg-2); min-width: 0; }
.crack-row.top { border-color: var(--g-codes); }
.crack-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.crack-score { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); }
.crack-btns { margin-left: auto; display: flex; gap: 6px; }
.crack-text { font-family: var(--mono); font-size: .92rem; word-break: break-word; white-space: pre-wrap; }
.crack-vig:empty { display: none; }
.ioc-bars { display: flex; align-items: flex-end; gap: 4px; height: 92px; overflow-x: auto; }
.ioc-bars div { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1 0 16px; }
.ioc-bars i { display: block; width: 100%; background: var(--line); border-radius: 3px 3px 0 0; }
.ioc-bars i.hi { background: var(--g-codes); }
.ioc-bars span { font-size: .7rem; color: var(--ink-3); font-family: var(--mono); }

/* Barcode */
.barcode-preview { background: repeating-conic-gradient(var(--bg-2) 0 25%, var(--panel) 0 50%) 0 0 / 16px 16px; border-radius: 10px; padding: 12px; overflow: auto; }
.barcode-canvas { display: block; margin: 0 auto; max-width: 100%; height: auto; image-rendering: pixelated; }
.barcode-canvas.dim { opacity: .2; }

/* Meta tags */
.meta-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.meta-card { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 30px 14px 14px; background: #fff; color: #202124; font-family: Arial, Helvetica, sans-serif; overflow: hidden; min-width: 0; }
.meta-label { position: absolute; top: 6px; left: 10px; font: 600 .72rem var(--font); color: #8a7b6c; text-transform: uppercase; letter-spacing: .05em; }
.tw-resolved .meta-label { position: static; display: block; margin-bottom: 4px; }
.meta-noimg { overflow: hidden; word-break: break-all; text-align: center; display: flex; align-items: center; justify-content: center; background: #e9e3da; color: #8a7b6c; font: .8rem var(--mono); }
.g-site { display: flex; align-items: center; gap: 10px; }
.g-fav { width: 26px; height: 26px; border-radius: 50%; background: #f1f3f4; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex: none; }
.g-name { font-size: 14px; }
.g-url { font-size: 12px; color: #4d5156; word-break: break-all; }
.g-title { color: #1a0dab; font-size: 20px; line-height: 1.3; margin: 6px 0 2px; }
.g-desc { font-size: 14px; line-height: 1.58; color: #4d5156; }
.meta-card.x { background: #fff; color: #0f1419; }
.x-large { position: relative; }
.x-large .x-img { width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; border-radius: 16px; display: flex; }
.x-domain { position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.x-from { font-size: 13px; color: #536471; margin-top: 4px; }
.x-small { display: flex; border: 1px solid #cfd9de; border-radius: 16px; overflow: hidden; }
.x-small .x-img { width: 110px; height: 110px; object-fit: cover; flex: none; }
.x-small > div:last-child { padding: 10px 12px; min-width: 0; font-size: 14px; }
.x-dom, .x-desc { color: #536471; }
.fb { padding: 30px 0 0; background: #fff; }
.fb .meta-label { left: 14px; }
.fb-img { width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; display: flex; }
.fb-body { background: #f0f2f5; padding: 10px 12px; }
.fb-dom { font-size: 12px; color: #65676b; }
.fb-title { font-weight: 700; font-size: 16px; color: #050505; margin: 2px 0; }
.fb-desc { font-size: 14px; color: #65676b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-card.wa { background: #efe7de; }
.wa-bubble { background: #d9fdd3; border-radius: 10px; padding: 4px; max-width: 340px; margin-left: auto; color: #111b21; }
.wa-link { display: flex; gap: 8px; background: rgba(0, 0, 0, .05); border-radius: 8px; overflow: hidden; }
.wa-img { width: 84px; height: 84px; object-fit: cover; flex: none; }
.wa-link > div { padding: 6px 8px 6px 0; min-width: 0; font-size: 13px; }
.wa-title { font-weight: 600; }
.wa-desc, .wa-dom { color: #667781; font-size: 12px; }
.wa-url { padding: 6px 6px 2px; font-size: 13px; color: #027eb5; word-break: break-all; }
.tips li.bad { color: var(--bad); }
.tips li.good { color: var(--good); }

/* Request builder */
.req-line { display: flex; gap: 8px; }
.req-line select { flex: 0 0 auto; width: auto; font-weight: 700; }
.req-line .req-url { flex: 1; min-width: 0; }
.kv-table { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.kv-rows { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.kv-rows:empty { display: none; }
.kv-row { display: flex; gap: 6px; align-items: center; width: 100%; }
.kv-row .kv-in { flex: 1 1 0; min-width: 0; }

/* Tailwind */
.tw-list { display: flex; flex-direction: column; gap: 14px; }
.tw-group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tw-group h3 { margin: 0 0 8px; }
.tw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tw-row:last-child { border-bottom: 0; }
.tw-class { font: 600 .92rem var(--mono); color: var(--g-codes); background: none; border: 0; padding: 0; cursor: copy; text-align: left; min-width: 11em; }
.tw-css { flex: 1 1 260px; font-family: var(--mono); font-size: .84rem; color: var(--ink-2); word-break: break-word; }
.tw-hint { font-size: .8rem; color: var(--ink-3); }
.tw-row .btn { margin-left: auto; }
.tw-resolved { border: 1px solid var(--g-codes); border-radius: 10px; padding: 8px 12px; }
.tw-hit:empty { display: none; }

@media (max-width: 520px) {
  .morse-play { gap: 12px; }
  .morse-lamp { width: 56px; height: 56px; }
  .morse-now { font-size: 1.2rem; }
  .tw-class { min-width: 0; }
  .crack-btns { margin-left: 0; }
}
