* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #1b2838;
  font-family: Helvetica, Arial, "Segoe UI", sans-serif;
  overflow: hidden;
  user-select: none;
}

#viewport-stage {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#matlab-window {
  background: #f0f0f0;
  border: 1px solid #1883d7;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  transform-origin: center center;
}

#window-titlebar {
  height: 30px;
  background: #ffffff;
  border-bottom: 1px solid #d9d9d9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 8px;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 12px;
  color: #000000;
}

.titlebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.matlab-fig-icon {
  display: inline-flex;
  align-items: center;
}

.titlebar-buttons {
  display: flex;
  height: 100%;
}

.win-btn {
  width: 45px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #333333;
}

.win-close:hover {
  background: #e81123;
  color: #ffffff;
}

#figure-viewport {
  position: relative;
}

.matlab-figure {
  position: relative;
  display: none;
  background-color: blue;
  overflow: hidden;
}

.matlab-figure.active {
  display: block;
}

.uicontrol {
  position: absolute;
  font-family: Helvetica, Arial, sans-serif;
  color: #000000;
  margin: 0;
  line-height: 1.2;
}

.uicontrol-edit {
  background-color: #ffffff;
  border: 1px solid #7a7a7a;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 6px;
  overflow: hidden;
  word-break: break-word;
}

.uicontrol-text {
  background-color: #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 2px 6px;
  overflow: hidden;
}

.uicontrol-pushbutton {
  background-color: #f0f0f0;
  border: 1px solid #adadad;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2px 6px;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
}

.uicontrol-pushbutton:hover:not(.matlab-inactive):not(:disabled) {
  border-color: #0078d7;
  box-shadow: inset 0 0 0 1px #0078d7;
}

.uicontrol-pushbutton:active:not(.matlab-inactive):not(:disabled) {
  filter: brightness(0.95);
}

.matlab-inactive {
  pointer-events: none;
  cursor: default;
}

.uicontrol-pushbutton:disabled {
  cursor: default;
  color: #6d6d6d;
}

.img-btn {
  padding: 0;
  overflow: hidden;
}

.img-btn img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.board-tile {
  background-color: rgb(0, 255, 255);
}

.hidden {
  display: none !important;
}

/* ============================================================
   FIGURE 1: FirstRound.fig (112 x 32.3077 chars = 784 x 549 px)
   ============================================================ */
#fig-firstround {
  width: 784px;
  height: 549px;
}

#fr-edit1 {
  left: 31px;
  bottom: 219px;
  width: 496px;
  height: 48px;
  font-size: 13.33px;
}

#fr-pushbutton1 {
  left: 29px;
  bottom: 145px;
  width: 157px;
  height: 56px;
  font-size: 10.67px;
}

#fr-pushbutton2 {
  left: 201px;
  bottom: 145px;
  width: 158px;
  height: 56px;
  font-size: 10.67px;
}

#fr-pushbutton3 {
  left: 374px;
  bottom: 145px;
  width: 155px;
  height: 56px;
  font-size: 10.67px;
}

#fr-edit2 {
  left: 557px;
  bottom: 360px;
  width: 217px;
  height: 114px;
  font-size: 26.67px;
}

#fr-edit3 {
  left: 557px;
  bottom: 180px;
  width: 217px;
  height: 115px;
  font-size: 26.67px;
}

#fr-pushbutton6 {
  left: 512px;
  bottom: 343px;
  width: 240px;
  height: 125px;
  font-size: 26.67px;
}

#fr-pushbutton7 {
  left: 512px;
  bottom: 194px;
  width: 240px;
  height: 125px;
  font-size: 26.67px;
}

#fr-pushbutton8 {
  left: 512px;
  bottom: 35px;
  width: 240px;
  height: 125px;
  font-size: 26.67px;
}

#fr-text2 {
  left: 558px;
  bottom: 474px;
  width: 215px;
  height: 39px;
  font-size: 26.67px;
}

#fr-text3 {
  left: 558px;
  bottom: 293px;
  width: 214px;
  height: 39px;
  font-size: 26.67px;
}

#fr-text4 {
  left: 35px;
  bottom: 182px;
  width: 453px;
  height: 235px;
  font-size: 20px;
  justify-content: center;
  gap: 6px;
}

/* ============================================================
   FIGURE 2: secondround2.fig (174.1429 x 52.0588 chars = 1219 x 885 px)
   ============================================================ */
#fig-secondround2 {
  width: 1219px;
  height: 885px;
}

#sr-edit3 {
  left: 218px;
  bottom: 449px;
  width: 355px;
  height: 79px;
  font-size: 16px;
}

#sr-restart {
  left: 260px;
  bottom: 302px;
  width: 270px;
  height: 122px;
  font-size: 10.67px;
}

#sr-edit1 {
  left: 491px;
  bottom: 150px;
  width: 574px;
  height: 61px;
  font-size: 16px;
}

#sr-pushbutton4 {
  left: 547px;
  bottom: 606px;
  width: 271px;
  height: 278px;
  font-size: 10.67px;
}

#sr-pushbutton5 {
  left: 599px;
  bottom: 525px;
  width: 176px;
  height: 76px;
  font-size: 10.67px;
}

#sr-pushbutton6 {
  left: 599px;
  bottom: 449px;
  width: 176px;
  height: 76px;
  font-size: 10.67px;
}

#sr-pushbutton7 {
  left: 599px;
  bottom: 373px;
  width: 176px;
  height: 76px;
  font-size: 10.67px;
}

