/* Styles for Live Comment Panel */
.live-comment-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: visible;
  z-index: 10002;
  border-radius: 16px;
  padding: 0 10px;
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --box-shadow-emboss: -1px -1px 0 rgba(255, 255, 255, 0.3), 1px 1px 0 rgba(0, 0, 0, 0.55);
  background: var(--analysis-panel-bg);
  background-color: var(--analysis-panel-bg);
  background-image: none;
  border: none;
}

.live-comment-controls {
  display: grid;
  width: min(100%, 760px);
  margin: 0 auto;
  grid-template-columns: 40% repeat(3, 1fr);
  gap: 5px;
  position: relative;
}

.live-comment-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.live-comment-warning {
  position: absolute;
  right: 0;
  top: -28px;
  background: rgba(255, 99, 71, 0.95);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.live-comment-warning.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.comment-input-wrap {
  min-width: 140px;
}

.live-comment-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color:#fff;
  font-size:0.85rem;
  outline:none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}
.live-comment-input:focus {
  border-color:#7dd3fc;
  box-shadow: 0 0 0 2px rgba(125,211,252,0.25);
}

.live-comment-input--error::placeholder {
  color: #ffbaba;
}

.live-comment-dir-select,
.live-comment-tier-select,
.live-comment-submit {
  width: 100%;
  white-space: nowrap;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background:#4a9eff;
  color:#fff;
  font-size:0.82rem;
  font-weight:700;
  cursor:pointer;
  text-align:center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(76,144,255,0.5);
}
.live-comment-dir-select:hover,
.live-comment-tier-select:hover,
.live-comment-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(76,144,255,0.55);
}

.live-comment-dir-select,
.live-comment-tier-select {
  background: rgba(8,12,22,0.75);
  border: none;
  color: #fff;
  box-shadow: 0 0 0 rgba(0,0,0,0);
}

.live-comment-control-group {
  position: relative;
  padding-bottom: 6px; /* extend hover area */
}

.live-comment-control-group::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  pointer-events: none;
}

.live-comment-control-group.is-open .live-comment-popup {
  display: flex;
}

.live-comment-popup {
/*ここからcursorが書いたホバー6.6のコメビュアのPOPアップ*/

  display: none;
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  /*z-index: 10001;*/
  padding: 8px;
  flex-direction: column;
  gap: 3px;
  min-width: 110px;
}

.live-comment-popup[aria-hidden="false"] {
  display: flex;
}

.live-comment-dir-option,
.live-comment-tier-option {
  padding: 6px 10px;
  background: transparent;
  border: none;
  text-align: center;
  cursor: pointer;
  font-size: 0.82rem;
  border-radius: 4px;
  width: 100%; /* Make options fill the width of the popup */
  transition: background 0.2s ease, color 0.2s ease;
}

.live-comment-tier-button {
  align-items: center;
  justify-content: center;
}

.live-comment-dir-option:hover,
.live-comment-tier-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.live-comment-dir-option[data-dir="up"] {
  color: #0000FF;
  text-shadow: 0 0 12px rgba(0, 0, 255, 0.8);
  box-shadow: 0 0 10px rgba(0, 0, 255, 0.8);
}

.live-comment-dir-option[data-dir="down"] {
  color: #FF0000;
  text-shadow: 0 0 12px rgba(255, 0, 0, 0.8);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

.live-comment-tier-option {
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.live-comment-tier-option[data-tier="1"] {
  color: #16a34a;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.1);
}

.live-comment-tier-option[data-tier="2"] {
  color: #22c55e;
  text-shadow: 0 0 11px rgba(34, 197, 94, 0.3);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.live-comment-tier-option[data-tier="3"] {
  color: #ca8a04;
  text-shadow: 0 0 12px rgba(202, 138, 4, 0.45);
  box-shadow: 0 0 12px rgba(202, 138, 4, 0.45);
}

.live-comment-tier-option[data-tier="4"] {
  color: #f97316;
  text-shadow: 0 0 14px rgba(249, 115, 22, 0.7);
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.7);
}

.live-comment-tier-option[data-tier="5"] {
  color: #db2777;
  text-shadow: 0 0 16px rgba(219, 39, 119, 1);
  box-shadow: 0 0 16px rgba(219, 39, 119, 1);
}

.live-comment-popup--tier {
  padding: 14px;
  min-width: 260px;
}

.live-comment-tier-grid {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.live-comment-tier-option {
  flex: 1;
  min-width: 36px;
  max-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.live-comment-tier-option .tier-rank {
  font-weight: 700;
  font-size: 1rem;
}

.live-comment-tier-option .tier-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}


/* Popups are positioned dynamically by JS; these are fallbacks. */
#live-comment-dir-popup,
#live-comment-tier-popup {
  max-width: 320px;
  overflow: visible;
  opacity: 1;
}

/* Danmaku Container */
#danmaku-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999; /* Ensure comments are above the chart */
}

.danmaku-comment {
  position: absolute;
  white-space: nowrap;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 9999;
  -webkit-text-stroke: 0;
  text-stroke: 0;
}

/* Keyframe animation for danmaku flow (handled by JS). */

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
  .live-comment-controls {
    flex-wrap: wrap;
  }
  .live-comment-dir-select,
  .live-comment-tier-select,
  .live-comment-submit {
    flex: 1 1 auto; /* Make buttons expand on small screens */
  }
  .live-comment-popup {
    left: 0; /* Full width for popups on small screens */
    right: 0;
    width: auto;
  }
}
