/* html/css/styles.css */

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

:root {
  --max-center-width: 900px;   /* Change this single value to adjust everything */
}

body, html {
  height: 100%;
  font-family: system-ui, sans-serif;
  background: #111;
  color: #eee;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 3fr 1fr;
  height: 100vh;
  gap: 0;
}

/* Sidebars */
.left-sidebar,
.right-sidebar {
  background: #222;
  padding: 1.5rem;
  overflow-y: auto;
  border: 1px solid #444;
}
.left-sidebar { border-right-style: solid; }
.right-sidebar { border-left-style: solid; }

/* ======================== CENTER COLUMN ======================== */
.center {
  background: #1e1e1e;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

/* Top and Bottom bars — share remaining space equally */
.top-bar,
.bottom-bar {
  width: 100%;
  max-width: var(--max-center-width);
  background: #2a2a2a;
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.top-bar    { border-bottom: 4px solid #00bfff; }
.bottom-bar { border-top:    4px solid #00bfff; }

/* ======================== RESPONSIVE PERFECT SQUARE ======================== */
.square-container {
  flex: 0 0 auto;
  width: 100%;
  max-width: var(--max-center-width);

  /* Always stay perfectly square */
  aspect-ratio: 1 / 1;

  /* Never exceed available height (leaves room for top + bottom panels) */
  max-height: calc(100vh - 12rem);

  /* When height becomes the limiting factor, shrink width too so it stays square */
  max-width: min(var(--max-center-width), calc(100vh - 12rem));

  position: relative;
  background: #fff;
  border: 6px solid #000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.square-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.square-content canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Mobile — hide sidebars */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .left-sidebar,
  .right-sidebar {
    display: none;
  }
  .top-bar,
  .bottom-bar {
    padding: 1rem;
  }
}
