.fb-shell {
  --fb-deep: #060a16;
  --fb-ink: #e8f2ff;
  --fb-dim: #93a9ca;
  --fb-edge: rgba(120, 190, 255, 0.22);
  --fb-card: linear-gradient(165deg, rgba(20, 34, 64, 0.94), rgba(9, 16, 34, 0.94));
  box-sizing: border-box;
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin: 0 auto;
  padding: 0 14px 20px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.fb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.fb-statline,
.fb-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.fb-stat {
  min-width: 0;
  padding: 7px 11px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(20, 30, 60, 0.08);
}

.fb-stat span {
  display: block;
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fb-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.fb-actions {
  flex: 0 0 auto;
}

.fb-btn,
.fb-close,
.fb-holdbtn,
.fb-pad {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--cg-line);
  border-radius: 11px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20, 30, 60, 0.08);
  transition: transform 110ms ease, border-color 110ms ease, background 110ms ease;
}

.fb-btn:hover,
.fb-close:hover,
.fb-holdbtn:hover,
.fb-pad:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 216, 239, 0.5);
}

.fb-btn:focus-visible,
.fb-close:focus-visible,
.fb-holdbtn:focus-visible,
.fb-pad:focus-visible,
.fb-seg-btn:focus-visible,
.fb-canvas:focus-visible {
  outline: 3px solid rgba(37, 216, 239, 0.45);
  outline-offset: 3px;
}

.fb-icon-btn {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.fb-icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fb-stage {
  display: grid;
  grid-template-columns: auto 136px;
  justify-content: center;
  align-items: start;
  gap: 16px;
}

.fb-board {
  position: relative;
  width: calc(min(100dvh - 240px, 780px) / 2);
  min-width: 200px;
  max-width: 100%;
  aspect-ratio: 1 / 2;
  margin: 0 auto;
  border: 1px solid var(--fb-edge);
  border-radius: 14px;
  overflow: hidden;
  background: var(--fb-deep);
  box-shadow: 0 26px 60px rgba(6, 12, 30, 0.42), 0 0 0 1px rgba(120, 190, 255, 0.08) inset;
}

.fb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}

.fb-rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.fb-panel,
.fb-card,
.fb-flags {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--fb-edge);
  border-radius: 12px;
  background: var(--fb-card);
  color: var(--fb-ink);
  box-shadow: 0 14px 30px rgba(6, 12, 30, 0.3);
}

