@font-face {
  font-family: 'Minecraftia';
  src: url('/zengarden/Minecraftia.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root{
  --bg:#f4e9d6;   /* sand */
  --sand-dark:#e1cfae;
  --mark:#7a5a3c; /* rake mark */
  --accent:#6b8e23;
  --ui-bg: rgba(255,255,255,0.9);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:'Minecraftia', monospace;
  /* background: linear-gradient(180deg, var(--bg), var(--sand-dark)); */
  background: url('/zengarden/images/wood.jpg') center/cover no-repeat;
  color:#222;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:18px;
}

header{
  width:100%;
  max-width:1100px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

h1{font-size:18px;margin:0}
.controls{display:flex;gap:8px;align-items:center}
.controls button{
  background:#3e2723;
  border:1px solid #5d4037;
  color:white;
  padding:8px 10px;
  border-radius:0;
  cursor:pointer;
  font-size:14px;
  font-family:'Minecraftia', monospace;
}
.controls button:hover{box-shadow:0 1px 4px rgba(0,0,0,0.08)}
.controls button:disabled{
  background:#5d4037;
  color:#bcaaa4;
  cursor:not-allowed;
  border-color:#6d4c41;
}
.controls button:disabled:hover{box-shadow:none}
.result{font-size:13px;margin-left:8px;color:#333;max-width:360px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.tool-directions{
  width:100%;
  max-width:1100px;
  margin-bottom:12px;
  text-align:center;
}

.tool-directions p{
  background:var(--ui-bg);
  padding:12px 16px;
  border-radius:8px;
  border:1px solid #eee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin:0;
  font-size:14px;
  color:#555;
  font-style:italic;
}

main{
  width:100%;
  max-width:1100px;
  display:grid;
  grid-template-columns: 800px 1fr;
  gap:16px;
  align-items:start;
}

.tools{
  background:var(--ui-bg);
  padding:16px;
  border-radius:12px;
  border:1px solid #eee;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.tools h3{
  margin:0 0 12px 0;
  font-size:16px;
  color:#444;
}

.tool-buttons{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.tool-btn{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px;
  border:2px solid #5d4037;
  border-radius:0;
  background:#3e2723;
  color:white;
  cursor:pointer;
  transition:all 0.2s ease;
  font-size:14px;
  font-family:'Minecraftia', monospace;
}

.tool-btn:hover{
  border-color:#8d6e63;
  background:#704d3e;
  box-shadow:0 2px 8px rgba(0,0,0,0.3);
}

.tool-btn.active{
  border-color:#8d6e63;
  background:#c4876c;
  color:white;
  box-shadow:0 2px 8px rgba(0,0,0,0.4);
}

.tool-icon{
  font-size:18px;
}

.tool-name{
  font-weight:500;
  color:white;
}

.tool-btn.active .tool-name{
  color:white;
}

.action-section{
  margin-top:20px;
  padding-top:16px;
  border-top:1px solid #ddd;
}

.mode-actions h4{
  margin:0 0 8px 0;
  font-size:14px;
  color:#444;
}

.mode-actions p{
  margin:0 0 12px 0;
  font-size:12px;
  color:#666;
  line-height:1.4;
}

.mode-actions button{
  width:100%;
  background:#3e2723;
  border:1px solid #5d4037;
  color:white;
  padding:10px 12px;
  border-radius:0;
  cursor:pointer;
  font-size:12px;
  font-family:'Minecraftia', monospace;
  margin-bottom:8px;
}

.mode-actions button:hover{
  background:#704d3e;
  box-shadow:0 1px 4px rgba(0,0,0,0.08);
}

.mode-actions button:disabled{
  background:#5d4037;
  color:#bcaaa4;
  cursor:not-allowed;
  border-color:#6d4c41;
}

.share-result{
  font-size:11px;
  color:#333;
  word-wrap:break-word;
  overflow-wrap:break-word;
  line-height:1.3;
}

.share-result a{
  color:#6b8e23;
  text-decoration:none;
}

.share-result a:hover{
  text-decoration:underline;
}

.canvas-wrap{
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
  padding:12px;
  border-radius:12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

canvas{
  display:block;
  width:100%;
  height:auto;
  min-height:400px;
  max-height:70vh;
  background:var(--bg);
  image-rendering: pixelated; /* preserve pixel look when scaled */
  border-radius:8px;
  touch-action: none;
  aspect-ratio: 64/40; /* maintain grid proportions */
}

.legend{
  font-size:14px;
  background:var(--ui-bg);
  padding:12px;
  border-radius:8px;
  border:1px solid #eee;
  height:100%;
}
@media (max-width:880px){
  main{grid-template-columns:1fr; grid-template-rows: auto 1fr;}
  .tools{order:1;}
  .canvas-wrap{order:2;}
  .tool-buttons{flex-direction:row; justify-content:center;}
  .tool-btn{flex:1; flex-direction:column; gap:4px; padding:8px;}
  .tool-icon{font-size:16px;}
  .tool-name{font-size:12px;}
}

/* Responsive message styles */
.responsive-message {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #2c1810, #4a2c1a);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.message-content {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  max-width: 500px;
  margin: 20px;
}

.message-content h2 {
  font-family: 'Minecraftia', monospace;
  font-size: 24px;
  margin: 0 0 16px 0;
  color: #3e2723;
}

.message-content p {
  font-family: 'Minecraftia', monospace;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px 0;
  color: #5d4037;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Hide main content when screen is too small */
@media (max-width: 1023px), (max-height: 689px) {
  .main-content {
    display: none !important;
  }
  
  .responsive-message {
    display: flex !important;
  }
}

/* Show main content when screen is large enough */
@media (min-width: 1024px) and (min-height:690px) {
  .main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
  }
  
  .responsive-message {
    display: none !important;
  }
}
