/* Record form: shared left column keeps all five entry edges aligned. */
#recordScreen .coffee-form {
  --entry-columns: minmax(0, 420px) minmax(0, 1fr);
  --entry-column-gap: 64px;
}
#recordScreen .record-entry-columns {
  display: grid;
  grid-template-columns: var(--entry-columns);
  gap: var(--entry-column-gap);
}

#recordScreen .mobile-priority-controls {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

#recordScreen .record-entry-main {
  grid-column: 1;
  grid-row: 1 / span 2;
}

#recordScreen .record-entry-side {
  grid-column: 2;
  grid-row: 2;
}

@media (max-width: 700px) {

  #recordScreen .record-entry-columns {
    display: flex;
    flex-direction: column;
    gap: 28px;
  }

  #recordScreen .mobile-priority-controls,
  #recordScreen .record-entry-main,
  #recordScreen .record-entry-side {
    grid-column: auto;
    grid-row: auto;
  
  }

  #recordScreen .mobile-priority-controls {
    align-self: center;
    max-width: 100%;
  }
  
}

#recordScreen .roast-choice {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  color: inherit;
  opacity: 0.62;
}

#recordScreen .roast-choice:hover {
  opacity: 0.86;
}

#recordScreen .roast-choice[aria-pressed="true"] {
  opacity: 1;
}
  

.record-entry-main,
.record-entry-side {
  min-width: 0;
}

#recordScreen .basic-info-bean {
  display: grid;
  align-items: center;
  gap: 12px;
}

#recordScreen .bean-name-field {
  min-width: 0;
}

#recordScreen .bean-name-field input {
  width: 100%;
  box-sizing: border-box;
}

#recordScreen .record-gear-icon {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 0;
}

#recordScreen .record-gear-icon[hidden] {
  display: none;
}

#recordScreen .record-gear-icon.is-popping {
  animation: record-gear-pop 320ms ease-out;
}

.record-gear-frame {
  width: 92px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transform: translate(20px, 10px);

}

.record-visual-top {
  display: flex;
  align-items: center;
  gap: 36px;
  justify-content: center;
}

.record-gear-frame {
  transform: translateX(20px);
}

@keyframes record-gear-pop {
  0% { opacity: 0; transform: translateY(6px) scale(0.82); }
  65% { opacity: 1; transform: translateY(-2px) scale(1.05); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #recordScreen .record-gear-icon.is-popping {
    animation: none;
  }
}

/* Match the other-country underline without moving either label or text.
   Offset the extra padding with margin to preserve the following rows. */
#recordScreen .basic-info-bean input {
  padding: 8px 12px;
  border: solid 3px #444;
  border-radius: 6px;
  height: 38px;
}

#recordScreen .aligned-entry,
#recordScreen .aligned-entry .coffee-number-input,
#recordScreen .aligned-entry input,
#recordScreen .aligned-entry select {
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}

.record-entry-main > .aligned-entry {
  margin-top: 20px;
}

#recordScreen .aligned-entry input,
#recordScreen .aligned-entry select {
  height: 38px;
  padding: 8px 12px;
  line-height: 16px;
  border: 3px solid #444;
  border-radius: 5px;
  background-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

/* Selects were 25.6px high with 6px below; preserve their 31.6px footprint
   so enlarging the control does not move the following labels or fields. */
#recordScreen .aligned-entry select {
  margin-bottom: -0.4px;
  /* Replace the native arrow without changing the control's box. */
  background-image: linear-gradient(45deg, transparent 50%, #3b2a20 50%),
                    linear-gradient(135deg, #3b2a20 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 12px) center;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

/* The country select sits in normal flow rather than a flex column.
   Preserve its former 2px baseline clearance with an explicit block gap. */
#recordScreen .basic-info-country.aligned-entry select {
  display: block;
  margin-top: 2px;
}

.record-entry-main > .aligned-entry label {
  margin-top: 0;
}

.record-entry-main > .record-memo-column {
  margin-top: 32px;
}

.record-entry-side > .temperature-choice-field {
  margin-top: 24px;
}

/* Keep the right column compact, including when purchase fields expand. */
#recordScreen .record-entry-side > .purchase-details {
  margin-top: 24px;
  /* Keep the border space so hiding the rules does not shift the layout. */
  border-top-color: transparent;
  border-bottom-color: transparent;
}

.record-entry-side > .roast-choice-field {
  margin-top: 24px;
}

