*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/*
  Palette:
    #2e1e1f  → background (very dark warm brown)
    #3E5F44  → forest green (accents, borders)
    #516171  → slate blue-gray (secondary text)
    #B3D1ED  → soft blue (info overlay, descriptions)
    #E5E6FA  → lavender (cell color 5)
    #f4f1de  → warm cream (keys text, cell color 6)
    #e07a5f  → terracotta (cell color 2)
    #F8395A  → coral/hot pink (cell color 1)
    #e30b5c  → deep pink (cell color 4)
  Derived:
    #090d1a  → cell inactive (dark blue)
    #121a2e  → cell hover
    #0f1525  → cell playhead column (empty)
*/

html {
  width: 100%;
  height: 100%;
  background: #2e1e1f;
  overflow: hidden;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#grid {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 1px;
  touch-action: none;
}

.cell {
  background: #090d1a;
  cursor: pointer;
  transition: background 0.07s, box-shadow 0.07s;
}

.cell:hover { background: #121a2e; }
.cell.head  { background: #0f1525; }

/* ── Cheatsheet overlay ── */
#cheatsheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(46, 30, 31, 0.93);
  animation: fadein 0.5s ease;
  transition: opacity 0.45s ease;
  cursor: pointer;
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cs-card {
  border: 1px solid #3E5F44;
  padding: 30px 36px;
  font-family: 'Courier New', monospace;
  max-width: 500px;
  width: calc(100% - 40px);
}

.cs-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.cs-key  { color: #f4f1de; letter-spacing: 0.18em; flex-shrink: 0; }
.cs-dot  { color: #3E5F44; }
.cs-desc { color: #B3D1ED; }
.cs-dim  { color: #516171; }

.cs-divider {
  border-top: 1px solid rgba(62, 95, 68, 0.35);
  margin: 13px 0;
}

.cs-drums, .cs-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 18px;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: #516171;
}

.cs-hint {
  margin-top: 22px;
  text-align: center;
  font-size: 0.6rem;
  letter-spacing: 0.45em;
  padding-left: 0.45em;
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { color: #3E5F44; }
  50%       { color: #f4f1de; }
}

/* ── Floating info overlay ── */
#info {
  position: fixed;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 1.3rem;
  letter-spacing: 0.3em;
  padding: 7px 22px 7px 28px;
  color: rgba(179, 209, 237, 0.95);
  background: rgba(13, 6, 7, 0.80);
  border: 1px solid rgba(62, 95, 68, 0.40);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  white-space: nowrap;
}

#info-hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.4em;
  padding: 4px 12px 4px 16px;
  color: rgba(244, 241, 222, 0.90);
  background: rgba(13, 6, 7, 0.82);
  border: 1px solid rgba(62, 95, 68, 0.55);
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.4s ease;
}

/* ── Launch menu ── */
#launch-menu {
  position: fixed;
  z-index: 20;
  background: rgba(9, 13, 26, 0.88);
  border: 1px solid rgba(62, 95, 68, 0.45);
  padding: 0 20px;
  font-family: 'Courier New', monospace;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
  transition: opacity 0.45s ease;
}

.launch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  letter-spacing: 0.18em;
  color: #516171;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.launch-item:hover { color: #f4f1de; }

.launch-arrow {
  color: #3E5F44;
}

.launch-item ion-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ── Tenori-on standalone ── */
#tenori-wrap {
  width: 100%;
  height: 100vh;
}

/* ── Nav buttons ── */
#nav-back {
  position: fixed;
  bottom: 14px;
  left: 24px;
  font-family: 'Courier New', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.4em;
  padding: 4px 12px 4px 16px;
  color: rgba(62, 95, 68, 0.85);
  background: rgba(13, 6, 7, 0.82);
  border: 1px solid rgba(62, 95, 68, 0.35);
  border-radius: 2px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  z-index: 5;
}

#nav-back:hover {
  color: #f4f1de;
  border-color: rgba(62, 95, 68, 0.8);
}

#nav-next {
  position: fixed;
  bottom: 14px;
  right: 24px;
  font-family: 'Courier New', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.4em;
  padding: 4px 12px 4px 16px;
  color: rgba(62, 95, 68, 0.85);
  background: rgba(13, 6, 7, 0.82);
  border: 1px solid rgba(62, 95, 68, 0.35);
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, opacity 0.4s ease;
  z-index: 5;
}

#nav-next:hover {
  color: #f4f1de;
  border-color: rgba(62, 95, 68, 0.8);
}