#sr-pushbutton8 {
  left: 599px;
  bottom: 297px;
  width: 176px;
  height: 76px;
  font-size: 10.67px;
}

#sr-pushbutton9 {
  left: 599px;
  bottom: 221px;
  width: 176px;
  height: 76px;
  font-size: 10.67px;
}

#sr-edit4 {
  left: 886px;
  bottom: 319px;
  width: 180px;
  height: 123px;
  font-size: 40px;
}

#sr-pushbutton1 {
  left: 487px;
  bottom: 68px;
  width: 175px;
  height: 58px;
  font-size: 10.67px;
}

#sr-pushbutton2 {
  left: 687px;
  bottom: 68px;
  width: 175px;
  height: 58px;
  font-size: 10.67px;
}

#sr-pushbutton3 {
  left: 887px;
  bottom: 68px;
  width: 175px;
  height: 58px;
  font-size: 10.67px;
}

#sr-pushbutton13 {
  left: 11px;
  bottom: 283px;
  width: 189px;
  height: 227px;
}

#sr-pushbutton10 {
  left: 333px;
  bottom: 316px;
  width: 124px;
  height: 103px;
  font-size: 10.67px;
}

#sr-text3 {
  left: 887px;
  bottom: 440px;
  width: 178px;
  height: 39px;
  font-size: 26.67px;
}

#sr-text4 {
  left: 21px;
  bottom: 571px;
  width: 454px;
  height: 226px;
  font-size: 20px;
  justify-content: center;
  gap: 2px;
}

#sr-pushbutton12 {
  left: 350px;
  bottom: 339px;
  width: 91px;
  height: 55px;
  font-size: 10.67px;
}

/* ============================================================
   FIGURE 3: finalround.fig (152.8571 x 38.4706 chars = 1070 x 654 px)
   ============================================================ */
#fig-finalround {
  width: 1070px;
  height: 654px;
}

#fn-Restart {
  left: 275px;
  bottom: 172px;
  width: 270px;
  height: 122px;
  font-size: 26.67px;
  z-index: 5;
}

#fn-edit1 {
  left: 455px;
  bottom: 97px;
  width: 549px;
  height: 62px;
  font-size: 16px;
}

#fn-pushbutton1 {
  left: 471px;
  bottom: 26px;
  width: 157px;
  height: 56px;
  font-size: 10.67px;
}

#fn-pushbutton2 {
  left: 653px;
  bottom: 26px;
  width: 158px;
  height: 56px;
  font-size: 10.67px;
}

#fn-pushbutton3 {
  left: 836px;
  bottom: 26px;
  width: 155px;
  height: 56px;
  font-size: 10.67px;
}

#fn-edit2 {
  left: 741px;
  bottom: 416px;
  width: 217px;
  height: 114px;
  font-size: 40px;
}

#fn-edit3 {
  left: 740px;
  bottom: 223px;
  width: 217px;
  height: 115px;
  font-size: 40px;
}

#fn-pushbutton6 {
  left: 53px;
  bottom: 139px;
  width: 159px;
  height: 237px;
}

#fn-edit4 {
  left: 246px;
  bottom: 311px;
  width: 328px;
  height: 63px;
  font-size: 14.67px;
}

#fn-text2 {
  left: 741px;
  bottom: 529px;
  width: 216px;
  height: 39px;
  font-size: 26.67px;
}

#fn-text3 {
  left: 740px;
  bottom: 338px;
  width: 216px;
  height: 39px;
  font-size: 26.67px;
}

#fn-text4 {
  left: 39px;
  bottom: 399px;
  width: 454px;
  height: 242px;
  font-size: 16px;
  justify-content: center;
  gap: 2px;
}

#fn-pushbutton7 {
  left: 298px;
  bottom: 205px;
  width: 225px;
  height: 88px;
  font-size: 10.67px;
}

#fn-pushbutton4 {
  left: 336px;
  bottom: 238px;
  width: 149px;
  height: 43px;
  font-size: 10.67px;
}

/* ax2=axes('Units','pix','Position',[100 350 500 20]); */
#fn-ax2 {
  position: absolute;
  left: 100px;
  bottom: 350px;
  width: 500px;
  height: 20px;
  background: #ffffff;
  border: 1px solid #000000;
  overflow: hidden;
}

#fn-ax2-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background-color: red;
  border-right: 1px solid blue;
}

#fn-ax2-text {
  position: absolute;
  left: 48%;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: #000000;
  pointer-events: none;
}

/* ============================================================
   MATLAB R2017b Launch Overlay (needed for browser audio gesture)
   ============================================================ */
#launch-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#launch-dialog {
  width: 390px;
  max-width: 92vw;
  background: #f0f0f0;
  border: 1px solid #1883d7;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-family: "Segoe UI", Tahoma, sans-serif;
}

.launch-header {
  background: #ffffff;
  border-bottom: 1px solid #d9d9d9;
  padding: 8px 12px;
  font-size: 12px;
  color: #000000;
}

.launch-body {
  padding: 18px 20px 20px;
  color: #111111;
  font-size: 13px;
}

.launch-cmd {
  font-family: Consolas, "Courier New", monospace;
  background: #ffffff;
  border: 1px solid #c0c0c0;
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #000080;
}

.launch-body p {
  margin: 0 0 16px;
  line-height: 1.45;
}

#launch-btn {
  width: 100%;
  padding: 9px 14px;
  background: #e1e1e1;
  border: 1px solid #adadad;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 13px;
  cursor: pointer;
}

#launch-btn:hover {
  background: #e5f1fb;
  border-color: #0078d7;
}
