.ymr-widget {
  --ymr-ink: #090909;
  --ymr-paper: #f7f5ef;
  --ymr-line: #979793;
  --ymr-green: #00bc71;
  --ymr-red: #f4002f;
  width: 100%;
  max-width: 1080px;
  margin: 24px auto;
  color: var(--ymr-ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  letter-spacing: 0;
}

.ymr-widget *,
.ymr-widget *::before,
.ymr-widget *::after {
  box-sizing: border-box;
}

.ymr-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  min-width: 0;
}

.ymr-tabs {
  display: flex;
  flex: 1;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 1px 7px;
  scrollbar-width: thin;
}

.ymr-tab {
  flex: 0 0 auto;
  min-width: 68px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font: 700 16px/1 "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  cursor: pointer;
}

.ymr-tab:hover,
.ymr-tab:focus-visible {
  border-color: #111;
  outline: 2px solid transparent;
}

.ymr-tab.is-active {
  border-color: #000;
  background: #000;
  color: #fff;
}

.ymr-archive-control {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 8px 0 11px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ymr-archive-control select {
  width: 128px;
  height: 30px;
  margin: 0;
  padding: 0 26px 0 8px;
  border: 0;
  background-color: #fff;
  color: #111;
  font-size: 13px;
}

.ymr-panel[hidden] {
  display: none !important;
}

.ymr-report-stack {
  display: grid;
  gap: 24px;
  width: 100%;
}

.ymr-output {
  width: 100%;
}

.ymr-canvas-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--ymr-paper);
}

