.cm-shell {
  --cm-ink: #f2f7ff;
  --cm-soft: #a4c5d8;
  --cm-aqua: #6ee5d9;
  --cm-pink: #ffa2c7;
  box-sizing: border-box;
  width: min(100%, 660px);
  margin: 0 auto;
  padding: 16px 14px 40px;
  color: var(--cm-ink);
  font-family: inherit;
  text-align: left;
}
.cm-shell *, .cm-shell *::before, .cm-shell *::after { box-sizing: border-box; }
.cm-shell button, .cm-shell input { font: inherit; }
.cm-shell button { cursor: pointer; }
.cm-shell button:disabled { opacity: .6; cursor: wait; }
.cm-shell button:focus-visible, .cm-shell input:focus-visible, .cm-options input:focus-visible + span {
  outline: 3px solid #fff2ac; outline-offset: 3px;
}
.cm-header { display: grid; justify-items: start; gap: 16px; margin: 0 0 20px; }
.cm-header h1, .cm-card h2 { margin: 0; text-transform: none; line-height: 1.15; }
.cm-header h1 { font-family: 'Pixelify Sans', ui-monospace, monospace; text-shadow: 2px -1px #206e78, -2px 2px #8d436a; font-size: clamp(30px, 6vw, 47px); color: var(--cm-pink); letter-spacing: -.04em; }
.cm-card h2 { color: var(--cm-aqua); font-size: clamp(19px, 4.3vw, 26px); margin-bottom: 16px; }
.cm-card {
  color: var(--cm-ink); margin: 0 0 16px; padding: clamp(16px, 4vw, 24px);
  background: linear-gradient(125deg, #13283e, #0a1b2d); border: 1px solid #36536a; border-radius: 4px;
  box-shadow: 0 4px 0 #071526;
}
.cm-back, .cm-quiet, .cm-switch button {
  background: #102f4b; color: #d4f4f2; border: 1px solid #49718a; border-radius: 3px;
  min-height: 38px; padding: 7px 13px; font-weight: 700; line-height: 1.2;
}
.cm-shell button:hover { border-color: var(--cm-aqua); }
.cm-cta {
  align-self: start; justify-self: start; padding: 10px 20px; min-height: 43px; background: var(--cm-aqua);
  color: #082a3b; border: 2px solid #98f6eb; border-radius: 3px; font-weight: 800!important;
  box-shadow: 0 3px 0 #276265;
}
.cm-identity { display: flex; align-items: center; gap: 15px; }
.cm-form-label { display: grid; flex: 1; gap: 7px; font-weight: 700; min-width: 0; }
.cm-shell input[type="text"] {
  width: 100%; border: 1px solid #52748c; border-radius: 3px; background: #071b30; color: white;
  padding: 10px 12px; font-size: 16px; height: 44px;
}
.cm-avatar {
  display: inline-grid; place-items: center; background: var(--cm-color); border: 2px solid #22354e;
  width: 38px; height: 38px; border-radius: 10px; font-size: 23px; line-height: 1;
}
.cm-avatar-large { width: 76px; height: 76px; border-radius: 16px; font-size: 46px; }
.cm-profile { display: grid; gap: 16px; }
.cm-profile fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.cm-profile legend { font-size: 15px; font-weight: 700; margin: 0 0 6px; }
.cm-options { display: flex; gap: 8px; flex-wrap: wrap; }
.cm-options label { position: relative; cursor: pointer; }
.cm-options input {
  position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0;
}
.cm-options span {
  display: grid; place-items: center; border: 2px solid #3f607d; border-radius: 3px;
  width: 39px; height: 39px; background: #0b2036; font-size: 22px;
}
.cm-colors span { background: var(--cm-color); border: 3px solid #0a2540; box-shadow: inset 0 0 0 1px #1236; }
.cm-options input:checked + span { border-color: white; box-shadow: 0 0 0 2px #d776a4; }
.cm-message { margin: 4px 0 0; color: var(--cm-aqua); line-height: 1.5; font-size: 14px; }
.cm-message:empty { display: none; }
.cm-message.cm-error { color: #ffadbb; }
.cm-stats { margin: 0; }
.cm-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; }
.cm-stats div + div, .cm-friends li + li, .cm-leaders li + li { border-top: 1px solid #29465d; }
.cm-stats dd { margin: 0; color: #fff2ab; font-variant-numeric: tabular-nums; font-weight: 800; }
.cm-friend-code { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.cm-friend-code span, .cm-friend-code strong { display: block; }
.cm-friend-code span, .cm-card-heading > span { font-size: 14px; color: var(--cm-soft); }
.cm-friend-code strong { font-family: ui-monospace, monospace; font-size: 22px; letter-spacing: .08em; color: #fff0a6; user-select: all; }
.cm-add { display: flex; align-items: flex-end; gap: 10px; margin: 20px 0 12px; }
.cm-add .cm-cta { align-self: flex-end; }
.cm-add input { text-transform: uppercase; }
.cm-friends, .cm-leaders { margin: 12px 0 0; padding: 0; list-style: none; }
.cm-friends li, .cm-leaders li { display: flex; align-items: center; gap: 11px; min-height: 52px; }
.cm-friends strong, .cm-leaders strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cm-shell small { color: var(--cm-soft); font-size: .78em; }
.cm-leaders strong small { margin-left: 6px; color: var(--cm-aqua); font-weight: 500; }
.cm-self .cm-place, .cm-self b { color: #ffdb8f; }
.cm-leaders b { white-space: nowrap; }
.cm-place { color: var(--cm-soft); text-align: center; min-width: 24px; font-variant-numeric: tabular-nums; }
.cm-empty { color: var(--cm-soft); line-height: 1.6; margin: 14px 0 0; }
.cm-card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.cm-card-heading h2 { margin: 0; }
.cm-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-switch button[aria-pressed="true"] { color: #092739; background: var(--cm-aqua); border-color: var(--cm-aqua); }
@media(max-width:420px) {
  .cm-shell { padding-inline: 4px; }
  .cm-card { padding: 15px; }
  .cm-options { gap: 6px; }
  .cm-avatar-large { width: 58px; height: 58px; font-size: 34px; }
  .cm-card .cm-quiet { padding-inline: 8px; font-size: 14px; }
  .cm-add { flex-wrap: wrap; }
  .cm-identity { gap: 10px; }
}
.cm-companions, .cm-history { padding:0; margin:14px 0 0; list-style:none; }
.cm-companions { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; }
.cm-companions li { display:grid; justify-items:center; text-align:center; gap:3px; min-width:0; padding:10px 3px; border:1px solid #324961; background:#0c1d2d; }
.cm-companions li span { font-size:26px; filter:grayscale(.8); }
.cm-companions li strong { font-size:12px; overflow-wrap:anywhere; }
.cm-companions li small { font-size:10px; }
.cm-companions li.cm-unlocked { border-color:#67bcae; }
.cm-companions li.cm-unlocked span { filter:none; }
.cm-mode { color:#dcf5f3; border:1px solid #49718a; background:#102f4b; padding:5px 8px; }
.cm-history li { display:flex; align-items:center; gap:12px; justify-content:space-between; padding:8px 0; }
.cm-history li + li { border-top:1px solid #29465d; }
.cm-history li div { min-width:0; }
.cm-history li strong, .cm-history li small { display:block; }
.cm-history li strong { overflow-wrap:anywhere; }
.cm-history li button { white-space:nowrap; }
.cm-transfer details { border-top:1px solid #29465d; padding:10px 0; }
.cm-transfer summary { cursor:pointer; color:#dcf5f3; }
.cm-transfer p, .cm-transfer form { margin:12px 0; }
.cm-transfer form { display:grid; gap:13px; }
.cm-transfer [data-issued] { display:flex; flex-wrap:wrap; gap:10px; align-items:center; color:#ffe3a1; margin-top:10px; }
.cm-transfer code { overflow-wrap:anywhere; user-select:all; }
.cm-confirm { display:flex; align-items:center; gap:8px; font-size:14px; }
.cm-confirm input { accent-color:var(--cm-aqua); width:18px; height:18px; min-width:18px; }
@media(max-width:360px){.cm-companions{grid-template-columns:repeat(2,minmax(0,1fr))}}
