#view-calendar {
  display: none;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  color: #202637;
  background:
    radial-gradient(circle at 12% 6%, rgba(221, 232, 255, 0.72), transparent 24rem),
    #f5f7fb;
  font-family: 'Google Sans', 'Segoe UI', Roboto, Arial, sans-serif;
  box-sizing: border-box;
}

#view-calendar.active {
  display: flex;
  flex-direction: column;
}

#view-calendar.active ~ .mobile-touch-bar {
  display: none !important;
}

#view-calendar *,
#view-calendar *::before,
#view-calendar *::after {
  box-sizing: border-box;
}

.caro-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 72px;
  padding: 0 clamp(16px, 4vw, 56px);
  border-bottom: 1px solid #e6eaf1;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.caro-back-home,
.caro-back-link {
  width: fit-content;
  color: #637087;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.caro-back-home:hover,
.caro-back-link:hover,
.caro-text-button:hover {
  color: #3157c8;
}

.caro-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.caro-brand-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #6487f4, #5961d8);
  font-size: 22px;
}

.caro-brand strong,
.caro-brand span {
  display: block;
}

.caro-brand strong {
  font-size: 15px;
  letter-spacing: -0.2px;
}

.caro-brand div > span {
  margin-top: 2px;
  color: #8b94a6;
  font-size: 11px;
}

.caro-account {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.caro-guest-label,
.caro-history-note {
  color: #7d879b;
  font-size: 12px;
}

.caro-user-avatar,
.caro-player-avatar {
  display: grid;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  color: #455ed1;
  background: #e5eaff;
  font-weight: 700;
}

.caro-user-avatar {
  width: 34px;
  height: 34px;
}

.caro-user-avatar img,
.caro-player-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.caro-user-name {
  overflow: hidden;
  max-width: 180px;
  color: #525d72;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caro-main {
  width: min(1120px, calc(100% - 40px));
  flex: 1 0 auto;
  margin: 0 auto;
  padding: 54px 0 72px;
}

.caro-page-heading,
.caro-room-heading,
.caro-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.caro-page-heading {
  margin-bottom: 30px;
}

.caro-eyebrow {
  color: #7785a1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.35px;
}

.caro-page-heading h1,
.caro-room-heading h1,
.caro-gate-panel h1 {
  margin: 8px 0 7px;
  color: #222a3b;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 650;
  letter-spacing: -1.3px;
}

.caro-page-heading p,
.caro-room-heading p,
.caro-panel > p,
.caro-gate-panel p {
  margin: 0;
  color: #7a8499;
  font-size: 14px;
  line-height: 1.65;
}

.caro-calendar-date {
  display: flex;
  min-width: 170px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #e7eaf1;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.caro-calendar-date > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  color: #455bcc;
  background: #edf0ff;
  font-size: 20px;
  font-weight: 700;
}

.caro-calendar-date small {
  color: #667187;
  font-size: 11px;
  text-transform: capitalize;
}

.caro-lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.8fr);
  gap: 18px;
}

.caro-panel,
.caro-history-panel {
  border: 1px solid #e6eaf1;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 28px rgba(34, 45, 78, 0.045);
}

.caro-panel {
  padding: clamp(22px, 3vw, 34px);
}

.caro-online-panel {
  position: relative;
  overflow: hidden;
  min-height: 305px;
}

.caro-online-panel::after {
  position: absolute;
  right: -45px;
  bottom: -92px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(95, 120, 231, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 25px rgba(95, 120, 231, 0.025), 0 0 0 50px rgba(95, 120, 231, 0.02);
  content: "";
  pointer-events: none;
}

.caro-panel-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 21px;
  place-items: center;
  border-radius: 13px;
  color: #4f64db;
  background: #edf0ff;
  font-size: 20px;
}

.caro-panel h2,
.caro-history-heading h2,
.caro-room-sidebar h2 {
  margin: 7px 0 8px;
  color: #2c3446;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.caro-panel > p {
  max-width: 480px;
}

.caro-lobby-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
  margin-top: 23px;
}

.caro-join-form {
  flex: 1 1 260px;
  max-width: 355px;
}

.caro-join-form label {
  display: block;
  margin-bottom: 7px;
  color: #69748a;
  font-size: 11px;
  font-weight: 650;
}

.caro-join-controls {
  display: flex;
  gap: 8px;
}