/* ── Slides layout ── */
#slides {
  width: 100%;
  transition: transform 0.85s cubic-bezier(0.86, 0, 0.07, 1);
}

.slide {
  width: 100%;
  height: 100vh;
  position: relative;
}

/* ── Terminal slide ── */
#slide-terminal {
  height: 100vh;
  background: #282a36;
  display: flex;
  flex-direction: column;
  padding: 40px 48px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #6272a4 transparent;
}

#terminal {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  padding-bottom: 32px;
}

#term-output {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  line-height: 1.7;
  color: #f8f8f2;
  padding-bottom: 8px;
}

#term-footer {
  position: sticky;
  bottom: 0;
  background: #282a36;
  border-top: 1px solid rgba(98, 114, 164, 0.25);
  padding: 10px 0 16px;
}

#term-copyright {
  font-family: 'Courier New', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.3em;
  color: rgba(98, 114, 164, 0.5);
  pointer-events: none;
}

.term-line   { display: block; white-space: pre-wrap; }
.term-err    { color: #ff5555; }
.term-dim    { color: #6272a4; }
.term-accent { color: #50fa7b; }
.term-cmd    { color: #f8f8f2; }

.term-run {
  cursor: pointer;
  transition: color 0.15s;
}
.term-run:hover { color: #f8f8f2; }

.term-file         { color: #ffb86c; }
.term-file-content { color: #bd93f9; }


.term-img {
  display: block;
  max-width: 320px;
  max-height: 320px;
  object-fit: cover;
  border: 1px solid rgba(98, 114, 164, 0.4);
  margin: 6px 0 2px;
}

.term-link {
  color: #8be9fd;
  text-decoration: none;
  transition: color 0.15s;
}
.term-link:hover {
  color: #f8f8f2;
  text-decoration: underline;
}

#term-input-line {
  display: flex;
  align-items: center;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.term-prompt {
  color: #50fa7b;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  margin-right: 8px;
  letter-spacing: 0.04em;
}

.term-prompt-user { color: #ff79c6; }

#term-input {
  background: transparent;
  border: none;
  outline: none;
  color: #f8f8f2;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  flex: 1;
  caret-color: #f8f8f2;
  width: 100%;
}

/* ── Cheatsheet nav link ── */
.cs-nav {
  text-align: right;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
}

#goto-about,
#goto-terminal {
  color: #3E5F44;
  cursor: pointer;
  transition: color 0.2s;
  font-family: 'Courier New', monospace;
}

#goto-about:hover,
#goto-terminal:hover { color: #f4f1de; }

/* ── Mobile view ── */
#mobile-view  { display: none; }

@media (max-width: 767px) {
  #slide-terminal { display: none; }
  #cheatsheet, #info-hint { display: none !important; }

  #mobile-view {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    background: #282a36;
    font-family: 'Courier New', monospace;
  }

  #mobile-inner {
    flex: 1;
    overflow-y: auto;
    padding: 40px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .mob-prompt {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: #f8f8f2;
  }

  .mob-user { color: #ff79c6; }

  /* tree */
  .mob-tree {
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mob-tree-root { color: #f8f8f2; margin-bottom: 2px; }

  .mob-branch { color: #6272a4; user-select: none; }
  .mob-fname  { color: #ffb86c; }
  .mob-dname  { color: #50fa7b; }
  .mob-dim    { color: #6272a4; }

  .mob-tree-item summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: baseline;
    gap: 6px;
  }
  .mob-tree-item summary::-webkit-details-marker { display: none; }

  .mob-tree-item[open] summary .mob-fname { color: #f8f8f2; }

  .mob-tree-content {
    padding: 6px 0 4px 28px;
    color: #bd93f9;
    font-size: 0.72rem;
    line-height: 1.7;
  }

  .mob-tree-content p { margin: 0; }

  .mob-tree-content a {
    color: #8be9fd;
    text-decoration: none;
  }
  .mob-tree-content a:hover { color: #f8f8f2; }

  .mob-tree-row { display: block; }

  .mob-tree-indent { padding-left: 22px; }

  .mob-launch {
    color: #8be9fd;
    text-decoration: none;
  }
  .mob-launch:hover { color: #f8f8f2; }

  #mobile-footer {
    padding: 12px 28px 16px;
    border-top: 1px solid rgba(98, 114, 164, 0.25);
    font-size: 0.58rem;
    letter-spacing: 0.3em;
    color: rgba(98, 114, 164, 0.5);
  }
}
