:root{
  --bg: #bcbcbc;
  --panel: #b3b5be;
  --panel-2: #0f1013;
  --text: #e6e6ea;
  --muted: #9aa0ad;
  --accent: #6affc1;
  --accent-2: #55d39b;
  --danger: #ef6a6a;
  --shadow: rgba(0,0,0,0.35);
	--first-column: 400px;
	--window: 480px;
}

* { box-sizing: border-box; }

html, body {
  height: auto;
  margin: 0;
  background: radial-gradient(1200px 800px at 70% -10%, #c6c9dbb7, var(--bg));
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
a {
  color: #434343;
}
.brush{
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: #e9ebf32b;
  height: 62px; display: grid; place-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, background .2s ease;
}
.brush img {
	width: 100%;
	max-width: 80px;
	max-height: 50px;
	image-rendering: auto;
}
.brush.pen{
  font-size: 12px; color: #cbd5e1;
}
.brush.active{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(106,167,255,0.25) inset;
  background: #242a3d;
}
.brush .badge{
  position: absolute; right: 6px; bottom: 6px;
  font-size: 10px; color: #cdd7ff; opacity: .8;
}
h1 {
	font-size: 4rem;
}
.app-grid{
  display: grid;
  /*grid-template-columns: 300px 1fr;*/
	grid-template-columns: var(--first-column) 1fr;
  gap: 18px;
  padding: 18px;
  min-height: 100vh;
}
.brush-list{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.buttons{
  display: grid; gap: 8px;
  grid-template-columns: 1fr 1fr;
}
.board-area{
  display: grid;
  place-items: center;
	align-self: start;
	grid-template-rows: 180px 1fr;
  padding: 6px;
}
.tool-section-main {
	display: none;
}
@media (max-width:1920px){
	.board-area {
    grid-template-rows: 120px 1fr;
}
}
@media(max-width:1680px) {
	:root {
		--first-column: 300px;
	}
	.board-area {
    grid-template-rows: 100px 1fr;
}
}
@media(max-width:1440px){
	:root {
		--first-column: 150px;
	}
.app-grid {
	/*grid-template-columns: 120px 1fr;*/
	gap: 8px;
	padding: 4px;
}
.brush {
	margin-left: 10%;
	width: 80%;
}
.board-area {
	align-self: start;
	grid-template-rows: 90px 1fr;
}
.brush-list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
}
.buttons {
	grid-template-columns: 1fr;
}
footer {
	display:none;
}
}

.board-frame{
 /* width: min(96vw, 1200px);*/
 /*width: calc(100% - 300px * 3);*/
 width: calc(100% - var(--first-column) * 2);
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(120% 120% at 50% 20%, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 50%),
    linear-gradient(180deg, #f4f4f4, #c6c5c4);
  border-radius: 16px;
  padding: 18px;
  box-shadow:
    0 30px 60px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -2px 0 rgba(0,0,0,0.35);
  display: grid;
  place-items: center;
}
@media(max-width:1280px){
	.brush{
		height: 40px;
	}
}
@media(max-width:1024px){
html {
	font-size:10px;
}
.board-frame{
	width: calc(100% - var(--first-column));
}
}
.sidebar{
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 10px 30px var(--shadow);
  position: sticky;
  top: 18px;
  height: fit-content;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.brand h1{
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.3px;
}
.logo-dot{
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(106,167,255,0.7);
}

.tool-section{
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255,255,255,0.08);
}
.tool-section:first-of-type{
  border-top: 0; padding-top: 0; margin-top: 8px;
}
.tool-section h2{
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted);
  margin: 0 0 10px;
}

.control{ margin: 10px 0; }
.control label{
  display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px;
}

input[type="color"],
select{
  width: 100%; height: 36px; border: 1px solid rgba(255,255,255,0.1);
  background: #5b5d64; border-radius: 8px; padding: 6px 8px; color: var(--text);
}

input[type="range"]{
  width: 100%;
  accent-color: var(--accent);
}

.btn, label.btn{
  appearance: none;
  background: #3d3d3e;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: center;
  transition: transform .05s ease, background .2s ease, border-color .2s ease;
  user-select: none;
}
.btn:hover, label.btn:hover{ background: #9fa0a4; }
.btn:active, label.btn:active{ transform: translateY(1px); }
.btn.primary{
  background: linear-gradient(180deg, #bdbdbe, #343536);
  border-color: rgba(0, 0, 0, 0.35);
}

.note{
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.footer{ margin-top: 12px; color: var(--muted); text-align: center;}

#boardCanvas{
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  background: linear-gradient(180deg, #fafafa, #f5f1eb);
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,0.25),
    inset 0 0 40px rgba(0,0,0,0.25);
  touch-action: none; /* Prevent scroll/zoom while drawing */
  cursor: crosshair;
}

.file-input{
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}

.hidden{ display: none !important; }
@media(orientation: portrait){
.board-frame {
	aspect-ratio: 3 / 4;
}
}
@media (max-width:600px){
	:root {
		--first-column: 70px;
}
.board-frame {
	width: calc(100% - var(--first-column) / 3);
}
.desktop {
	display:none;
}
.board-area {
	grid-template-rows: 6rem 1fr;
}
.btn, label.btn {
	height: 6rem;
	width: var(--window);
	background: linear-gradient(254deg, #2d2f32, #6affc1);
	border: 0.5rem solid #fff;
	border-radius:2rem;
}
.app-grid {
	gap:0;
	padding:0;
}
.sidebar {
	padding:0;
}
	html {
		font-size: 8px;
}
.brush-list {
	grid-template-columns: 1fr;
	gap:2px;
}
h1 span {
	display: none;
}
.buttons {
	width: 100%;
	height: 10rem;
	gap:0;
}
h2 span, p span {
		display:none;
}
.tool-section {
	margin-top: 0;
	padding-top: 0;
}
}
@media(max-width:480px){
	:root{
		--window: 480px;
	}
	.board-frame {
		aspect-ratio: 3 / 6;
	}
}
@media(max-width:430px){
	:root{
		--window: 430px;
	}
}
@media(max-width:414px){
	:root{
		--window: 414px;
	}
}
@media(max-width:360px){
	:root{
		--window: 360px;
	}
}
@media(max-width:320px){
	:root{
		--window: 320px;
    --first-column: 50px;
	}
  h1 {
    font-size: 3rem;
}
}