.caro-join-controls input {
  width: 0;
  min-width: 0;
  flex: 1;
  padding: 0 13px;
  border: 1px solid #e0e5ef;
  border-radius: 10px;
  outline: 0;
  color: #293348;
  background: #fbfcff;
  font: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.caro-join-controls input:focus {
  border-color: #7185ec;
  box-shadow: 0 0 0 3px rgba(93, 116, 224, 0.13);
}

.caro-local-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: linear-gradient(145deg, #fff, #fbf9f4);
}

.caro-local-symbol {
  display: flex;
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  margin-bottom: 19px;
  border: 1px solid #eee8da;
  border-radius: 16px;
  color: #d85158;
  background: #fff;
  font-size: 24px;
  font-weight: 750;
}

.caro-local-symbol span {
  margin: 11px 0 0 4px;
  color: #4c72cf;
}

.caro-local-panel .caro-button {
  margin-top: auto;
  padding-top: 22px;
}

.caro-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.caro-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.caro-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.caro-button-primary {
  color: #fff;
  background: linear-gradient(135deg, #5b78e8, #545bd4);
  box-shadow: 0 5px 12px rgba(83, 99, 211, 0.17);
}

.caro-button-primary:hover:not(:disabled) {
  box-shadow: 0 8px 17px rgba(83, 99, 211, 0.24);
}

.caro-button-light {
  border-color: #e0e5ef;
  color: #59657c;
  background: #fff;
}

.caro-button-dark {
  color: #fff;
  background: #30394e;
}

.caro-button-wide {
  width: 100%;
}

.caro-text-button {
  padding: 7px 3px;
  border: 0;
  color: #758097;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
}

.caro-helper-text {
  margin: 10px 0 0;
  color: #8a93a5;
  font-size: 11px;
  line-height: 1.5;
}

.caro-history-panel {
  margin-top: 18px;
  padding: 23px 27px;
}

.caro-history-heading {
  align-items: flex-end;
  margin-bottom: 12px;
}

.caro-history-heading h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.caro-stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #8790a2;
  font-size: 11px;
}

.caro-stat-strip b {
  color: #444f67;
  font-size: 15px;
}

.caro-match-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.caro-match-row {
  display: grid;
  grid-template-columns: 65px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 43px;
  border-top: 1px solid #f0f2f6;
  color: #68738a;
  font-size: 12px;
}

.caro-match-row time {
  color: #929aab;
  font-size: 11px;
}

.caro-match-result {
  font-size: 11px;
  font-weight: 750;
}

.caro-result-win {
  color: #2e9b72;
}

.caro-result-loss {
  color: #cf626b;
}

.caro-result-draw {
  color: #9a7a32;
}

.caro-history-empty {
  padding: 14px 0 3px;
  border-top: 1px solid #f0f2f6;
  color: #929aab;
  font-size: 12px;
}

.caro-room-heading {
  margin-bottom: 22px;
}

.caro-room-heading h1 {
  font-size: 32px;
}

.caro-room-heading h1 span {
  color: #586cde;
  letter-spacing: 2px;
}

.caro-room-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.caro-room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 18px;
}

.caro-game-panel {
  padding: 21px;
}

.caro-player-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.caro-player-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #edf0f5;
  border-radius: 12px;
  background: #fbfcfe;
}

.caro-player-card.is-current {
  border-color: #bac5fa;
  background: #f6f7ff;
  box-shadow: 0 0 0 2px rgba(97, 117, 225, 0.08);
}

.caro-player-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  font-size: 19px;
  font-weight: 800;
}

.mark-x,
.caro-cell.mark-x {
  color: #d9575d;
}

.mark-o,
.caro-cell.mark-o {
  color: #4974d5;
}

.caro-player-info {
  display: block;
  min-width: 0;
}

.caro-player-info strong,
.caro-player-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caro-player-info strong {
  color: #39445b;
  font-size: 11px;
}

.caro-player-info small {
  margin-top: 4px;
  color: #929aab;
  font-size: 10px;
}

.caro-player-avatar {
  width: 28px;
  height: 28px;
  margin-left: auto;
}

.caro-versus {
  color: #a0a7b5;
  font-size: 10px;
  font-weight: 800;
}

.caro-game-notice {
  margin: 17px 0 13px;
  padding: 10px 13px;
  border-radius: 10px;
  color: #626e84;
  background: #f6f7fa;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.caro-game-notice.is-your-turn {
  color: #475bc6;
  background: #eef0ff;
}

.caro-board-wrap {
  width: min(100%, 680px);
  margin: 0 auto;
}

.caro-board {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  grid-template-rows: repeat(15, minmax(0, 1fr));
  gap: 2px;
  padding: 5px;
  border: 1px solid #dfd3b9;
  border-radius: 12px;
  background-color: #e9dfc9;
  background-image:
    linear-gradient(rgba(118, 102, 70, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(118, 102, 70, 0.09) 1px, transparent 1px);
  box-shadow: inset 0 0 18px rgba(121, 101, 57, 0.08);
}

.caro-cell {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: #273046;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  font: inherit;
  font-size: clamp(10px, 2.3vw, 26px);
  font-weight: 800;
  line-height: 1;
}

.caro-cell:disabled {
  cursor: default;
}

.caro-cell:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 0 0 1px rgba(81, 103, 214, 0.35);
}

