.sm-shell {
  position: relative;
  width: 100%;
  height: min(78vh, 760px);
  min-height: 460px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #0d2a3d 0%, #123c4f 55%, #0b2334 100%);
  color: #eaf4f8;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 18px 46px rgba(6, 20, 32, 0.45);
  user-select: none;
  touch-action: none;
}

.sm-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.sm-floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.sm-floater {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.sm-floater-hit { color: #ff9d7a; }
.sm-floater-kill { color: #ffd166; font-size: 17px; }
.sm-floater-move { color: #8fe9ff; font-size: 13px; }
.sm-floater-deny { color: #ff8b8b; font-size: 13px; }

.sm-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(6, 22, 34, 0.86), rgba(6, 22, 34, 0));
  pointer-events: none;
}

.sm-top > * { pointer-events: auto; }

.sm-turn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 13px;
  border-radius: 11px;
  background: rgba(8, 26, 40, 0.72);
  border: 1px solid rgba(150, 215, 240, 0.22);
}

.sm-turn span { font-size: 15px; font-weight: 700; letter-spacing: 0.03em; }
.sm-turn em { font-size: 11px; font-style: normal; text-transform: uppercase; letter-spacing: 0.14em; color: #7fd6f2; }

.sm-marks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}

.sm-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 5px 9px;
  border-radius: 10px;
  background: rgba(8, 26, 40, 0.72);
  border: 1px solid rgba(150, 215, 240, 0.2);
}

.sm-mark b { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.sm-mark em { font-size: 11px; font-style: normal; color: #9fb6c4; }
.sm-mark-crew { border-color: rgba(111, 240, 176, 0.6); }
.sm-mark-crew em { color: #6ff0b0; }
.sm-mark-tide { border-color: rgba(255, 143, 122, 0.6); }
.sm-mark-tide em { color: #ff8f7a; }

.sm-tools { display: flex; gap: 6px; }

.sm-tool {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(150, 215, 240, 0.24);
  background: rgba(8, 26, 40, 0.72);
  color: #cfe9f5;
  font-size: 15px;
  cursor: pointer;
}

.sm-tool:hover { border-color: #6fd8ff; color: #fff; }

.sm-log {
  position: absolute;
  left: 12px;
  top: 74px;
  z-index: 4;
  width: min(280px, 42%);
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(7, 24, 37, 0.62);
  border: 1px solid rgba(150, 215, 240, 0.16);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}

.sm-log p { margin: 0 0 2px; color: #cfe2ec; }
.sm-log b { color: #7fd6f2; margin-right: 6px; font-size: 11px; }

.sm-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(0deg, rgba(5, 19, 30, 0.92), rgba(5, 19, 30, 0));
}

.sm-roster {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.sm-crew {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sm-foes {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.sm-foe {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 143, 122, 0.3);
  background: rgba(38, 14, 16, 0.62);
  color: #ffd9d0;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sm-foe .sm-badge {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  font-size: 10px;
}

.sm-foe-hp { display: flex; gap: 2px; }
.sm-foe-hp i { width: 5px; height: 5px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
.sm-foe-hp i.is-on { background: #ff8f7a; }
.sm-foe.is-dead { opacity: 0.3; filter: grayscale(1); }

.sm-unit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border-radius: 12px;
  border: 1px solid rgba(150, 215, 240, 0.2);
  background: rgba(8, 26, 40, 0.78);
  color: #eaf4f8;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.sm-unit:hover { transform: translateY(-2px); border-color: #6fd8ff; }
.sm-unit.is-sel { border-color: #6ff0b0; box-shadow: 0 0 0 1px rgba(111, 240, 176, 0.5); }
.sm-unit.is-spent { opacity: 0.55; }
.sm-unit.is-down { opacity: 0.32; filter: grayscale(1); }

.sm-badge {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #06202c;
}

.sm-badge-crew { background: #6ff0b0; }
.sm-badge-tide { background: #ff8f7a; }

.sm-unit-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-unit-body strong { font-size: 13px; letter-spacing: 0.02em; }
.sm-unit-body em { font-size: 10.5px; font-style: normal; color: #9fb6c4; }

.sm-bars { display: flex; gap: 7px; margin-top: 2px; }
.sm-hpbar, .sm-apbar { display: flex; gap: 2px; }
.sm-hp { width: 5px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
.sm-hp.is-on { background: #6ff0b0; }
.sm-pip { width: 9px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
.sm-pip.is-on { background: #ffd166; }

.sm-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.sm-act {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid rgba(111, 240, 176, 0.5);
  background: rgba(20, 72, 66, 0.85);
  color: #eafff4;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.sm-act:hover { background: rgba(28, 98, 88, 0.92); }
.sm-act:disabled { opacity: 0.4; cursor: default; }
.sm-act-quiet { border-color: rgba(150, 215, 240, 0.28); background: rgba(8, 26, 40, 0.8); color: #cfe9f5; }

.sm-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 17, 27, 0.72);
  backdrop-filter: blur(3px);
  overflow: auto;
}

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

.sm-card {
  width: min(560px, 100%);
  padding: 24px 26px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(16, 46, 64, 0.97), rgba(9, 27, 40, 0.97));
  border: 1px solid rgba(150, 215, 240, 0.24);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
}

.sm-card-slim { width: min(380px, 100%); }

.sm-kicker {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #7fd6f2;
}

.sm-card h2 { margin: 6px 0 10px; font-size: 30px; letter-spacing: 0.01em; }
.sm-lede { margin: 0 0 16px; font-size: 14.5px; line-height: 1.6; color: #cfe2ec; }

.sm-diffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }

.sm-diff {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(150, 215, 240, 0.2);
  background: rgba(8, 26, 40, 0.7);
  color: #eaf4f8;
  text-align: left;
  cursor: pointer;
}

.sm-diff strong { font-size: 14px; }
.sm-diff span { font-size: 11px; color: #7fd6f2; }
.sm-diff em { font-size: 10.5px; font-style: normal; color: #9fb6c4; line-height: 1.35; }
.sm-diff.is-on { border-color: #6ff0b0; background: rgba(16, 54, 52, 0.85); }

.sm-rules { display: grid; gap: 5px; margin-bottom: 18px; }
.sm-rules p { margin: 0; font-size: 12.5px; color: #b9cfdb; }
.sm-rules strong { color: #ffd166; }

.sm-primary {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, #59d8a0, #2f9c74);
  color: #052018;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.sm-primary:hover { filter: brightness(1.08); }

.sm-foot { margin: 12px 0 0; font-size: 11.5px; color: #8ea6b4; text-align: center; }

.sm-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.sm-row .sm-act { flex: 1 1 auto; }
.sm-row .sm-primary { flex: 1 1 100%; }

.sm-slider { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12.5px; color: #b9cfdb; }
.sm-slider input { flex: 1; max-width: 190px; accent-color: #59d8ff; }

.sm-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }

.sm-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(8, 26, 40, 0.7);
  border: 1px solid rgba(150, 215, 240, 0.14);
  font-size: 12.5px;
  color: #b9cfdb;
}

.sm-stat b { color: #eaf4f8; font-size: 15px; }

.sm-loading {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: rgba(6, 22, 34, 0.9);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #9fd8ec;
}

@media (max-width: 720px) {
  .sm-shell { height: 72vh; min-height: 420px; border-radius: 14px; }
  .sm-top { padding: 9px 10px; gap: 7px; }
  .sm-turn { padding: 5px 10px; }
  .sm-turn span { font-size: 13px; }
  .sm-mark { min-width: 52px; padding: 4px 7px; }
  .sm-mark b { font-size: 9.5px; }
  .sm-mark em { font-size: 9.5px; }
  .sm-tool { width: 34px; height: 34px; }
  .sm-log { top: 62px; left: 8px; width: 58%; font-size: 11px; padding: 7px 9px; }
  .sm-dock { flex-direction: column; align-items: stretch; gap: 7px; padding: 9px 10px; }
  .sm-roster { gap: 5px; }
  .sm-crew { gap: 5px; }
  .sm-unit { padding: 6px 7px; gap: 6px; }
  .sm-badge { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; font-size: 13px; }
  .sm-unit-body em { display: none; }
  .sm-unit-body strong { font-size: 12px; }
  .sm-bars { gap: 5px; }
  .sm-hpbar, .sm-apbar { gap: 1.5px; }
  .sm-hp { width: 4px; }
  .sm-pip { width: 8px; }
  .sm-foe { font-size: 10px; padding: 1px 7px 1px 3px; }
  .sm-actions { justify-content: stretch; }
  .sm-actions .sm-act { flex: 1; padding: 0 10px; }
  .sm-diffs { grid-template-columns: 1fr; }
  .sm-diff em { display: none; }
  .sm-card { padding: 18px 18px; }
  .sm-card h2 { font-size: 24px; }
  .sm-stats { grid-template-columns: 1fr; }
}