.fb-panel > span {
  display: block;
  color: var(--fb-dim);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.fb-mini {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.fb-panel-hold .fb-mini {
  aspect-ratio: 2 / 1;
}

.fb-panel-next .fb-mini {
  aspect-ratio: 1 / 2.9;
}

.fb-holdbtn {
  display: none;
  width: 100%;
  margin-top: 4px;
  padding: 0 6px;
  border-color: var(--fb-edge);
  background: rgba(37, 216, 239, 0.12);
  color: var(--fb-ink);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: none;
}

.fb-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.fb-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  box-shadow: none;
}

.fb-card span {
  display: block;
  color: var(--fb-dim);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fb-card strong {
  display: block;
  margin-top: 0;
  color: #fff;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-card:nth-child(1) strong {
  color: #7de9ff;
}

.fb-card:nth-child(2) strong {
  color: #c9a6ff;
}

.fb-meter {
  min-width: 0;
}

.fb-meterbar {
  height: 8px;
  border: 1px solid var(--fb-edge);
  border-radius: 99px;
  background: rgba(6, 12, 28, 0.8);
  overflow: hidden;
}

.fb-meterbar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #25d8ef, #a97bff);
  transition: width 180ms ease;
}

.fb-meter small {
  display: block;
  margin-top: 4px;
  color: var(--fb-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.fb-flags {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
  box-shadow: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fb-dim);
}

.fb-flags .fb-hot {
  color: #ffd166;
}

.fb-veil {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 8px;
  justify-items: center;
  width: min(92%, 292px);
  padding: 18px 16px;
  border: 1px solid var(--fb-edge);
  border-radius: 16px;
  background: rgba(6, 11, 26, 0.9);
  color: var(--fb-ink);
  text-align: center;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(8px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}

.fb-kicker {
  color: #7de9ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.fb-veil strong {
  font-size: 25px;
  line-height: 1.05;
}

.fb-veil p {
  margin: 0;
  color: var(--fb-dim);
  font-size: 12.5px;
  line-height: 1.4;
}

.fb-final-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
}

.fb-final-grid div {
  padding: 5px 3px;
  border: 1px solid var(--fb-edge);
  border-radius: 8px;
  background: rgba(20, 34, 64, 0.6);
}

.fb-final-grid span {
  display: block;
  color: var(--fb-dim);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fb-final-grid strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.fb-result-actions {
  display: flex;
  gap: 7px;
  width: 100%;
}

.fb-result-actions .fb-btn {
  flex: 1 1 0;
  padding: 0 8px;
}

.fb-veil .fb-btn {
  border-color: var(--fb-edge);
  background: rgba(255, 255, 255, 0.07);
  color: var(--fb-ink);
  box-shadow: none;
}

.fb-veil .fb-primary {
  background: linear-gradient(135deg, #25d8ef, #3f7dff);
  color: #04101f;
  border-color: transparent;
}

.fb-feedback {
  min-height: 24px;
  margin: 10px auto 0;
  color: var(--cg-muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.fb-feedback.fb-on {
  opacity: 1;
  transform: translateY(0);
}

.fb-feedback[data-kind="big"] {
  color: #a97bff;
}

.fb-feedback[data-kind="clear"] {
  color: var(--cg-teal);
}

.fb-feedback[data-kind="spin"] {
  color: var(--cg-blue);
}

.fb-feedback[data-kind="level"] {
  color: var(--cg-amber);
}

.fb-below {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  min-width: 0;
}

.fb-seg {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--cg-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.7);
}

.fb-seg-btn {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--cg-muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.fb-seg-btn[aria-pressed="true"] {
  background: var(--cg-teal);
  color: #fff;
  box-shadow: 0 6px 14px rgba(18, 122, 137, 0.28);
}

.fb-note {
  margin: 0;
  min-width: 0;
  color: var(--cg-muted);
  font-size: 12px;
  line-height: 1.35;
}

.fb-pads {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 420px);
  margin: 10px auto 0;
}

.fb-pad {
  min-height: 50px;
  padding: 0 6px;
  border: 1px solid var(--fb-edge);
  background: var(--fb-card);
  color: var(--fb-ink);
  font-size: 19px;
  box-shadow: 0 10px 22px rgba(6, 12, 30, 0.3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.fb-pad-drop {
  background: linear-gradient(135deg, #25d8ef, #3f7dff);
  color: #04101f;
  border-color: transparent;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fb-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 11, 26, 0.6);
  backdrop-filter: blur(3px);
}

.fb-modal-card {
  position: relative;
  width: min(100%, 460px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--fb-edge);
  border-radius: 16px;
  background: linear-gradient(165deg, #132444, #0a1122);
  color: var(--fb-ink);
  box-shadow: 0 30px 80px rgba(3, 8, 20, 0.6);
}

.fb-modal-card h2 {
  margin: 0 48px 12px 0;
  font-size: 24px;
  line-height: 1.1;
}

.fb-modal-card p {
  margin: 10px 0 0;
  color: var(--fb-dim);
  font-size: 13.5px;
  line-height: 1.5;
}

.fb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--fb-ink);
  font-size: 24px;
  line-height: 1;
}

.fb-hidden {
  display: none !important;
}

@media (pointer: coarse) {
  .fb-pads {
    display: grid;
  }
}

@media (max-width: 860px) {
  .fb-shell {
    padding: 0 9px 18px;
  }

  .fb-topbar {
    margin-bottom: 8px;
  }

  .fb-statline {
    flex: 1 1 auto;
    gap: 5px;
  }

  .fb-stat {
    flex: 1 1 0;
    padding: 6px 4px;
    text-align: center;
  }

  .fb-stat span {
    font-size: 9px;
  }

  .fb-stat strong {
    font-size: 14px;
  }

  .fb-actions {
    gap: 5px;
  }

  .fb-btn {
    padding: 0 10px;
  }


  .fb-board {
    width: min(100%, max(176px, calc((100dvh - 500px) / 2)));
    min-width: 0;
  }

  .fb-stage {
    align-items: stretch;
    display: flex;
    flex-direction: column-reverse;
  }

  .fb-rail {
    grid-template-columns: 64px minmax(0, 1fr) 108px;
    grid-template-areas: "hold next stats";
    gap: 5px;
  }

  .fb-panel-hold {
    grid-area: hold;
  }

  .fb-panel-next {
    grid-area: next;
  }

  .fb-stats {
    grid-area: stats;
    gap: 4px;
  }

  .fb-meter,
  .fb-flags {
    display: none;
  }

  .fb-flags {
    grid-area: flags;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }

  .fb-panel-hold .fb-mini,
  .fb-panel-next .fb-mini {
    aspect-ratio: auto;
    height: 46px;
  }

  .fb-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 8px;
  }

  .fb-card strong {
    margin-top: 0;
    font-size: 14px;
  }

  .fb-holdbtn {
    display: none;
  }

  .fb-panel,
  .fb-card,
  .fb-flags {
    padding: 5px 6px;
    border-radius: 10px;
  }

  .fb-card strong {
    font-size: 14px;
  }

  .fb-flags {
    font-size: 9px;
  }

  .fb-meter small {
    margin-top: 3px;
    font-size: 9px;
  }

  .fb-feedback {
    display: none;
  }

  .fb-below {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: 6px;
  }

  .fb-seg {
    align-self: center;
  }

  .fb-seg-btn {
    min-height: 44px;
  }

  .fb-note {
    display: none;
    text-align: center;
    font-size: 11.5px;
  }

  .fb-pads {
    width: min(100%, 420px);
    margin-top: 8px;
  }

  .fb-pad {
    min-height: 46px;
    font-size: 17px;
  }

  .fb-veil {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .fb-veil strong {
    font-size: 21px;
  }

  .fb-veil p {
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .fb-veil {
    padding: 10px 8px;
  }

  .fb-final-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fb-final-grid span {
    font-size: 8px;
    letter-spacing: 0.04em;
  }

  .fb-veil strong {
    font-size: 20px;
  }

  .fb-result-actions {
    flex-direction: column;
  }

  .fb-result-actions .fb-btn {
    width: 100%;
    white-space: nowrap;
  }
}
