/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100vw; height: 100vh;
  overflow: hidden;
  font-family: 'Chicago', 'Geneva', 'Helvetica Neue', Arial, sans-serif;
  background: #c0c0c0;
  user-select: none;
}

/* ── Root Layout ─────────────────────────────────────────────────────────── */
#mc-root {
  display: flex;
  flex-direction: column;
  width: 100vw; height: 100vh;
  overflow: hidden;
}

#mc-scene-viewport {
  flex: 1 1 0;
  position: relative;
  overflow: hidden;
}

#mc-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* ── Bottom Toolbar ──────────────────────────────────────────────────────── */
#mc-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-bottom: 2px solid #808080;
  height: 5.5rem;
  padding: 0.3rem 0.5rem;
  gap: 0.4rem;
  box-shadow: inset 0 1px 0 #e0e0e0;
}

.mc-tb-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #d4d0c8;
  border: none;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  border-radius: 4px;
  cursor: pointer;
  padding: 0.3rem 0.2rem;
  transition: none;
  outline: none;
  min-width: 0;
}

.mc-tb-btn:active, .mc-tb-btn.pressed {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  background: #b8b4ac;
}

.mc-tb-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 0.1rem;
}

.mc-tb-label {
  font-size: 0.65rem;
  font-weight: bold;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Scene Transitions ───────────────────────────────────────────────────── */
.mc-scene-fade-in {
  animation: mcFadeIn 0.25s ease forwards;
}
@keyframes mcFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Desk Scene ─────────────────────────────────────────────────────────── */
#scene-desk {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.desk-wall {
  flex: 0 0 38%;
  position: relative;
  background: linear-gradient(180deg, #f5e6c8 0%, #eddcb5 60%, #d4b896 100%);
  overflow: hidden;
}

.desk-wall-wainscot {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 30%;
  background: linear-gradient(180deg, #c8a870 0%, #b8945a 100%);
  border-top: 3px solid #a0784a;
}

.desk-window-frame {
  position: absolute;
  top: 8%; left: 4%;
  width: 22%;
  aspect-ratio: 4/3;
  background: #87ceeb;
  border: 4px solid #8b6914;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.2), 2px 2px 6px rgba(0,0,0,0.3);
}

.desk-window-frame::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; width: 3px; height: 100%;
  background: #8b6914;
  transform: translateX(-50%);
}
.desk-window-frame::after {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0; height: 3px;
  background: #8b6914;
  transform: translateY(-50%);
}

.desk-sky {
  width: 100%; height: 100%;
  background: linear-gradient(180deg, #87ceeb 0%, #b0dcf0 100%);
  position: relative;
  overflow: hidden;
}

.desk-cloud {
  position: absolute;
  background: white;
  border-radius: 50px;
  opacity: 0.85;
}
.desk-cloud::before, .desk-cloud::after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 50%;
}
.cloud-1 { width: 40%; height: 25%; top: 20%; left: -5%; animation: cloudDrift 18s linear infinite; }
.cloud-1::before { width: 60%; height: 120%; top: -50%; left: 10%; }
.cloud-1::after { width: 50%; height: 110%; top: -40%; left: 35%; }
.cloud-2 { width: 30%; height: 20%; top: 55%; left: 110%; animation: cloudDrift 26s linear infinite reverse; opacity: 0.7; }
.cloud-2::before { width: 55%; height: 100%; top: -45%; left: 8%; }

@keyframes cloudDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(200%); }
}

.desk-picture-frame {
  position: absolute;
  top: 10%; right: 5%;
  width: 15%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, #f9e4b7 0%, #e8d5a0 100%);
  border: 5px solid #6b4c1e;
  box-shadow: 3px 3px 8px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}