.caro-cell span {
  transform: translateY(-1px);
}

.caro-game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  color: #9199a9;
  font-size: 11px;
}

.caro-room-sidebar {
  padding: 22px;
}

.caro-room-sidebar h2 {
  margin-top: 8px;
  font-size: 20px;
}

.caro-room-sidebar > p {
  margin-bottom: 16px;
  font-size: 12px;
}

.caro-room-code {
  margin: 18px 0 12px;
  padding: 14px 8px;
  border: 1px dashed #bdc7ee;
  border-radius: 12px;
  color: #4b5dca;
  background: #f6f7ff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
}

.caro-room-role,
.caro-room-status {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  color: #8a93a5;
  font-size: 11px;
}

.caro-room-role strong,
.caro-room-status strong {
  color: #59657c;
  text-align: right;
}

.caro-local-game-panel {
  max-width: 750px;
  margin: 0 auto;
}

.caro-gate-panel {
  width: min(100%, 480px);
  margin: 8vh auto;
  padding: 38px;
  border: 1px solid #e6eaf1;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(34, 45, 78, 0.08);
  text-align: center;
}

.caro-gate-panel .caro-panel-icon {
  margin: 0 auto 20px;
}

.caro-gate-panel .caro-button {
  margin: 23px auto 0;
}

.caro-gate-panel .caro-back-link {
  display: block;
  margin-top: 20px;
}

.caro-error-icon {
  color: #c5545e;
  background: #fff0f1;
  font-weight: 800;
}

.caro-loading {
  padding: 90px 10px;
  color: #808a9e;
  font-size: 13px;
  text-align: center;
}

.caro-error-message {
  margin: 12px 0 0;
  color: #c5545e;
  font-size: 12px;
}

.caro-toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 16px;
  transform: translateY(12px);
  border: 1px solid #e5e9f1;
  border-radius: 12px;
  color: #fff;
  background: #30394e;
  box-shadow: 0 8px 28px rgba(30, 39, 58, 0.2);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.caro-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 760px) {
  .caro-header {
    grid-template-columns: auto 1fr auto;
    gap: 9px;
    min-height: 62px;
    padding: 0 14px;
  }

  .caro-back-home {
    overflow: hidden;
    max-width: 75px;
    font-size: 11px;
    white-space: nowrap;
  }

  .caro-brand {
    justify-self: center;
  }

  .caro-brand-icon {
    width: 32px;
    height: 32px;
  }

  .caro-brand strong {
    font-size: 13px;
  }

  .caro-brand div > span,
  .caro-user-name {
    display: none;
  }

  .caro-text-button {
    display: block;
    padding: 5px;
    font-size: 10px;
  }

  .caro-account {
    gap: 5px;
  }

  .caro-account .caro-button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 10px;
  }

  .caro-main {
    width: min(100% - 26px, 600px);
    padding: 32px 0 48px;
  }

  .caro-calendar-date {
    min-width: 0;
    padding: 7px;
  }

  .caro-calendar-date small {
    display: none;
  }

  .caro-lobby-grid,
  .caro-room-layout {
    grid-template-columns: 1fr;
  }

  .caro-online-panel {
    min-height: 0;
  }

  .caro-local-panel {
    min-height: 255px;
  }

  .caro-room-sidebar {
    order: -1;
  }

  .caro-room-heading {
    align-items: flex-start;
  }

  .caro-room-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .caro-room-actions .caro-button {
    min-height: 36px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .caro-game-panel {
    padding: 12px;
  }

  .caro-player-bar {
    gap: 5px;
  }

  .caro-player-card {
    gap: 6px;
    padding: 7px 5px;
  }

  .caro-player-mark {
    width: 27px;
    height: 27px;
    font-size: 16px;
  }

  .caro-player-info strong {
    font-size: 9px;
  }

  .caro-player-info small {
    font-size: 8px;
  }

  .caro-player-avatar {
    display: none;
  }

  .caro-history-panel {
    padding: 19px 17px;
  }
}

@media (max-width: 420px) {
  .caro-page-heading p {
    max-width: 220px;
    font-size: 12px;
  }

  .caro-lobby-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .caro-join-form {
    flex-basis: auto;
    max-width: none;
  }

  .caro-history-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .caro-match-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 7px;
    font-size: 10px;
  }

  .caro-match-row time {
    font-size: 9px;
  }
}
