/* Clicker Counters — front-end styles */

.ccw-root, .ccw-root *, .ccw-root *::before, .ccw-root *::after {
  box-sizing: border-box;
}

.ccw-root {
  width: 100%;
  background-color: #f5f4fb;
  background-image:
    radial-gradient(circle, rgba(91,87,214,0.05) 1px, transparent 1px),
    radial-gradient(520px circle at 12% -15%, rgba(91,87,214,0.07), transparent 60%),
    radial-gradient(460px circle at 90% 0%, rgba(46,143,224,0.06), transparent 58%),
    linear-gradient(180deg, #f7f6fc 0%, #f2f1f9 100%);
  background-size: 22px 22px, auto, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  border: 1px solid #e6e4f0;
  border-radius: 22px;
  padding: clamp(14px, 3vw, 20px) clamp(12px, 3vw, 18px) 18px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #4b4959;
  line-height: 1.4;
}

.ccw-root button,
.ccw-root input {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.ccw-root :focus-visible {
  outline: 2px solid #5b57d6;
  outline-offset: 2px;
}
.ccw-root :focus:not(:focus-visible) {
  outline: none;
}

.ccw-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.ccw-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.ccw-topbar-title h3 {
  font-size: 17px;
  font-weight: 800;
  color: #211f2e;
  margin: 0;
  letter-spacing: -0.02em;
}
.ccw-count-pill {
  font-size: 10.5px;
  font-weight: 600;
  color: #6f6c81;
  background: #ffffff;
  border: 1px solid #e6e4f0;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.ccw-topbar-title p {
  font-size: 11.5px;
  color: #86839a;
  margin: 0;
  letter-spacing: -0.005em;
}
.ccw-sound-btn {
  flex: 0 0 auto;
  margin-top: 2px;
}

.ccw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(210px, calc((100% - 36px) / 4)), 1fr));
  gap: 12px;
  align-items: start;
}

.ccw-add-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 225px;
  border-radius: 18px;
  border: 1.5px dashed #d8d5e8;
  background: rgba(255,255,255,0.5);
  color: #8f8ba3;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}
.ccw-add-tile:hover {
  border-color: #5b57d6;
  color: #5b57d6;
  background: #ffffff;
  transform: translateY(-2px);
}
.ccw-add-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}
.ccw-add-icon svg {
  width: 100%;
  height: 100%;
}

.ccw-card {
  position: relative;
  border-radius: 18px;
  border: 1px solid #e9e7f2;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(30,26,60,0.03), 0 10px 28px -12px rgba(30,26,60,0.10);
  padding: 13px 15px 14px;
  display: flex;
  flex-direction: column;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.ccw-card:hover {
  border-color: #d8d5e8;
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(30,26,60,0.04), 0 16px 32px -12px rgba(30,26,60,0.14);
}
.ccw-card-focused {
  border-color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, #e9e7f2 55%);
  box-shadow: 0 0 0 3px var(--accent-glow, rgba(91,87,214,0.18)), 0 16px 32px -12px rgba(30,26,60,0.14);
}
.ccw-card-flash {
  animation: ccw-cardFlash 650ms ease-in-out;
}
@keyframes ccw-cardFlash {
  0%, 100% { box-shadow: 0 1px 2px rgba(30,26,60,0.03), 0 10px 28px -12px rgba(30,26,60,0.10); }
  50% { box-shadow: 0 0 0 4px var(--accent-glow, rgba(91,87,214,0.4)); }
}

.ccw-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.ccw-card-icons-left {
  display: flex;
  align-items: center;
  gap: 2px;
}
.ccw-alert-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #d99a1f;
  background: rgba(217,154,31,0.10);
  flex: 0 0 auto;
}
.ccw-alert-badge svg {
  width: 13px;
  height: 13px;
}
.ccw-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}
.ccw-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #a19dae;
  cursor: pointer;
  padding: 0;
  transition: background 120ms ease, color 120ms ease;
}
.ccw-icon-btn svg {
  width: 15px;
  height: 15px;
}
.ccw-icon-btn:hover {
  background: #f3f1fa;
  color: #4b4959;
}
.ccw-icon-btn-close-armed {
  background: rgba(220,38,38,0.10);
  color: #dc2626;
  animation: ccw-armedPulse 1.1s ease-in-out infinite;
}
@keyframes ccw-armedPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.35); }
  50% { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}

.ccw-name-input {
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  color: #211f2e;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  padding: 2px 0;
  margin-bottom: 7px;
}
.ccw-name-input:hover {
  border-bottom-color: #e6e4f0;
}
.ccw-name-input:focus {
  border-bottom-color: var(--accent);
}