.desk-clock-wall {
  position: absolute;
  top: 6%; right: 25%;
  width: 8%;
  aspect-ratio: 1;
  background: #f5f0e8;
  border: 3px solid #6b4c1e;
  border-radius: 50%;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.clock-face {
  position: relative;
  width: 100%; height: 100%;
}
.clock-hand {
  position: absolute;
  bottom: 50%; left: 50%;
  transform-origin: bottom center;
  border-radius: 2px;
}
.clock-hour {
  width: 3px; height: 28%;
  background: #222;
  margin-left: -1.5px;
}
.clock-minute {
  width: 2px; height: 38%;
  background: #444;
  margin-left: -1px;
}
.clock-second {
  width: 1px; height: 40%;
  background: #cc2200;
  margin-left: -0.5px;
}
.clock-center {
  position: absolute;
  top: 50%; left: 50%;
  width: 6px; height: 6px;
  background: #222;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.desk-surface {
  flex: 1;
  position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.04) 0px, rgba(0,0,0,0.04) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(180deg, rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 1px, transparent 1px, transparent 40px),
    linear-gradient(160deg, #c8a056 0%, #b07820 25%, #d4a040 50%, #a06018 75%, #c09030 100%);
  border-top: 4px solid #8b5e1a;
}

/* ── Desk Items ──────────────────────────────────────────────────────────── */
.desk-item {
  position: absolute;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.desk-item:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
  z-index: 5;
}

.desk-item-label {
  font-size: 0.6rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  text-align: center;
  margin-top: 0.15rem;
  white-space: nowrap;
  background: rgba(0,0,0,0.3);
  border-radius: 2px;
  padding: 1px 3px;
}

/* Tray (In/Out Box) */
.mc-tray {
  width: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mc-tray-box {
  background: linear-gradient(180deg, #d0c8b8 0%, #b8b0a0 100%);
  border: 2px solid #888;
  border-top: 2px solid #e0d8c8;
  border-left: 2px solid #e0d8c8;
  height: 1.2rem;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.5rem;
  font-weight: bold;
  color: #444;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  position: relative;
}
.mc-tray-box::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 4px; right: 4px; height: 3px;
  background: #a09080;
  border-radius: 0 0 2px 2px;
}

.mc-tray-paper {
  width: 90%;
  height: 0.5rem;
  background: #f5f5f0;
  border: 1px solid #ccc;
  margin: 0 auto;
  transform: translateY(1px);
}

/* Notebook */
.mc-notebook {
  width: 4.5rem;
  height: 5.5rem;
  background: linear-gradient(180deg, #4a7c4e 0%, #3a6c3e 100%);
  border: 2px solid #2a4c2e;
  border-radius: 2px 6px 6px 2px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}
.mc-notebook::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0.6rem;
  background: repeating-linear-gradient(180deg,
    #2a4c2e 0%, #2a4c2e 4px,
    #5a9c5e 4px, #5a9c5e 8px,
    #2a4c2e 8px, #2a4c2e 12px
  );
}
.mc-notebook-lines {
  position: absolute;
  left: 0.7rem; right: 0.1rem;
  top: 0.3rem; bottom: 0.3rem;
  background: repeating-linear-gradient(180deg,
    #f5f5f0 0px, #f5f5f0 8px,
    #b0c8ff 8px, #b0c8ff 9px
  );
  border-radius: 0 4px 4px 0;
}

/* Datebook */
.mc-datebook {
  width: 4.5rem;
  height: 5.5rem;
  background: linear-gradient(160deg, #5a3010 0%, #3a1c06 100%);
  border: 2px solid #2a1006;
  border-radius: 4px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}
.mc-datebook::before {
  content: '2026';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #d4a040;
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 1px;
}
.mc-datebook-spine {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0.4rem;
  background: #2a1006;
}
.mc-datebook-band {
  position: absolute;
  top: 40%; left: 0; right: 0;
  height: 0.2rem;
  background: #d4a040;
}

/* Address Book */
.mc-addrbook {
  width: 4.5rem;
  height: 5.5rem;
  background: linear-gradient(160deg, #8b3a3a 0%, #6b1a1a 100%);
  border: 2px solid #4a0a0a;
  border-radius: 4px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-end;
}
.mc-addrbook-tabs {
  position: absolute;
  right: 0; top: 5%; bottom: 5%;
  width: 0.7rem;
  display: flex; flex-direction: column; gap: 1px;
}
.mc-addrbook-tab {
  flex: 1;
  background: #f5e6d0;
  font-size: 0.3rem;
  text-align: center;
  display: flex; align-items: center; justify-content: center;
  color: #333;
}

/* Name Card */
.mc-namecard {
  width: 5.5rem;
  height: 3rem;
  background: #f5f0e8;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.25), 1px 1px 0 #fff inset;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  padding: 0.2rem 0.3rem;
  overflow: hidden;
}
.mc-namecard-name {
  font-size: 0.5rem;
  font-weight: bold;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
}
.mc-namecard-info {
  font-size: 0.35rem;
  color: #666;
  white-space: nowrap;
}

/* Stationery */
.mc-stationery {
  width: 4.5rem;
  height: 5.5rem;
  position: relative;
}
.mc-paper {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  width: 85%;
  height: 85%;
}
.mc-paper:nth-child(1) { top: 0; left: 8%; }
.mc-paper:nth-child(2) { top: 4%; left: 4%; }
.mc-paper:nth-child(3) { top: 8%; left: 0; z-index: 3; }

.mc-stamp {
  width: 1.5rem;
  height: 1.8rem;
  background: linear-gradient(135deg, #cc4444 0%, #991111 100%);
  border: 2px dotted #cc8888;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  color: white;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

/* Phone */
.mc-phone {
  width: 5rem;
  height: 3.5rem;
  background: linear-gradient(160deg, #888 0%, #555 100%);
  border: 2px solid #333;
  border-radius: 6px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}
.mc-phone::before {
  content: '';
  position: absolute;
  top: 15%; left: 10%; right: 50%;
  bottom: 15%;
  background: linear-gradient(180deg, #aaa 0%, #777 100%);
  border-radius: 20px 20px 10px 10px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}
.mc-phone-keypad {
  position: absolute;
  top: 10%; right: 5%;
  width: 42%; height: 80%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
}
.mc-phone-key {
  background: #d0d0d0;
  border: 1px solid #888;
  border-radius: 1px;
  font-size: 0.25rem;
  display: flex; align-items: center; justify-content: center;
  color: #222;
}

/* Desk lamp */
.mc-desklamp {
  width: 3rem;
  height: 5rem;
  position: relative;
}
.mc-desklamp-base {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 80%; height: 0.6rem;
  background: linear-gradient(180deg, #888 0%, #555 100%);
  border-radius: 3px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}
.mc-desklamp-arm {
  position: absolute;
  bottom: 0.6rem; left: 50%;
  width: 0.25rem; height: 60%;
  background: #777;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-10deg);
}
.mc-desklamp-arm2 {
  position: absolute;
  bottom: 50%; left: 40%;
  width: 0.25rem; height: 40%;
  background: #777;
  transform-origin: bottom left;
  transform: rotate(30deg);
}
.mc-desklamp-shade {
  position: absolute;
  top: 0; left: 10%;
  width: 80%; height: 1.2rem;
  background: linear-gradient(180deg, #ccaa00 0%, #886600 100%);
  clip-path: polygon(10% 0%, 90% 0%, 100% 100%, 0% 100%);
  box-shadow: 0 2px 6px rgba(255,220,0,0.4);
}

/* ── Hallway Scene ───────────────────────────────────────────────────────── */
#scene-hallway {
  width: 100%; height: 100%;
  position: relative;
  background: linear-gradient(180deg, #f0e0c8 0%, #e0c8a0 100%);
  overflow: hidden;
}

.hallway-floor {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 35%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.08) 0px, rgba(0,0,0,0.08) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(180deg, rgba(0,0,0,0.06) 0px, rgba(0,0,0,0.06) 1px, transparent 1px, transparent 40px),
    linear-gradient(180deg, #c8a870 0%, #b09060 100%);
}

.hallway-ceiling {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 12%;
  background: linear-gradient(180deg, #e8d8b8 0%, #d8c8a0 100%);
  border-bottom: 3px solid #c0a870;
}

.hallway-left-wall {
  position: absolute;
  left: 0; top: 12%; bottom: 35%;
  width: 15%;
  background: linear-gradient(90deg, #c8a870 0%, #e0c8a0 100%);
  border-right: 3px solid #b09060;
}
.hallway-right-wall {
  position: absolute;
  right: 0; top: 12%; bottom: 35%;
  width: 15%;
  background: linear-gradient(270deg, #c8a870 0%, #e0c8a0 100%);
  border-left: 3px solid #b09060;
}

.hallway-wainscot-left {
  position: absolute;
  left: 0; bottom: 35%; width: 15%; height: 20%;
  background: linear-gradient(90deg, #a08050 0%, #c0a070 100%);
  border-top: 2px solid #806040;
  border-right: 3px solid #b09060;
}
.hallway-wainscot-right {
  position: absolute;
  right: 0; bottom: 35%; width: 15%; height: 20%;
  background: linear-gradient(270deg, #a08050 0%, #c0a070 100%);
  border-top: 2px solid #806040;
  border-left: 3px solid #b09060;
}

.hallway-perspective-lines {
  position: absolute;
  left: 15%; right: 15%;
  top: 12%; bottom: 35%;
}
.hallway-top-border {
  position: absolute;
  left: 15%; right: 15%;
  top: 12%; height: 4px;
  background: linear-gradient(90deg, #806040 0%, #c0a070 50%, #806040 100%);
}
.hallway-bottom-border {
  position: absolute;
  left: 15%; right: 15%;
  bottom: 35%; height: 4px;
  background: linear-gradient(90deg, #806040 0%, #c0a070 50%, #806040 100%);
}

.hallway-end {
  position: absolute;
  left: 32%; right: 32%;
  top: 18%; bottom: 38%;
  background: linear-gradient(180deg, #eddcb5 0%, #d4b896 100%);
  border: 3px solid #b09060;
  cursor: pointer;
  overflow: hidden;
  transition: filter 0.15s;
}
.hallway-end:hover { filter: brightness(1.1); }
.hallway-end-desk-preview {
  width: 100%; height: 100%;
  background: linear-gradient(160deg, #c8a056 0%, #b07820 25%, #d4a040 50%, #a06018 75%, #c09030 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-direction: column; gap: 0.2rem;
}
.hallway-end-label {
  font-size: 0.7rem; font-weight: bold; color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.hallway-door {
  position: absolute;
  bottom: 35%;
  cursor: pointer;
  transition: filter 0.15s;
}
.hallway-door:hover { filter: brightness(1.1); }

.hallway-door-left {
  left: 16%;
  width: 14%;
  bottom: 35%;
  top: 22%;
}
.hallway-door-right {
  right: 16%;
  width: 14%;
  bottom: 35%;
  top: 22%;
}

.door-frame {
  width: 100%; height: 100%;
  background: linear-gradient(180deg, #8b6914 0%, #6b4c10 100%);
  border: 3px solid #5a3c0a;
  border-radius: 3px 3px 0 0;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
}
.door-panel {
  background: linear-gradient(160deg, #7a5c14 0%, #5a3c08 100%);
  width: 80%;
  border: 2px solid #4a2c04;
  border-radius: 2px;
  flex: 1;
  margin: 4px 4px 4px 4px;
  position: relative;
}
.door-knob {
  position: absolute;
  right: 8%; top: 50%;
  width: 0.5rem; height: 0.5rem;
  background: radial-gradient(circle at 35% 35%, #f0d080, #c09020);
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}
.door-sign {
  font-size: 0.5rem;
  font-weight: bold;
  color: #f5e6c8;
  text-align: center;
  padding: 0.2rem;
  background: rgba(0,0,0,0.2);
  width: 100%;
  letter-spacing: 0.05em;
}

.hallway-lamp {
  position: absolute;
  top: 14%;
  width: 3%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hallway-lamp-left { left: 22%; }
.hallway-lamp-right { right: 22%; }
.lamp-pole { width: 0.2rem; height: 6vh; background: #888; }
.lamp-shade {
  width: 1.5rem; height: 0.8rem;
  background: linear-gradient(180deg, #ccaa00 0%, #886600 100%);
  clip-path: polygon(0% 0%, 100% 0%, 80% 100%, 20% 100%);
  margin-top: -0.1rem;
}

.hallway-painting {
  position: absolute;
  background: #f5f0e8;
  border: 4px solid #6b4c1e;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.painting-1 { top: 15%; left: 20%; width: 8%; aspect-ratio: 3/4; }
.painting-2 { top: 15%; right: 20%; width: 8%; aspect-ratio: 3/4; }

.hallway-carpet {
  position: absolute;
  left: 32%; right: 32%;
  bottom: 35%; height: 6%;
  background: repeating-linear-gradient(90deg, #8b1a1a 0%, #8b1a1a 10%, #cc2222 10%, #cc2222 20%);
  border-top: 2px solid #661010;
}

/* ── Downtown Scene ──────────────────────────────────────────────────────── */
#scene-downtown {
  width: 100%; height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.downtown-sky {
  flex: 0 0 35%;
  background: linear-gradient(180deg, #4a90d9 0%, #87ceeb 70%, #b0dce8 100%);
  position: relative;
  overflow: hidden;
}

.downtown-cloud {
  position: absolute;
  background: white;
  border-radius: 50px;
  opacity: 0.9;
}
.downtown-cloud::before, .downtown-cloud::after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 50%;
}
.dc-1 { width: 12%; height: 40%; top: 20%; left: 10%; animation: cloudDrift 22s linear infinite; }
.dc-1::before { width: 55%; height: 110%; top: -50%; left: 15%; }
.dc-1::after { width: 45%; height: 100%; top: -40%; left: 45%; }
.dc-2 { width: 9%; height: 35%; top: 40%; right: 15%; animation: cloudDrift 30s linear infinite reverse; }
.dc-2::before { width: 50%; height: 100%; top: -45%; left: 10%; }

.downtown-buildings {
  flex: 1;
  display: flex;
  align-items: flex-end;
  position: relative;
  gap: 0;
}

.downtown-building {
  flex: 1;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transition: filter 0.15s;
}
.downtown-building:hover { filter: brightness(1.1); }
.downtown-building:hover .bld-sign { transform: scale(1.05); }

.bld-body {
  width: 85%;
  margin: 0 auto;
  position: relative;
  border-top: 3px solid rgba(0,0,0,0.2);
  border-left: 3px solid rgba(255,255,255,0.3);
  border-right: 3px solid rgba(0,0,0,0.2);
}

.bld-windows-row {
  display: flex;
  justify-content: space-evenly;
  padding: 0.3rem 0.2rem;
}
.bld-win {
  width: 14%; aspect-ratio: 0.8;
  border: 1px solid rgba(0,0,0,0.2);
  background: rgba(255,255,255,0.3);
}
.bld-win.lit { background: rgba(255,248,150,0.6); }

.bld-sign {
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.65rem;
  font-weight: bold;
  width: 90%;
  text-align: center;
  padding: 0.15rem;
  border-radius: 2px;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.03em;
  transition: transform 0.15s;
}

/* Post Office */
.bld-postoffice .bld-body {
  height: 55%;
  background: linear-gradient(180deg, #c84040 0%, #8b2020 100%);
}
/* Book Store */
.bld-bookstore .bld-body {
  height: 48%;
  background: linear-gradient(180deg, #2a7c4a 0%, #1a5c30 100%);
}
/* AT&T */
.bld-att .bld-body {
  height: 62%;
  background: linear-gradient(180deg, #1a4890 0%, #0a2860 100%);
}
.att-globe {
  position: absolute;
  top: 5%; left: 50%;
  transform: translateX(-50%);
  width: 30%; aspect-ratio: 1;
  border: 2px solid #4090d8;
  border-radius: 50%;
  overflow: hidden;
}
.att-globe::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; right: 0; bottom: 0;
  border-left: 2px solid #4090d8;
  border-radius: 0 50% 50% 0;
}
.att-globe::after {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 2px;
  background: #4090d8;
}
/* General Store */
.bld-general .bld-body {
  height: 44%;
  background: linear-gradient(180deg, #d4a020 0%, #a07010 100%);
}
/* Bank */
.bld-bank .bld-body {
  height: 52%;
  background: linear-gradient(180deg, #c8c0b0 0%, #908880 100%);
}
.bank-columns {
  display: flex;
  justify-content: space-evenly;
  padding: 0 0.3rem;
  height: 70%;
  align-items: stretch;
}
.bank-col {
  width: 0.3rem;
  background: linear-gradient(90deg, #f0e8d8 0%, #d8d0c0 50%, #e8e0d0 100%);
  border-radius: 1px 1px 0 0;
}

.downtown-sidewalk {
  flex: 0 0 14%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.05) 0px, rgba(0,0,0,0.05) 1px, transparent 1px, transparent 50px),
    linear-gradient(180deg, #b0b0a0 0%, #989890 100%);
  border-top: 3px solid #888880;
  position: relative;
  display: flex; align-items: center; justify-content: space-around;
}

.downtown-lamp-post {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.dlp-pole { width: 0.2rem; height: 80%; background: #555; margin-top: auto; }
.dlp-arm {
  width: 1.5rem; height: 0.2rem;
  background: #555;
  margin-top: -0.2rem;
  border-radius: 1px;
}
.dlp-light {
  width: 0.8rem; height: 0.4rem;
  background: #ffe87c;
  border-radius: 2px;
  box-shadow: 0 0 6px 2px rgba(255,230,100,0.4);
}

/* ── Game Room Scene ─────────────────────────────────────────────────────── */
#scene-gameroom {
  width: 100%; height: 100%;
  position: relative;
  overflow: hidden;
}

.gameroom-floor {
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 35%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 1px, transparent 1px, transparent 30px),
    repeating-linear-gradient(180deg, rgba(0,0,0,0.08) 0px, rgba(0,0,0,0.08) 1px, transparent 1px, transparent 30px),
    linear-gradient(180deg, #7a5a8a 0%, #5a3a6a 100%);
}
.gameroom-wall {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 35%;
  background: linear-gradient(180deg, #2a1a4a 0%, #3a2a5a 100%);
}
.gameroom-wall-border {
  position: absolute;
  left: 0; right: 0;
  bottom: 35%; height: 0.5rem;
  background: #9a78aa;
}

.arcade-cabinet {
  position: absolute;
  bottom: 35%; left: 8%;
  width: 16%;
  cursor: pointer;
  transition: filter 0.15s;
}
.arcade-cabinet:hover { filter: brightness(1.2); }
.arcade-top {
  background: linear-gradient(160deg, #cc4444 0%, #881111 100%);
  height: 3.5vw;
  border-radius: 4px 4px 0 0;
  border: 2px solid #440000;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.5rem; color: #ffcc00; font-weight: bold;
  text-shadow: 0 0 4px #ff4400;
}
.arcade-screen-area {
  background: #111;
  height: 5vw;
  border: 3px solid #333;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.arcade-screen-glow {
  width: 85%; height: 85%;
  background: linear-gradient(135deg, #00ff44 0%, #00cc33 40%, #004422 100%);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.4rem; color: #88ff88;
  font-family: monospace;
}
.arcade-body {
  background: linear-gradient(160deg, #cc4444 0%, #881111 100%);
  height: 4vw;
  border: 2px solid #440000;
  border-top: none;
  display: flex; align-items: center; justify-content: center; gap: 0.3rem;
}
.arcade-btn {
  width: 0.6rem; height: 0.6rem;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.4);
}
.arcade-base {
  background: #661111;
  height: 1.5vw;
  border: 2px solid #440000;
  border-top: none;
  border-radius: 0 0 3px 3px;
}

.gameroom-table {
  position: absolute;
  bottom: 35%; right: 8%;
  width: 30%;
  cursor: pointer;
  transition: filter 0.15s;
}
.gameroom-table:hover { filter: brightness(1.15); }
.table-top {
  background: linear-gradient(180deg, #8b6914 0%, #6b4c0e 100%);
  height: 1vw;
  border-radius: 4px;
  border: 2px solid #4a3008;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}
.table-board {
  position: absolute;
  top: 0; left: 10%; right: 10%;
  background: linear-gradient(135deg, #cc8822 0%, #996611 100%);
  height: 5vw;
  transform: translateY(-70%);
  border: 2px solid #664400;
  border-radius: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  padding: 2px;
}
.board-cell {
  background: #f5e6c8;
  border-radius: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.5rem;
}

.gameroom-poster {
  position: absolute;
  background: #f5f0e8;
  border: 3px solid #9a78aa;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-direction: column; gap: 0.1rem;
}
.poster-1 { top: 8%; left: 25%; width: 12%; aspect-ratio: 2/3; }
.poster-2 { top: 8%; right: 25%; width: 12%; aspect-ratio: 2/3; }
.poster-label {
  font-size: 0.35rem; font-weight: bold;
  color: #333; text-align: center;
}

.room-door-back {
  position: absolute;
  left: 40%; top: 15%; width: 20%; bottom: 35%;
  cursor: pointer;
  transition: filter 0.15s;
}
.room-door-back:hover { filter: brightness(1.15); }

/* ── Library Scene ───────────────────────────────────────────────────────── */
#scene-library {
  width: 100%; height: 100%;
  position: relative;
  overflow: hidden;
}

.library-floor {
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 30%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.06) 0px, rgba(0,0,0,0.06) 1px, transparent 1px, transparent 50px),
    linear-gradient(180deg, #c8a870 0%, #a08050 100%);
}
.library-wall {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 30%;
  background: linear-gradient(180deg, #f0e0c8 0%, #eddcb5 100%);
}
.library-wall-border {
  position: absolute;
  left: 0; right: 0;
  bottom: 30%; height: 0.4rem;
  background: #b09060;
}

.bookshelf {
  position: absolute;
  bottom: 30%;
  background: linear-gradient(180deg, #8b6914 0%, #6b4c10 100%);
  border: 2px solid #4a3008;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px;
}
.shelf-1 { left: 2%; width: 25%; height: 60%; }
.shelf-2 { right: 2%; width: 25%; height: 60%; }

.shelf-row {
  display: flex;
  flex: 1;
  gap: 1px;
  background: #5a3c0a;
}
.book-spine {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  border-radius: 1px;
  transition: filter 0.15s;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.book-spine:hover { filter: brightness(1.3); transform: scaleY(1.03); }
.book-title-vert {
  writing-mode: vertical-rl;
  font-size: 0.3rem;
  color: rgba(255,255,255,0.8);
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 100%;
}

.library-desk {
  position: absolute;
  bottom: 30%; left: 32%; right: 32%;
}
.lib-desk-top {
  background: linear-gradient(180deg, #8b6914 0%, #6b4c10 100%);
  height: 0.7rem;
  border-radius: 3px;
  border: 2px solid #4a3008;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}
.lib-desk-lamp {
  position: absolute;
  bottom: 0.7rem;
  right: 10%;
  width: 10%;
  height: 5vw;
  cursor: pointer;
  transition: filter 0.15s;
}
.lib-desk-lamp:hover { filter: brightness(1.2); }

.library-reading-chair {
  position: absolute;
  bottom: 30%; left: 30%;
  width: 6%;
}
.chair-back {
  background: linear-gradient(160deg, #8b3a3a 0%, #6b1a1a 100%);
  height: 4vw;
  border-radius: 3px 3px 0 0;
  border: 2px solid #4a0a0a;
}
.chair-seat {
  background: linear-gradient(180deg, #8b3a3a 0%, #6b1a1a 100%);
  height: 1.5vw;
  border: 2px solid #4a0a0a;
}
.chair-legs {
  display: flex; justify-content: space-between; padding: 0 10%;
}
.chair-leg {
  width: 0.2rem; height: 1vw;
  background: #4a0a0a;
}

/* ── Windows (app dialogs) ───────────────────────────────────────────────── */
.mc-window {
  position: fixed;
  background: #f5f0e8;
  border: 2px solid #808080;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-radius: 6px;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 280px;
  min-height: 200px;
  z-index: 100;
}

.mc-window-titlebar {
  background: linear-gradient(90deg, #0055bb 0%, #0033aa 40%, #0044cc 100%);
  padding: 0.25rem 0.4rem;
  display: flex;
  align-items: center;
  cursor: move;
  flex-shrink: 0;
  user-select: none;
}

.mc-window-title {
  flex: 1;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-window-close {
  background: #c0c0c0;
  border: 1px solid #808080;
  border-top-color: #fff;
  border-left-color: #fff;
  width: 1.1rem; height: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 2px;
  color: #333;
  flex-shrink: 0;
}
.mc-window-close:hover { background: #cc2222; color: white; }

.mc-window-content {
  flex: 1;
  overflow: auto;
  padding: 0.5rem;
  background: #f8f4ec;
}

/* ── Notebook App ─────────────────────────────────────────────────────────── */
.mc-nb-controls {
  display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #ccc;
}
.mc-nb-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 2px;
}
.mc-nb-btn:hover { background: #c0bdb5; }
.mc-nb-page-indicator {
  font-size: 0.65rem;
  color: #666;
}
.mc-nb-textarea {
  width: 100%;
  height: calc(100% - 2.5rem);
  background: repeating-linear-gradient(
    180deg,
    #f8f4ec 0px, #f8f4ec 23px,
    #b0b8d8 23px, #b0b8d8 24px
  );
  border: none;
  outline: none;
  resize: none;
  font-family: 'Georgia', serif;
  font-size: 0.85rem;
  line-height: 24px;
  padding: 0 0.5rem;
  color: #222;
}

/* ── Datebook App ────────────────────────────────────────────────────────── */
.mc-db-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.4rem;
  padding: 0.2rem;
  background: #3a1c06;
  color: #d4a040;
  border-radius: 3px;
}
.mc-db-nav {
  background: #5a3c1a;
  border: 1px solid #3a2008;
  color: #d4a040;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
  border-radius: 2px;
}
.mc-db-nav:hover { background: #6a4c2a; }
.mc-db-month-label { font-weight: bold; font-size: 0.8rem; }
.mc-db-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.mc-db-dow {
  text-align: center;
  font-size: 0.55rem;
  font-weight: bold;
  color: #666;
  padding: 0.15rem 0;
  background: #e8e0d0;
  border-radius: 2px;
}
.mc-db-day {
  text-align: center;
  font-size: 0.65rem;
  padding: 0.25rem 0.15rem;
  background: #f8f4ec;
  border: 1px solid #ddd;
  cursor: pointer;
  border-radius: 2px;
  min-height: 2rem;
  position: relative;
  transition: background 0.1s;
}
.mc-db-day:hover { background: #e8d8c0; }
.mc-db-day.today { background: #ffd080; border-color: #c08000; font-weight: bold; }
.mc-db-day.has-events::after {
  content: '●';
  position: absolute;
  bottom: 0.1rem; right: 0.15rem;
  font-size: 0.4rem;
  color: #c84040;
}
.mc-db-day.empty { background: #f0ece4; cursor: default; }
.mc-db-event-panel {
  margin-top: 0.4rem;
  padding: 0.3rem;
  background: #f0e8d8;
  border: 1px solid #ccc;
  border-radius: 3px;
  min-height: 3rem;
}
.mc-db-event-title { font-size: 0.65rem; font-weight: bold; color: #5a3c10; margin-bottom: 0.2rem; }
.mc-db-event-item {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.65rem; color: #333;
  padding: 0.15rem 0;
  border-bottom: 1px solid #ddd;
}
.mc-db-event-del { background: none; border: none; cursor: pointer; color: #c84040; font-size: 0.7rem; }
.mc-db-add-row {
  display: flex; gap: 0.3rem; margin-top: 0.3rem;
}
.mc-db-input {
  flex: 1;
  border: 1px solid #aaa;
  border-radius: 2px;
  padding: 0.15rem 0.3rem;
  font-size: 0.65rem;
  background: #fff;
}
.mc-db-add-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  cursor: pointer;
  border-radius: 2px;
}

/* ── Address Book App ────────────────────────────────────────────────────── */
.mc-ab-layout {
  display: flex; height: 100%; gap: 0.4rem;
}
.mc-ab-list-pane {
  width: 40%; display: flex; flex-direction: column; overflow: hidden;
}
.mc-ab-alpha-strip {
  display: flex; flex-wrap: wrap; gap: 1px; margin-bottom: 0.2rem;
}
.mc-ab-alpha-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  font-size: 0.45rem;
  width: 1rem; height: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: 1px;
}
.mc-ab-alpha-btn:hover, .mc-ab-alpha-btn.active { background: #a0a89c; }
.mc-ab-list { flex: 1; overflow-y: auto; border: 1px solid #ccc; background: #fff; }
.mc-ab-contact-item {
  padding: 0.25rem 0.3rem;
  font-size: 0.65rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-ab-contact-item:hover { background: #e8d8c0; }
.mc-ab-contact-item.selected { background: #0055bb; color: white; }
.mc-ab-detail-pane {
  flex: 1; overflow-y: auto;
  background: #f8f4ec;
  border: 1px solid #ccc;
  padding: 0.3rem;
  position: relative;
}
.mc-ab-detail-name {
  font-size: 0.9rem; font-weight: bold; color: #222;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.2rem;
}
.mc-ab-detail-field { font-size: 0.65rem; color: #555; margin-bottom: 0.1rem; }
.mc-ab-detail-field span { color: #222; }
.mc-ab-detail-btns {
  display: flex; gap: 0.3rem; margin-top: 0.4rem;
}
.mc-ab-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.2rem 0.5rem;
  font-size: 0.65rem;
  cursor: pointer;
  border-radius: 2px;
}
.mc-ab-btn:hover { background: #c0bdb5; }
.mc-ab-btn.danger { border-color: #880000; color: #880000; }
.mc-ab-btn.danger:hover { background: #cc2222; color: white; }
.mc-ab-add-form {
  margin-top: 0.3rem;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.mc-ab-field-row { display: flex; flex-direction: column; gap: 0.1rem; }
.mc-ab-field-label { font-size: 0.55rem; color: #666; }
.mc-ab-field-input {
  border: 1px solid #aaa;
  border-radius: 2px;
  padding: 0.15rem 0.3rem;
  font-size: 0.65rem;
  background: #fff;
}

/* ── Inbox/Outbox App ────────────────────────────────────────────────────── */
.mc-mail-list { overflow-y: auto; border-bottom: 1px solid #ccc; }
.mc-mail-item {
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.3rem;
  align-items: center;
  transition: background 0.1s;
}
.mc-mail-item:hover { background: #e8d8c0; }
.mc-mail-item.selected { background: #0055bb; color: white; }
.mc-mail-item.unread { font-weight: bold; }
.mc-mail-sender { font-size: 0.65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-mail-subject { font-size: 0.65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #555; }
.mc-mail-item.selected .mc-mail-subject { color: #cce; }
.mc-mail-date { font-size: 0.55rem; color: #888; white-space: nowrap; }
.mc-mail-item.selected .mc-mail-date { color: #aae; }
.mc-mail-icon { font-size: 0.9rem; }
.mc-mail-reading-pane {
  flex: 1; overflow-y: auto;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid #ccc;
  margin-top: 0.3rem;
  font-size: 0.7rem;
  line-height: 1.5;
}
.mc-mail-reading-from { font-weight: bold; margin-bottom: 0.2rem; color: #0055bb; }
.mc-mail-reading-subj { font-weight: bold; margin-bottom: 0.3rem; }
.mc-mail-reading-body { white-space: pre-wrap; color: #333; }

/* ── Compose App ─────────────────────────────────────────────────────────── */
.mc-compose-form {
  display: flex; flex-direction: column; height: 100%; gap: 0.3rem;
}
.mc-compose-field-row {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid #ddd;
}
.mc-compose-label { font-size: 0.65rem; font-weight: bold; color: #555; width: 3.5rem; flex-shrink: 0; }
.mc-compose-input {
  flex: 1;
  border: none; border-bottom: 1px solid #aaa;
  background: transparent;
  padding: 0.1rem 0.2rem;
  font-size: 0.7rem;
  outline: none;
}
.mc-compose-body {
  flex: 1;
  background: repeating-linear-gradient(180deg, #fffdf8 0px, #fffdf8 23px, #c0c8e8 23px, #c0c8e8 24px);
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.3rem 0.5rem;
  font-family: 'Georgia', serif;
  font-size: 0.8rem;
  line-height: 24px;
  resize: none;
  outline: none;
}
.mc-compose-footer {
  display: flex; justify-content: flex-end; gap: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid #ddd;
}
.mc-compose-send-btn {
  background: linear-gradient(180deg, #d4d0c8 0%, #b8b4ac 100%);
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.25rem 0.8rem;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  display: flex; align-items: center; gap: 0.3rem;
}
.mc-compose-send-btn:hover { background: linear-gradient(180deg, #c8c4bc 0%, #aaa8a0 100%); }

/* ── Name Card App ───────────────────────────────────────────────────────── */
.mc-nc-card {
  background: #f8f4ec;
  border: 2px solid #b0a080;
  border-radius: 6px;
  padding: 0.8rem;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
  margin-bottom: 0.4rem;
}
.mc-nc-field-row { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.3rem; }
.mc-nc-label { font-size: 0.55rem; color: #888; text-transform: uppercase; letter-spacing: 0.05em; }
.mc-nc-input {
  border: none; border-bottom: 1px solid #ccc;
  background: transparent;
  font-size: 0.75rem;
  padding: 0.1rem 0;
  outline: none;
  color: #222;
  width: 100%;
}
.mc-nc-input.big { font-size: 1rem; font-weight: bold; }
.mc-nc-save-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.3rem 1rem;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 3px;
}
.mc-nc-save-btn:hover { background: #c0bdb5; }

/* ── Calculator App ──────────────────────────────────────────────────────── */
.mc-calc {
  display: flex; flex-direction: column; gap: 0.3rem;
}
.mc-calc-display {
  background: #c8e8a8;
  border: 2px solid #888;
  border-top-color: #444; border-left-color: #444;
  padding: 0.3rem 0.5rem;
  font-family: monospace;
  font-size: 1.2rem;
  text-align: right;
  color: #004400;
  border-radius: 3px;
  min-height: 2rem;
  word-break: break-all;
}
.mc-calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.2rem;
}
.mc-calc-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.4rem;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  text-align: center;
}
.mc-calc-btn:active { border-top-color: #808080; border-left-color: #808080; border-right-color: #fff; border-bottom-color: #fff; }
.mc-calc-btn.op { background: #c0bdb5; color: #0033aa; }
.mc-calc-btn.eq { background: #0033aa; color: white; border-color: #0055ff; }
.mc-calc-btn.cl { background: #c84040; color: white; border-color: #ff4444; }

/* ── Tictactoe App ────────────────────────────────────────────────────────── */
.mc-ttt {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.3rem;
}
.mc-ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 5rem);
  grid-template-rows: repeat(3, 5rem);
  gap: 3px;
  background: #333;
  border: 3px solid #333;
  border-radius: 3px;
}
.mc-ttt-cell {
  background: #f8f4ec;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 1px;
}
.mc-ttt-cell:hover { background: #e8d8c0; }
.mc-ttt-cell.x-mark { color: #cc2222; }
.mc-ttt-cell.o-mark { color: #0055bb; }
.mc-ttt-status { font-size: 0.8rem; font-weight: bold; color: #333; }
.mc-ttt-reset {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.3rem 1rem;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 3px;
}

/* ── Book Reader ─────────────────────────────────────────────────────────── */
.mc-book-reader {
  padding: 0.5rem;
  background: repeating-linear-gradient(180deg, #fffdf8 0px, #fffdf8 23px, #c0c8e8 23px, #c0c8e8 24px);
  font-family: 'Georgia', serif;
  font-size: 0.8rem;
  line-height: 24px;
  color: #222;
  white-space: pre-wrap;
  min-height: 8rem;
  border: 1px solid #ccc;
  border-radius: 3px;
}
.mc-book-title {
  font-size: 0.9rem;
  font-weight: bold;
  color: #5a3c10;
  margin-bottom: 0.4rem;
  text-align: center;
}
.mc-book-author { font-size: 0.65rem; color: #888; text-align: center; margin-bottom: 0.5rem; }

/* ── Tote Bag Panel ──────────────────────────────────────────────────────── */
#mc-tote-panel {
  position: fixed;
  right: -18rem;
  top: 0;
  bottom: 5.5rem;
  width: 17rem;
  background: #f5e6c8;
  border-left: 3px solid #b09060;
  box-shadow: -4px 0 12px rgba(0,0,0,0.25);
  z-index: 200;
  display: flex; flex-direction: column;
  transition: right 0.3s ease;
}
#mc-tote-panel.open { right: 0; }
.mc-tote-header {
  background: #8b6914;
  color: #f5e6c8;
  padding: 0.4rem 0.6rem;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: bold; font-size: 0.85rem;
}
.mc-tote-close {
  background: none; border: none; color: #f5e6c8; font-size: 1rem; cursor: pointer;
}
.mc-tote-content { flex: 1; overflow-y: auto; padding: 0.5rem; }
.mc-tote-empty { color: #888; font-size: 0.7rem; text-align: center; margin-top: 2rem; }

/* ── Help Overlay ────────────────────────────────────────────────────────── */
#mc-help-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
#mc-help-overlay.visible { display: flex; }
.mc-help-box {
  background: #f5f0e8;
  border: 2px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  border-radius: 8px;
  padding: 1.2rem;
  max-width: 28rem;
  width: 90%;
  box-shadow: 6px 6px 16px rgba(0,0,0,0.4);
}
.mc-help-title {
  font-size: 1rem;
  font-weight: bold;
  color: #0033aa;
  margin-bottom: 0.6rem;
  border-bottom: 2px solid #0033aa;
  padding-bottom: 0.3rem;
}
.mc-help-body {
  font-size: 0.75rem;
  line-height: 1.6;
  color: #333;
}
.mc-help-body p { margin-bottom: 0.4rem; }
.mc-help-body ul { margin-left: 1rem; margin-bottom: 0.4rem; }
.mc-help-body li { margin-bottom: 0.15rem; }
.mc-help-close {
  margin-top: 0.8rem;
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.3rem 1.2rem;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 3px;
  display: block;
  margin-left: auto;
}
.mc-help-close:hover { background: #c0bdb5; }

/* ── Toast notification ──────────────────────────────────────────────────── */
.mc-toast {
  position: fixed;
  bottom: 6.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.75rem;
  z-index: 400;
  pointer-events: none;
  animation: toastFade 2.5s ease forwards;
}
@keyframes toastFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}

/* ── Miscellaneous ───────────────────────────────────────────────────────── */
.mc-tooltip {
  position: absolute;
  background: #ffffc0;
  border: 1px solid #888;
  padding: 0.2rem 0.4rem;
  font-size: 0.6rem;
  color: #222;
  border-radius: 2px;
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.mc-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 250;
  display: flex; align-items: center; justify-content: center;
}
.mc-dialog {
  background: #f5f0e8;
  border: 2px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  border-radius: 6px;
  padding: 1rem;
  max-width: 22rem;
  width: 90%;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.35);
}
.mc-dialog-title { font-size: 0.85rem; font-weight: bold; color: #0033aa; margin-bottom: 0.6rem; }
.mc-dialog-msg { font-size: 0.75rem; color: #333; margin-bottom: 0.8rem; line-height: 1.5; }
.mc-dialog-btns { display: flex; justify-content: flex-end; gap: 0.4rem; }
.mc-dialog-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  border-top-color: #fff; border-left-color: #fff;
  padding: 0.25rem 0.8rem;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 3px;
}
.mc-dialog-btn:hover { background: #c0bdb5; }
.mc-dialog-btn.primary { background: #0033aa; color: white; border-color: #0055ff; }
.mc-dialog-btn.primary:hover { background: #0044cc; }
