*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #b8d0e8;
  color: #0a1a2a;
  min-height: 100vh;
}

.ca-banner {
  background: #0f1b2d;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.ca-banner-title {
  color: #e8e0d0;
  font-size: 13px;
  letter-spacing: 0.12em;
  font-weight: 500;
  text-transform: uppercase;
}
.ca-banner-right {
  color: #7a8a9a;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.ca-banner-link {
  color: #7a8a9a;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.ca-banner-link:hover { color: #e8e0d0; }

.ca-page {
  padding: 14px;
  min-height: calc(100vh - 50px);
}

.ca-card {
  background: #ffffff;
  border: 1px solid #90b8d8;
  border-radius: 12px;
  padding: 16px;
}

.ca-mode-tag {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
  font-weight: 500;
}
.ca-mode-tag.m1 { color: #1a3a5c; background: #c8e0f8; }
.ca-mode-tag.m2 { color: #1a4a2a; background: #c8f0d8; }
.ca-mode-tag.m3 { color: #5a2a00; background: #fce0b8; }

.ca-card-title {
  font-size: 14px;
  font-weight: 500;
  color: #0a1a2a;
  margin-bottom: 4px;
}
.ca-card-sub {
  font-size: 12px;
  color: #4a6a8a;
  margin-bottom: 12px;
}
.ca-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6a8aaa;
  margin-bottom: 8px;
}

.ca-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ca-dashboard-left { grid-row: 1 / 3; }

.ca-game-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #1e3a5f;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 7px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.ca-game-btn:hover { background: #162d4a; }
.ca-game-btn:last-child { margin-bottom: 0; }
.ca-game-opp {
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  display: block;
}
.ca-game-meta {
  font-size: 11px;
  color: #90b8d8;
  display: block;
  margin-top: 2px;
}

.ca-result {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ca-result.win { background: #c0e8c0; color: #1a4a1a; }
.ca-result.loss { background: #f0c0c0; color: #5a1a1a; }
.ca-result.draw { background: #c8d8e8; color: #1a3a5a; }

.ca-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.ca-stat {
  background: #dceefa;
  border-radius: 8px;
  padding: 10px 12px;
}
.ca-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4a7a9a;
  margin-bottom: 4px;
}
.ca-stat-val {
  font-size: 18px;
  font-weight: 500;
  color: #0a1a2a;
}
.ca-stat-sub {
  font-size: 11px;
  color: #4a6a8a;
  margin-top: 2px;
}

.ca-toggle-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.ca-toggle-btn {
  flex: 1;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  border: 1px solid #90b8d8;
  background: #f0f6fc;
  color: #3a6a9a;
}
.ca-toggle-btn.active {
  background: #1e3a5f;
  color: #ffffff;
  border-color: #1e3a5f;
}

.ca-pearl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}
.ca-pearl-name {
  font-size: 12px;
  color: #1a2a3a;
  width: 145px;
  flex-shrink: 0;
}
.ca-pearl-bar-wrap {
  flex: 1;
  height: 5px;
  background: #c8e0f0;
  border-radius: 3px;
  overflow: hidden;
}
.ca-pearl-bar {
  height: 100%;
  border-radius: 3px;
}
.ca-pearl-count {
  font-size: 11px;
  color: #4a6a8a;
  width: 22px;
  text-align: right;
}

.ca-insight {
  font-size: 12px;
  color: #1a2a3a;
  line-height: 1.7;
  border-left: 2px solid #1e3a5f;
  padding-left: 10px;
  margin-bottom: 12px;
}

.ca-m3-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.ca-m3-option {
  border: 1px solid #90b8d8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f0f8ff;
}
.ca-m3-opt-title {
  font-size: 12px;
  font-weight: 500;
  color: #0a1a2a;
  margin-bottom: 3px;
}
.ca-m3-opt-desc {
  font-size: 11px;
  color: #4a6a8a;
}
.ca-construction {
  font-size: 13px;
  color: #8a6a3a;
  background: #fce0b8;
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
  margin-top: 8px;
}

.ca-btn-primary {
  background: #1e3a5f;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}
.ca-btn-primary:hover { background: #162d4a; }

.ca-btn-secondary {
  background: #ffffff;
  color: #1e3a5f;
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
}
.ca-btn-secondary:hover { background: #f0f6fc; }

.ca-btn-loading {
  opacity: 0.6;
  cursor: not-allowed;
  animation: ca-pulse 1s ease-in-out infinite;
}
@keyframes ca-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

.ca-review-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
  min-height: calc(100vh - 78px);
}

.ca-board-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ca-clock-strip {
  background: #ffffff;
  border: 1px solid #90b8d8;
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ca-clock-side {
  font-size: 10px;
  color: #6a8aaa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ca-clock-time {
  font-size: 16px;
  font-weight: 500;
  color: #0a1a2a;
  margin-top: 2px;
}
.ca-clock-time.low { color: #a02a2a; }
.ca-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 2px solid #1e3a5f;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 1;
}
.ca-sq {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: default;
  position: relative;
}
.ca-sq.light { background: #f0d9b5; }
.ca-sq.dark { background: #b58863; }
.ca-sq.highlight { background: #aaa23a; }
.ca-piece { line-height: 1; }
.ca-piece.white { color: #ffffff; text-shadow: 0 0 2px #333; }
.ca-piece.black { color: #1a1a1a; }

.ca-sq-label {
  position: absolute;
  bottom: 2px;
  left: 3px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  opacity: 0.35;
}
.ca-sq.light .ca-sq-label { color: #8a6a3a; }
.ca-sq.dark .ca-sq-label  { color: #f0d9b5; }
.ca-sq.highlight .ca-sq-label { color: #ffffff; }

.ca-flip-btn {
  background: #ffffff;
  color: #1e3a5f;
  border: 1px solid #90b8d8;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  width: 100%;
}
.ca-flip-btn:hover { background: #f0f6fc; }

.ca-nav-strip {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ca-nav-btn {
  flex: 1;
  background: #1e3a5f;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}
.ca-nav-btn:hover { background: #162d4a; }
.ca-move-label {
  font-size: 11px;
  color: #6a8aaa;
  text-align: center;
  padding: 2px 0;
}

.ca-coach-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ca-game-info-bar {
  background: #ffffff;
  border: 1px solid #90b8d8;
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ca-game-info-title {
  font-size: 13px;
  font-weight: 500;
  color: #0a1a2a;
}
.ca-game-info-meta {
  font-size: 12px;
  color: #4a6a8a;
  margin-top: 2px;
}
.ca-coaching-mode-row {
  display: flex;
  gap: 8px;
}
.ca-coach-mode-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  border: 1px solid #90b8d8;
  background: #f0f6fc;
  color: #3a6a9a;
  font-weight: 500;
}
.ca-coach-mode-btn.active {
  background: #1e3a5f;
  color: #ffffff;
  border-color: #1e3a5f;
}
.ca-chat-box {
  background: #ffffff;
  border: 1px solid #90b8d8;
  border-radius: 8px;
  padding: 14px;
  flex: 1;
  overflow-y: auto;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ca-msg-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a8aaa;
  margin-bottom: 4px;
}
.ca-msg-coach {
  font-size: 13px;
  color: #0a1a2a;
  line-height: 1.7;
  border-left: 2px solid #1e3a5f;
  padding-left: 10px;
}
.ca-msg-user {
  font-size: 13px;
  color: #0a1a2a;
  line-height: 1.7;
  padding-left: 12px;
}
.ca-pearl-alert {
  background: #fce0b8;
  border-left: 2px solid #c87a20;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #5a2a00;
}
.ca-pearl-alert strong { font-weight: 500; }
.ca-input-row {
  display: flex;
  gap: 8px;
}
.ca-input {
  flex: 1;
  background: #ffffff;
  border: 1px solid #90b8d8;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: #0a1a2a;
  resize: none;
  font-family: inherit;
}
.ca-input:focus {
  outline: none;
  border-color: #1e3a5f;
}
.ca-btn-row {
  display: flex;
  gap: 8px;
}

.ca-msg-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
}
.ca-msg-block {
  flex: 1;
  min-width: 0;
}
.ca-msg-reply-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 180px;
  flex-shrink: 0;
}
.ca-msg-reply-input {
  background: #f4f9fd;
  border: 1px solid #c0d8ec;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: #0a1a2a;
  font-family: inherit;
  resize: none;
  width: 100%;
  min-height: 56px;
}
.ca-msg-reply-input:focus {
  outline: none;
  border-color: #1e3a5f;
  background: #ffffff;
}
.ca-msg-reply-btn {
  background: #1e3a5f;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  width: 100%;
}
.ca-msg-reply-btn:hover { background: #162d4a; }

.ca-summary-layout {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ca-summary-field { margin-bottom: 10px; }
.ca-summary-field-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a8aaa;
  margin-bottom: 4px;
}
.ca-editable {
  width: 100%;
  background: #f4f9fd;
  border: 1px solid #c0d8ec;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #0a1a2a;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
}
.ca-editable:focus {
  outline: none;
  border-color: #1e3a5f;
  background: #ffffff;
}
.ca-pearl-event-row {
  display: grid;
  grid-template-columns: 180px 80px 1fr 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.ca-pearl-event-row input,
.ca-pearl-event-row textarea {
  background: #f4f9fd;
  border: 1px solid #c0d8ec;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  color: #0a1a2a;
  font-family: inherit;
  width: 100%;
}
.ca-pearl-event-row input:focus,
.ca-pearl-event-row textarea:focus {
  outline: none;
  border-color: #1e3a5f;
  background: #ffffff;
}
.ca-pearl-delete {
  background: none;
  border: none;
  color: #a02a2a;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}
.ca-add-pearl-btn {
  background: none;
  border: 1px dashed #90b8d8;
  border-radius: 6px;
  color: #4a6a8a;
  font-size: 12px;
  padding: 7px;
  cursor: pointer;
  width: 100%;
  margin-top: 4px;
}
.ca-add-pearl-btn:hover { background: #f0f8ff; }
.ca-save-bar {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}
.ca-save-confirm {
  font-size: 12px;
  color: #2a6a3a;
  padding: 9px 0;
  display: none;
}
.ca-game-info-full {
  margin-bottom: 12px;
}

.ca-review-layout-v2 {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 12px;
  min-height: calc(100vh - 120px);
  align-items: start;
}

.ca-moves-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ca-analyze-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
}

.ca-analyze-status {
  font-size: 12px;
  color: #4a6a8a;
  text-align: center;
  padding: 8px 0 0;
}

.ca-narrative-block {
  font-size: 13px;
  color: #1a2a3a;
  line-height: 1.7;
}

.ca-commented-moves {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ca-move-entry {
  background: #ffffff;
  border: 1px solid #90b8d8;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.ca-move-entry:hover {
  border-color: #1e3a5f;
}

.ca-move-entry.active {
  border-color: #1e3a5f;
  border-width: 2px;
}

.ca-move-entry-header {
  font-size: 11px;
  font-weight: 500;
  color: #6a8aaa;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
}

.ca-move-entry-comment {
  font-size: 13px;
  color: #0a1a2a;
  line-height: 1.7;
}

.ca-move-entry-pattern {
  font-size: 11px;
  color: #5a2a00;
  background: #fce0b8;
  border-radius: 4px;
  padding: 2px 8px;
  margin-top: 6px;
  display: inline-block;
}

.ca-interact-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ca-interact-panel {
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.ca-interact-placeholder {
  font-size: 13px;
  color: #6a8aaa;
  line-height: 1.7;
  padding: 8px 0;
}

.ca-interact-move-header {
  font-size: 11px;
  font-weight: 500;
  color: #6a8aaa;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0ecf8;
}

.ca-interact-comment {
  font-size: 13px;
  color: #0a1a2a;
  line-height: 1.7;
  border-left: 2px solid #1e3a5f;
  padding-left: 10px;
  margin-bottom: 12px;
}

.ca-interact-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
  overflow-y: auto;
  max-height: 300px;
}

.ca-interact-msg-coach {
  font-size: 13px;
  color: #0a1a2a;
  line-height: 1.7;
  border-left: 2px solid #1e3a5f;
  padding-left: 10px;
}

.ca-interact-msg-user {
  font-size: 13px;
  color: #4a6a8a;
  line-height: 1.7;
  padding-left: 12px;
  text-align: right;
}