.ccw-ring-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.ccw-ring {
  --track: color-mix(in srgb, var(--accent) 13%, #ffffff 87%);
  width: clamp(84px, 22vw, 100px);
  height: clamp(84px, 22vw, 100px);
  border-radius: 50%;
  background: var(--track);
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--track) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 260ms ease-out;
}
.ccw-ring-hole {
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 4px rgba(30,26,60,0.06);
}
.ccw-count-number {
  display: inline-block;
  font-family: 'Inter', ui-sans-serif, sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: clamp(19px, 5.5vw, 24px);
  letter-spacing: -0.03em;
  color: #211f2e;
  animation: ccw-pop 220ms ease-out;
  line-height: 1;
}
@keyframes ccw-pop {
  from { transform: scale(1.14); opacity: 0.5; }
  to { transform: scale(1); opacity: 1; }
}

.ccw-caption {
  text-align: center;
  font-size: 11px;
  color: #918da3;
  margin-bottom: 7px;
}

.ccw-card-controls {
  display: flex;
  align-items: stretch;
  border: 1px solid #e9e7f2;
  border-radius: 11px;
  overflow: hidden;
  margin-bottom: 7px;
  background: #fbfaff;
}
.ccw-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 33px;
  border: none;
  border-left: 1px solid #e9e7f2;
  background: transparent;
  color: #625f70;
  cursor: pointer;
  padding: 0;
  transition: background 120ms ease, filter 120ms ease;
}
.ccw-ctrl-btn:first-child {
  border-left: none;
}
.ccw-ctrl-btn svg {
  width: 15px;
  height: 15px;
}
.ccw-ctrl-btn:active {
  filter: brightness(0.94);
}
.ccw-ctrl-btn-minus,
.ccw-ctrl-btn-plus {
  flex: 1;
}
.ccw-ctrl-btn-minus:hover,
.ccw-ctrl-btn-plus:hover {
  background: #f3f1fa;
}
.ccw-ctrl-btn-reset {
  width: 36px;
  flex: 0 0 auto;
  color: var(--accent);
}
.ccw-ctrl-btn-reset:hover {
  background: var(--accent-glow, rgba(91,87,214,0.1));
}
.ccw-ctrl-btn-reset-armed {
  color: #dc2626;
  background: rgba(220,38,38,0.10);
  animation: ccw-armedPulse 1.1s ease-in-out infinite;
}

.ccw-primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 37px;
  border: none;
  border-radius: 11px;
  background: var(--accent);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, white 55%));
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 16px -7px var(--accent-glow, rgba(91,87,214,0.55));
  transition: transform 90ms ease-out, box-shadow 140ms ease, filter 140ms ease;
  margin-top: auto;
}
.ccw-primary-btn svg {
  width: 15px;
  height: 15px;
}
.ccw-primary-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 24px -8px var(--accent-glow, rgba(91,87,214,0.6));
}
.ccw-primary-btn:active {
  transform: scale(0.98);
}

.ccw-inline-settings {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eeecf6;
}
.ccw-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #625f70;
}
.ccw-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #918da3;
  min-width: 0;
}
.ccw-field input[type="text"],
.ccw-field input[type="number"] {
  width: 100%;
  min-width: 0;
  background: #faf9ff;
  border: 1px solid #e6e4f0;
  border-radius: 9px;
  padding: 7px 10px;
  color: #211f2e;
  font-size: 13px;
}
.ccw-field input[type="text"]:focus,
.ccw-field input[type="number"]:focus {
  border-color: var(--accent);
}
.ccw-field-row {
  display: flex;
  gap: 10px;
}
.ccw-field-row .ccw-field {
  flex: 1;
}
.ccw-field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #625f70;
  margin-bottom: 11px;
  cursor: pointer;
}
.ccw-field-checkbox input {
  width: 15px;
  height: 15px;
}
.ccw-swatches {
  display: flex;
  gap: 8px;
  margin-top: 3px;
}
.ccw-swatch {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  transition: transform 120ms ease;
}
.ccw-swatch:hover {
  transform: scale(1.12);
}
.ccw-swatch-active {
  border-color: #211f2e;
}

.ccw-kbd-hints {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 13px;
  margin-top: 14px;
  font-size: 11px;
  color: #a19dae;
}
.ccw-kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ccw-kbd-hints kbd {
  font-family: 'Inter', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  background: #ffffff;
  color: #625f70;
  border-radius: 5px;
  padding: 2px 6px;
  border: 1px solid #e6e4f0;
}

.ccw-footer {
  text-align: center;
  margin-top: 6px;
}
.ccw-footer-link {
  background: none;
  border: none;
  color: #b5b1c4;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 4px;
}
.ccw-footer-link:hover {
  color: #77738a;
}
.ccw-footer-link-armed {
  color: #dc2626;
}

@media (max-width: 380px) {
  .ccw-card {
    padding: 11px 12px 12px;
  }
  .ccw-ring {
    width: 78px;
    height: 78px;
  }
  .ccw-count-number {
    font-size: 18px;
  }
  .ccw-primary-btn span {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ccw-root *, .ccw-root *::before, .ccw-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