.record-entry-side .purchase-details-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.record-entry-side .purchase-details-grid > .bean-setting-item {
  min-width: 0;
}

/* Hidden native selects still drive the existing choice-button handlers. */
#recordScreen .visual-choice-source {
  width: 1px;
  min-width: 0;
}

.record-entry-side > .record-taste-preview {
  width: min(100%, 300px);
  margin: 32px auto 0;
}

.record-entry-side > .record-photo-column {
  margin-top: 24px;
}

.record-entry-side .temperature-choices {
  grid-template-columns: repeat(2, 72px);
  justify-content: center;
}

.record-entry-side .temperature-choice-field > .choice-label {
  text-align: center;
}

/* Keep the existing compact roast choices after moving their wrapper. */
.record-entry-side .roast-choice {
  min-height: 72px;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 0.62;
}

.record-entry-side .roast-choice:hover {
  opacity: 0.86;
}

.record-entry-side .roast-choice[aria-pressed="true"] {
  background: transparent;
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: none;
}

.record-entry-side .record-photo-column input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ========================================
   記録ページ下部の操作エリア
   保存・編集終了・リセットを横並びに配置
======================================== */

#recordScreen .coffee-form > .save-actions {
  margin-top: 48px;
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: space-between;

}


/* ========================================
   下部3ボタン
   通常時は文字だけ
======================================== */

#recordScreen .save-actions #saveButton,
#recordScreen .save-actions #cancelEditButton,
#recordScreen .save-actions #resetButton {
  position: relative;

  width: 300px;
  height: 48px;

  margin: 0;
  padding: 8px 14px;

  border: none;
  background: transparent;
  color: #444;

  font-size: 16px;
  font-weight: 600;

  cursor: pointer;
}


/* ========================================
   ボタンの並び順
======================================== */

#recordScreen .save-actions #saveButton {
  order: 1;
}

#recordScreen .save-actions #cancelEditButton {
  order: 2;
}

#recordScreen .save-actions #resetButton {
  order: 3;
}


/* ========================================
   下部3ボタン共通の斜線
   通常時は非表示
======================================== */

#recordScreen .save-actions #saveButton::after,
#recordScreen .save-actions #cancelEditButton::after,
#recordScreen .save-actions #resetButton::after {
  content: "";

  position: absolute;

  left: 50%;
  bottom: 8px;
  height: 3px;
  width: 140px;

  transform: translateX(-50%);

  background:
    repeating-linear-gradient(
      90deg,
      #444 0,
      #444 6px,
      transparent 6px,
      transparent 10px
    );

  opacity: 0;
  transition: opacity 0.15s ease;

  pointer-events: none;
}


/* ========================================
   ホバーしたボタンだけ斜線を表示
======================================== */

#recordScreen .save-actions #saveButton:hover::after,
#recordScreen .save-actions #cancelEditButton:hover::after,
#recordScreen .save-actions #resetButton:hover::after {
  opacity: 1;
}


/* ========================================
   スマホ表示
   下部操作を縦方向でも扱いやすくする
======================================== */

@media (max-width: 700px) {
  #recordScreen .coffee-form > .save-actions {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-top: 2px;
  }
}

  #recordScreen .save-actions #resetButton {
    width: 100%;
    margin-left: 0;
  }


@media (min-width: 701px) {
  #recordScreen .record-entry-columns {
    min-height: 1008px;
  }
}

.coffee-photo-preview {
  position: relative;
  grid-column: 1;
  grid-row: 4;
  width: 180px;
  max-width: 100%;
  display: none;
}

#deletePhotoButton {
  position: absolute;
  top: 8px;
  right: 8px;

  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;

  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
  line-height: 1;
}

#coffeePhotoPreview {
  width: 180px;
  height: 180px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  margin-top: 12px  ;
}

#recordScreen .record-gear-frame {
  transform: translate(20px, 10px) !important;
}

#recordGearIcon[src*="V60 Dripper"] {
  width: 68px;
  height: 68px;
}

/* Save guidance is scoped to the area below the existing record navigation. */
#recordScreen .record-save-note {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin: 12px 0 0;
  color: #554a3d;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: normal;
  text-align: left;
}
#recordScreen .record-save-note a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  max-width: 100%;
  padding: 6px 0;
  box-sizing: border-box;
  color: #4b3828;
  font-size: inherit;
  font-weight: 600;
  line-height: 1.6;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#recordScreen .record-guide-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#recordScreen .record-save-note a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
