/* v-word-003 : match page-word.php */

body {
  background: #eef1f4;
  color: #222;
  font-family: "Segoe UI", "Yu Gothic UI", sans-serif;
}

.word-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 上部タイトルバー */
.titlebar {
  height: 56px;
  background: #2b579a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
}

.title-left,
.title-center,
.title-right {
  display: flex;
  align-items: center;
}

.title-left {
  gap: 10px;
}

.word-icon {
  width: 30px;
  height: 30px;
  background: #1f3f73;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.doc-info {
  line-height: 1.15;
}

.doc-name {
  font-size: 14px;
  font-weight: 600;
}

.doc-sub {
  font-size: 11px;
  opacity: 0.92;
}

.search-box {
  width: 260px;
  max-width: 38vw;
  border: none;
  border-radius: 18px;
  padding: 8px 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.92);
}

.share-btn {
  border: none;
  background: #fff;
  color: #2b579a;
  border-radius: 18px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

/* メニュー */
.menubar {
  height: 36px;
  background: #f8f8f8;
  border-bottom: 1px solid #d9dfe6;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  font-size: 14px;
}

.menubar span:hover {
  background: #ebeff3;
  border-radius: 4px;
  padding: 2px 4px;
}

/* リボン */
.ribbon {
  min-height: 62px;
  background: #fbfbfb;
  border-bottom: 1px solid #d9dfe6;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  flex-wrap: wrap;
}

.ribbon-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 1px solid #e3e7ec;
  min-height: 32px;
}

.ribbon-group:last-child {
  border-right: none;
}

.ribbon > .ribbon-group > button,
.ribbon > .ribbon-group > select {
  height: 32px;
  border: 1px solid #cfd6dd;
  background: #fff;
  border-radius: 4px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* ===== B / 左中央右 / マーカー ===== */

.format-icon-button,
.align-icon-button {
  width: 40px;
  min-width: 40px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.bold-icon-button span {
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  color: #374151;
  display: inline-block;
  transform: translateY(-1px);
}

.align-icon {
  width: 18px;
  height: 14px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  vertical-align: middle;
  transform: translateY(-1px);
}

.align-icon span {
  display: block;
  height: 2px;
  background: #4b5563;
  border-radius: 2px;
}

.align-left span:nth-child(1) { width: 100%; margin-right: auto; }
.align-left span:nth-child(2) { width: 75%;  margin-right: auto; }
.align-left span:nth-child(3) { width: 90%;  margin-right: auto; }

.align-center span:nth-child(1) { width: 100%; margin-left: auto; margin-right: auto; }
.align-center span:nth-child(2) { width: 75%;  margin-left: auto; margin-right: auto; }
.align-center span:nth-child(3) { width: 90%;  margin-left: auto; margin-right: auto; }

.align-right span:nth-child(1) { width: 100%; margin-left: auto; }
.align-right span:nth-child(2) { width: 75%;  margin-left: auto; }
.align-right span:nth-child(3) { width: 90%;  margin-left: auto; }

.marker-button span {
  background: linear-gradient(transparent 45%, #fff59d 45%, #fff59d 88%, transparent 88%);
  padding: 0 2px;
  border-radius: 2px;
}

/* ===== 文字色Aボタン ===== */

.font-color-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.font-color-trigger {
  width: 36px;
  height: 32px;
  border: 1px solid #cfd6dd;
  background: #fff;
  border-radius: 4px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.font-color-trigger-a {
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  color: #222;
}

.font-color-trigger-underline {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: #222222;
  display: block;
}

.font-color-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px;
}

.font-color-panel[hidden] {
  display: none;
}

.font-color-panel .color-palette-grid {
  display: grid;
  grid-template-columns: repeat(10, 18px);
  grid-template-rows: repeat(2, 18px);
  gap: 4px;
  align-items: center;
}

.font-color-panel .color-swatch {
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 18px;
  max-height: 18px;
  padding: 0;
  margin: 0;
  border: 1px solid #c8ced6;
  border-radius: 4px;
  cursor: pointer;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.font-color-panel .color-swatch:hover {
  transform: scale(1.08);
}

.font-color-panel .color-swatch[data-value="#ffffff"] {
  border-color: #9aa0a6;
}

#font-size-select,
#font-family-select {
  margin-right: 8px;
  height: 32px;
}

/* ルーラー */
.ruler-wrap {
  height: 32px;
  background: #f7f8fa;
  border-bottom: 1px solid #d9dfe6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ruler {
  width: min(900px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 0;
  color: #6b7280;
  font-size: 12px;
}

.ruler span {
  text-align: center;
}

/* 作業エリア */
.workspace {
  flex: 1;
  padding: 34px 0 56px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
}

.page {
  width: min(900px, calc(100vw - 48px));
  min-height: 1120px;
  background: #fff;
  border: 1px solid #d9dfe6;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  margin-left: auto;
  margin-right: auto;
}

.document-body {
  padding: 56px 64px;
}

.editor,
.answer-box {
  width: 100%;
  border: none;
  background: #fff;
  padding: 16px 18px;
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: none;
}

.editor {
  min-height: 220px;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: #8a8a8a;
}

.action-row {
  margin: 18px 0 28px;
  display: flex;
  justify-content: flex-end;
}

.action-row {
  margin: 18px 0 28px;
  display: flex;
  justify-content: flex-end;
}

.send-link {
  display: inline-block;
  color: #355fa3;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  padding: 2px 0;
}

.send-link:hover {
  color: #244a86;
  text-decoration: underline;
}

.separator {
  height: 1px;
  background: #e5e7eb;
  margin: 20px 0 24px;
}

.answer-label {
  display: block;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #5b6570;
}

.answer-box {
  min-height: 260px;
  background: #fcfcfd;
}

.mini-pr-box {
  margin-top: 22px;
  font-size: 13px;
  color: #6b7280;
}

.mini-pr-label {
  font-weight: 700;
  margin-right: 6px;
}

.mini-pr-text {
  color: #6b7280;
}

/* 下部ステータスバー */
.statusbar {
  height: 34px;
  background: #f8f8f8;
  border-top: 1px solid #d9dfe6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 12px;
  color: #5f6368;
}

@media (max-width: 640px) {
  .workspace {
    padding-top: 20px;
  }

  .page {
    width: calc(100vw - 20px);
  }

  .document-body {
    padding: 28px 18px;
  }

  .ruler {
    width: calc(100vw - 20px);
  }
}