.ymr-copy-actions {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.ymr-copy-status {
  color: #333;
  font-size: 13px;
  font-weight: 700;
}

.ymr-copy-status.is-error {
  color: #b00020;
}

.ymr-copy-button {
  min-width: 132px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid #111;
  border-radius: 4px;
  background: #111;
  color: #fff;
  font: 700 14px/1 "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  cursor: pointer;
}

.ymr-copy-button:hover {
  background: #333;
}

.ymr-copy-button:focus-visible {
  outline: 3px solid #6da7ff;
  outline-offset: 2px;
}

.ymr-copy-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ymr-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1350px;
  overflow: hidden;
  transform: scale(var(--ymr-scale, 1));
  transform-origin: top left;
  background-color: var(--ymr-paper);
  background-image:
    radial-gradient(circle at 14% 12%, rgba(165, 145, 129, 0.08) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 63%, rgba(163, 133, 144, 0.06) 0 1px, transparent 2px);
  background-size: 31px 29px, 37px 35px;
  color: var(--ymr-ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  letter-spacing: 0;
}

.ymr-logo {
  position: absolute;
  object-fit: contain;
}

.ymr-overview-header .ymr-logo {
  top: 28px;
  left: 58px;
  width: 112px;
  height: 112px;
}

.ymr-overview-title {
  position: absolute;
  top: 32px;
  left: 192px;
  right: 42px;
  text-align: center;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.32;
  white-space: nowrap;
}

.ymr-overview-title > div:first-child {
  font-size: 43px;
}

.ymr-flag {
  display: inline-block;
  margin-left: 4px;
  font-size: 39px;
  vertical-align: 4px;
}

.ymr-market-section {
  position: absolute;
  left: 32px;
  right: 32px;
  border: 2px solid var(--ymr-line);
  border-radius: 24px;
}

.ymr-section-title {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 20px;
  margin: 0;
  padding: 0;
  color: #000;
  font-size: 35px;
  font-weight: 800;
  line-height: 1;
}

.ymr-section-main {
  top: 153px;
  height: 415px;
}

.ymr-section-risk {
  top: 604px;
  height: 300px;
}

.ymr-section-dividend {
  top: 942px;
  height: 299px;
}

.ymr-section-risk .ymr-section-title,
.ymr-section-dividend .ymr-section-title {
  font-size: 29px;
}

.ymr-market-grid {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 16px;
  display: grid;
  grid-template-columns: repeat(var(--ymr-columns, 6), minmax(0, 1fr));
  gap: 8px;
}

.ymr-section-main .ymr-market-grid {
  top: 66px;
  grid-template-columns: repeat(var(--ymr-columns, 4), minmax(0, 1fr));
  gap: 22px;
}

.ymr-section-risk .ymr-market-grid,
.ymr-section-dividend .ymr-market-grid {
  top: 44px;
}

.ymr-market-item {
  display: grid;
  min-width: 0;
  grid-template-rows: 1fr auto 34px;
  justify-items: center;
  text-align: center;
}

.ymr-market-item strong {
  align-self: end;
  max-width: 100%;
  overflow: hidden;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.ymr-section-risk .ymr-market-item,
.ymr-section-dividend .ymr-market-item {
  grid-template-rows: 139px 78px 23px;
}

.ymr-section-risk .ymr-market-item strong,
.ymr-section-dividend .ymr-market-item strong {
  align-self: start;
  font-size: 19px;
  line-height: 1;
}

.ymr-bar-zone {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 92px;
}

.ymr-section-main .ymr-bar-zone {
  min-height: 190px;
}

.ymr-zero-line {
  position: absolute;
  z-index: 0;
  top: var(--ymr-baseline, 50%);
  left: -7px;
  right: -7px;
  height: 1px;
  background: #84847f;
}

.ymr-bar {
  position: absolute;
  z-index: 1;
  left: 50%;
  width: 64%;
  height: var(--bar-height);
  border: 1.5px solid #151515;
  border-radius: 11px;
  transform: translateX(-50%);
}

.ymr-section-risk .ymr-bar,
.ymr-section-dividend .ymr-bar {
  width: 48%;
  border-radius: 6px;
}

.ymr-bar.is-positive {
  bottom: calc(100% - var(--ymr-baseline, 50%));
  background: var(--ymr-green);
}

.ymr-bar.is-negative {
  top: var(--ymr-baseline, 50%);
  background: var(--ymr-red);
}

.ymr-value {
  position: absolute;
  z-index: 2;
  left: 50%;
  min-width: 110px;
  color: #000;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ymr-value.is-positive {
  bottom: calc(100% - var(--ymr-baseline, 50%) + var(--bar-height) + 9px);
}

.ymr-value.is-negative {
  bottom: calc(100% - var(--ymr-baseline, 50%) + 10px);
}

.ymr-section-risk .ymr-value,
.ymr-section-dividend .ymr-value {
  min-width: 90px;
  font-size: 17px;
}

.ymr-market-icon {
  display: block;
  width: 105px;
  height: 105px;
  margin: 0 auto 2px;
  background-image: url("../images/market-icons.png");
  background-repeat: no-repeat;
  background-size: 400% 400%;
}

.ymr-section-risk .ymr-market-icon,
.ymr-section-dividend .ymr-market-icon {
  width: 78px;
  height: 78px;
  margin-bottom: 0;
}

.ymr-icon-0 { background-position: 0 0; }
.ymr-icon-1 { background-position: 33.333% 0; }
.ymr-icon-2 { background-position: 66.667% 0; }
.ymr-icon-3 { background-position: 100% 0; }
.ymr-icon-4 { background-position: 0 33.333%; }
.ymr-icon-5 { background-position: 33.333% 33.333%; }
.ymr-icon-6 { background-position: 66.667% 33.333%; }
.ymr-icon-7 { background-position: 100% 33.333%; }
.ymr-icon-8 { background-position: 0 66.667%; }
.ymr-icon-9 { background-position: 33.333% 66.667%; }
.ymr-icon-10 { background-position: 66.667% 66.667%; }
.ymr-icon-11 { background-position: 100% 66.667%; }
.ymr-icon-12 { background-position: 0 100%; }
.ymr-icon-13 { background-position: 33.333% 100%; }
.ymr-icon-14 { background-position: 66.667% 100%; }
.ymr-icon-15 { background-position: 100% 100%; }

.ymr-icon-16,
.ymr-icon-17,
.ymr-icon-18,
.ymr-icon-19 {
  background-position: center;
  background-size: contain;
}

.ymr-icon-16 { background-image: url("../images/icon-nikkei225.png"); }
.ymr-icon-17 { background-image: url("../images/icon-innov-ai.png"); }
.ymr-icon-18 { background-image: url("../images/icon-qld.png"); }
.ymr-icon-19 { background-image: url("../images/icon-jepi.png"); }

.ymr-icon-17,
.ymr-icon-18,
.ymr-icon-19 {
  background-position: center 2px;
  background-size: 70% auto;
}

.ymr-icon-8,
.ymr-icon-9 {
  clip-path: inset(2px 0 7px);
}

.ymr-report-footer {
  position: absolute;
  right: 0;
  bottom: 12px;
  left: 0;
  text-align: center;
}

.ymr-report-footer strong {
  display: block;
  margin-top: 1px;
  font-size: 21px;
  font-weight: 800;
}

.ymr-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  height: 31px;
  font-size: 35px;
  font-weight: 900;
  line-height: 1;
}

.ymr-chat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 27px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  font-size: 15px;
  letter-spacing: 1px;
}

