*{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}input,textarea,[contenteditable="true"]{-webkit-user-select:text;user-select:text}

/* Gaya dasar Code - Studio: reset, komponen umum, animasi, anti-highlight biru */

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  background: var(--bg, #fdf4e7);
}

html,
body {
  margin: 0;
  height: var(--vvh, 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg, #fdf4e7);
  opacity: 0;
  transition: opacity 0.18s ease;
}

body.ready {
  opacity: 1;
}

body.leaving {
  opacity: 0;
  transition: opacity 0.15s ease;
}

input,
textarea,
select,
.allow-select {
  -webkit-user-select: text;
  user-select: text;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.topbar {
  flex: none;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  padding-bottom: 96px;
  -webkit-overflow-scrolling: touch;
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.icon-btn:active,
.btn:active,
.list-item:active {
  transform: scale(0.97);
  transition: transform 0.08s;
}

.btn {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
}

.btn-danger {
  color: #d64545;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  text-align: left;
  width: 100%;
}

.list-item .sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.list-item .grow {
  flex: 1;
  min-width: 0;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 18px 0 8px;
  letter-spacing: 0.02em;
}

.muted {
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
input.inp,
select.inp {
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.field textarea {
  height: auto;
  min-height: 70px;
  padding: 10px 12px;
  resize: vertical;
}

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

/* Baris daftar dengan tombol aksi di sampingnya */
.list-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-row .list-item {
  flex: 1;
  min-width: 0;
}

.danger-btn {
  color: #d64545;
}

/* Toolbar bawah (5 tombol) */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  height: 66px;
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 20;
}

.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  min-width: 56px;
}

.bottom-nav button.active {
  color: var(--accent);
}

.bottom-nav .fab {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: var(--accent);
  color: #ffffff;
  margin-top: -20px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
}

/* Modal */
.modal-back {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: var(--vvh, 100%);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.42);
  animation: fadeIn 0.18s ease;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(var(--vvh, 100vh) - 24px);
  overflow: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  animation: slideUp 0.22s ease;
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* Toast */
.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(84px + var(--kb, 0px));
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  max-width: 86vw;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.floaty {
  animation: floaty 4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Layar Home */

.brand-ic {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
}

.brand-ic .ic {
  width: 20px;
  height: 20px;
}

.hero h2 {
  margin: 4px 0 6px;
  font-size: 20px;
}

.hero p {
  margin: 0;
  font-size: 14px;
}

.floaty-wrap {
  background: linear-gradient(135deg, var(--surface), var(--surface));
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.stats b {
  display: block;
  font-size: 22px;
  color: var(--accent);
}

.stats span {
  font-size: 12px;
  color: var(--muted);
}

#splash { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: #fdf4e7; transition: opacity 0.35s ease; }
#splash.hilang { opacity: 0; pointer-events: none; }
#splash .logo { font-size: 42px; font-weight: 800; color: #e46b9b; animation: splashPop 0.6s ease-out both; }
#splash .bar { width: 120px; height: 4px; border-radius: 4px; background: rgba(228,107,155,0.2); overflow: hidden; }
#splash .bar span { display: block; height: 100%; width: 40%; background: #e46b9b; animation: splashGerak 1.2s ease-in-out infinite; }
@keyframes splashPop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes splashGerak { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

@font-face{font-family:"JetBrains Mono";src:url("fonts/JetBrainsMono-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:"JetBrains Mono";src:url("fonts/JetBrainsMono-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:swap}

/* Responsive compatibility patch: narrow phones, landscape, tablets and desktop. */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
html { min-width: 0; max-width: 100%; }
body { min-width: 0; max-width: 100%; }
img, video, canvas, iframe, svg { max-width: 100%; }
button, input, select, textarea { max-width: 100%; }
/* Flex/grid children must be allowed to shrink instead of pushing the page wider. */
.screen, .content, .workspace, .editor-area, .code-wrap, .panel, .tree-main,
.preview-stage, .main, .main-content, .project-content, .editor-layout,
.project-layout, .settings-content, .list-area { min-width: 0; }
@media (max-width: 600px) {
  .content { padding: 12px; padding-bottom: calc(76px + var(--safe-bottom)); }
  .topbar { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .topbar h1 { font-size: 14px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
  .btn { min-height: 38px; padding-left: 10px; padding-right: 10px; font-size: 13px; }
  .card { padding: 11px; border-radius: 13px; }
  .list-item { gap: 8px; padding: 10px; }
  .statusbar { gap: 6px; padding-left: 6px; padding-right: 6px; font-size: 10px; }
  .gutter { width: 34px; }
  #gutIn { padding-right: 6px; }
  .hl, #ta { padding-left: 7px; padding-right: 7px; }
  .console { height: 28%; max-height: 38%; }
  .sym-bar { gap: 4px; padding-left: 5px; padding-right: 5px; }
  .sym-bar button { min-width: 32px; height: 32px; padding: 0 6px; }
  .anim-panel { min-height: 130px; height: 30vh; }
  .vp-select { max-width: 120px; }
  .field, .field-line { min-width: 0; }
}
@media (max-width: 380px) {
  .topbar { gap: 2px; }
  .topbar h1 { font-size: 13px; }
  .content { padding-left: 9px; padding-right: 9px; }
  .icon-btn { width: 32px; height: 32px; }
  .btn { padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .statusbar { gap: 4px; font-size: 9px; }
  .anim-panel { padding: 8px; }
}
/* Landscape phones have very little height; give the working canvas priority. */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { height: 42px; min-height: 42px; }
  .content { padding-top: 8px; padding-bottom: 8px; }
  .console { height: 24%; max-height: 32%; }
  .anim-panel { height: 26vh; min-height: 88px; }
  #panel { max-height: 34vh; }
  .statusbar { height: 24px; }
}
@media (min-width: 760px) {
  .content { padding: 20px; }
  .card { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Responsive safety patch: preserve independent scroll areas on compact Android screens. */
html,body{min-width:0;max-width:100%;} *{box-sizing:border-box;}
.content,.panel,.file-list,.editor-side,.property-panel,.timeline,.settings-content{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
img,video,canvas,iframe{max-width:100%;}
button,input,select,textarea{max-width:100%;}
@media(max-width:600px){.content{padding-left:10px;padding-right:10px;} .card{min-width:0;} .topbar{gap:5px;padding-left:6px;padding-right:6px;} .topbar h1{font-size:15px;}}
@media(orientation:landscape) and (max-height:520px){.content{padding-top:8px;padding-bottom:72px;} .topbar{height:40px;min-height:40px;}}