nav { font-family: monospace; font-size: 0.85em; padding: 12px 20px; }
nav a { color: inherit; text-decoration: none; }
nav a:hover { text-decoration: underline; }

body { margin: 0; font-family: monospace; background: #f8f8f8; }

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 20px;
}

h1 { font-size: 1.4em; margin: 0 0 12px; }
p { color: #555; font-size: 0.9em; line-height: 1.6; margin: 0 0 48px; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  background: #e0e0e0;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Base tooltip trigger */
.tip {
  position: relative;
  cursor: default;
  border-bottom: 1px dashed #aaa;
  color: #222;
}

.btn.tip {
  font-family: monospace;
  font-size: 0.85em;
  padding: 9px 20px;
  background: none;
  border: 1px solid #222;
  border-bottom: 1px solid #222;
  color: #222;
  cursor: pointer;
}

/* Tooltip bubble */
.tip::before {
  content: attr(data-tip);
  position: absolute;
  background: #222;
  color: #fff;
  font-size: 0.75em;
  padding: 6px 10px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tip:hover::before { opacity: 1; }

/* Top */
.tip[data-pos="top"]::before {
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}
.tip[data-pos="top"]:hover::before { transform: translateX(-50%) translateY(0); }

/* Bottom */
.tip[data-pos="bottom"]::before {
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}
.tip[data-pos="bottom"]:hover::before { transform: translateX(-50%) translateY(0); }

/* Left */
.tip[data-pos="left"]::before {
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}
.tip[data-pos="left"]:hover::before { transform: translateY(-50%) translateX(0); }

/* Right */
.tip[data-pos="right"]::before {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}
.tip[data-pos="right"]:hover::before { transform: translateY(-50%) translateX(0); }