.ymr-send {
  font-size: 30px;
  transform: rotate(-22deg);
}

.ymr-note {
  position: absolute;
  right: 37px;
  bottom: 42px;
  font-size: 23px;
  font-weight: 800;
}

.ymr-ranking-header .ymr-logo {
  top: 48px;
  left: 112px;
  width: 142px;
  height: 142px;
}

.ymr-ranking-title {
  position: absolute;
  top: 54px;
  left: 275px;
  right: 55px;
  text-align: center;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.42;
  white-space: nowrap;
}

.ymr-ranking-chart {
  position: absolute;
  top: 246px;
  left: 42px;
  right: 38px;
  height: 980px;
}

.ymr-ranking-zero-label {
  position: absolute;
  top: -27px;
  left: 540px;
  width: 80px;
  font-size: 17px;
  text-align: center;
  transform: translateX(-50%);
}

.ymr-ranking-zero-line {
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 540px;
  width: 2px;
  background: #111;
}

.ymr-ranking-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  height: 49px;
  align-items: center;
}

.ymr-ticker {
  padding-right: 12px;
  font-size: 21px;
  font-weight: 800;
  text-align: right;
}

.ymr-ranking-axis {
  position: relative;
  height: 100%;
}

.ymr-ranking-bar {
  position: absolute;
  top: 11px;
  height: 27px;
  width: var(--bar-width);
  border-radius: 7px;
}

.ymr-ranking-bar.is-positive {
  left: 422px;
  background: var(--ymr-green);
}

.ymr-ranking-bar.is-negative {
  right: 460px;
  background: var(--ymr-red);
}

.ymr-ranking-value {
  position: absolute;
  top: 10px;
  min-width: 65px;
  font-size: 20px;
  line-height: 28px;
  white-space: nowrap;
}

.ymr-ranking-value.is-positive {
  left: calc(422px + var(--bar-width) + 7px);
}

.ymr-ranking-value.is-negative {
  right: calc(460px + var(--bar-width) + 7px);
  text-align: right;
}

.ymr-ranking-canvas .ymr-report-footer {
  bottom: 14px;
}

.ymr-empty {
  padding: 16px;
  border: 1px solid #bbb;
  background: #fff;
}

@media (max-width: 680px) {
  .ymr-widget {
    margin: 16px auto;
  }

  .ymr-toolbar {
    display: block;
  }

  .ymr-tabs {
    margin-bottom: 7px;
  }

  .ymr-archive-control {
    width: 100%;
    justify-content: space-between;
  }

  .ymr-archive-control select {
    width: 62%;
  }

  .ymr-report-stack {
    gap: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ymr-widget * {
    scroll-behavior: auto !important;
  }
}
